/*
 * MODALS
 * Stiluri pentru modale (editare, cameră, imagine)
 */

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease-out;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 15px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: linear-gradient(135deg, #e1b922 0%, #d12627 100%);
  color: white;
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.modal-close:hover {
  transform: scale(1.2) rotate(90deg);
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1;
}

.modal-field {
  margin-bottom: 20px;
}

.modal-field label {
  display: block;
  font-weight: 600;
  color: #d12627;
  margin-bottom: 8px;
  font-size: 14px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1b922;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s;
  box-sizing: border-box;
}

.modal-field textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: #d12627;
  box-shadow: 0 0 0 3px rgba(209, 38, 39, 0.1);
}

.modal-field input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.modal-footer {
  padding: 20px 25px;
  background-color: #f8f9fa;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #dee2e6;
}

.modal-footer .btn {
  min-width: 130px;
}

/* Image Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.image-modal.active {
  display: flex !important;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  cursor: pointer;
}

.image-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
  z-index: 10000;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 5px;
  right: 8px;
  background: #fff;
  border: 0;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10001;
  font-size: 18px;
}

.image-modal-close:hover {
  background: #f0f0f0;
}

/* ========================================
   RAPOARTE MODAL - Mobile Friendly
   ======================================== */

.rapoarte-btn-wrapper {
  margin-bottom: 20px;
  text-align: center;
}

.rapoarte-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.3s ease-out;
}

.rapoarte-modal.active {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

@media (min-width: 768px) {
  .rapoarte-modal.active {
    align-items: center;
  }
}

.rapoarte-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  cursor: pointer;
}

.rapoarte-modal-content {
  position: relative;
  background: white;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  box-shadow: none;
  animation: fadeIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
}

@media (min-width: 768px) {
  .rapoarte-modal-content {
    max-width: 600px;
    max-height: 90vh;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rapoarte-modal-header {
  background: linear-gradient(135deg, #e1b922 0%, #d12627 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.rapoarte-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.rapoarte-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.rapoarte-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.rapoarte-driver-selector {
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rapoarte-driver-selector label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.rapoarte-driver-selector input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e1b922;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rapoarte-driver-selector input:focus {
  outline: none;
  border-color: #d12627;
}

.rapoarte-driver-selector .route-dropdown-container {
  position: relative;
}

.rapoarte-driver-selector .route-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 2px solid #e1b922;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 10001;
  display: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.rapoarte-driver-selector .route-suggestions.active {
  display: block;
}

.rapoarte-filter-wrapper {
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rapoarte-filter-wrapper label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.rapoarte-filter-wrapper input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e1b922;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.rapoarte-filter-wrapper input:focus {
  outline: none;
  border-color: #d12627;
}

.rapoarte-filter-wrapper .route-dropdown-container {
  position: relative;
}

.rapoarte-filter-wrapper .route-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.rapoarte-filter-wrapper .route-suggestions.active {
  display: block;
}

.rapoarte-modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.rapoarte-loading,
.rapoarte-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 16px;
}

/* Raport Card Styles */
.raport-card {
  background: #fff;
  border: 2px solid #e1b922;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.raport-card:last-child {
  margin-bottom: 0;
}

.raport-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.raport-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.raport-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.raport-date {
  font-size: 13px;
  color: #666;
}

.raport-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.raport-status.status-aprobat {
  background: #d4edda;
  color: #155724;
}

.raport-status.status-respins {
  background: #f8d7da;
  color: #721c24;
}

.raport-status.status-in-curs {
  background: #fff3cd;
  color: #856404;
}

.raport-ticket-id {
  font-size: 12px;
  color: #999;
  font-weight: 500;
}

.raport-client {
  margin-bottom: 8px;
}

.raport-client strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 2px;
}

.raport-client span {
  font-size: 13px;
  color: #666;
}

.raport-traseu {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

/* Products List in Raport */
.raport-produse {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
}

.raport-produse-header {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.raport-produs-item {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.raport-produs-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.produs-denumire {
  color: #333;
  word-break: break-word;
}

.produs-cantitate {
  text-align: center;
  font-weight: 500;
  color: #d12627;
}

.produs-lot {
  text-align: right;
  color: #666;
  font-size: 12px;
}

.raport-facturat {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.raport-facturat.facturat-da {
  background: #d4edda;
  color: #155724;
}

.raport-facturat.facturat-nu {
  background: #f8d7da;
  color: #721c24;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .raport-produse-header {
    grid-template-columns: 1fr 60px 70px;
  }

  .raport-produs-item {
    grid-template-columns: 1fr 60px 70px;
    font-size: 12px;
  }

  .raport-header {
    flex-direction: column;
    gap: 8px;
  }

  .raport-ticket-id {
    align-self: flex-start;
  }
}
