/* Importar fuente moderna */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: url('/images/background.jpg') no-repeat center center fixed; 
  background-size: cover;
  background-attachment: fixed;
  margin: 0;
  padding: 0;
  text-align: center;
  min-height: 100vh;
  position: relative;
}

/* Overlay oscuro para mejor legibilidad */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

.dashboard {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard h2 {
  color: white;
  margin-top: 20px;
  font-size: 2.5em;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  margin-bottom: 30px;
  letter-spacing: -0.5px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.truck-box {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 25px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255,255,255,0.8);
  position: relative;
  overflow: hidden;
}

.truck-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #1abc9c, #3498db, #9b59b6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.truck-box:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}

.truck-box:hover::before {
  transform: scaleX(1);
}

.truck-box img {
  border-radius: 12px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

.truck-box:hover img {
  transform: scale(1.05);
}

.truck-box p {
  margin: 8px 0;
  color: #2c3e50;
  font-size: 0.95em;
  line-height: 1.6;
}

.truck-box strong {
  color: #34495e;
  font-weight: 600;
}

/* Dropdown menu styles mejorado */
.dropdown {
  position: fixed;
  top: 20px;
  left: 20px;
  display: inline-block;
  z-index: 1000;
  padding-bottom: 5px; /* Espacio para el área de transición */
}

.dropbtn {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #2c3e50;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.dropbtn:hover {
  background: white;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  min-width: 220px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
  z-index: 1;
  left: 0;
  top: 55px;
  border-radius: 12px;
  overflow: hidden;
  animation: slideDown 0.3s ease;
  margin-top: 0;
}

/* Área invisible que conecta el botón con el menú para facilitar el movimiento del cursor */
.dropdown-content::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 10px;
  background: transparent;
  z-index: -1;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-content a {
  color: #2c3e50;
  padding: 14px 20px;
  text-decoration: none;
  display: block;
  transition: all 0.2s ease;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.dropdown-content a:hover {
  background: linear-gradient(90deg, #f8f9fa, #e9ecef);
  border-left-color: #1abc9c;
  padding-left: 24px;
}

/* Mantener el menú abierto cuando el cursor está sobre el dropdown o el contenido */
.dropdown:hover .dropdown-content,
.dropdown-content:hover {
  display: block;
}

/* Área invisible extendida entre el botón y el menú para facilitar el movimiento del cursor */
.dropdown::after {
  content: '';
  position: absolute;
  top: 50px;
  left: 0;
  width: 220px;
  height: 5px;
  background: transparent;
  z-index: 999;
  pointer-events: auto;
}

/* Form popup styles mejorado */
.form-popup {
  display: none;
  background: white;
  padding: 35px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.form-popup h3 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 25px;
  font-size: 1.8em;
  font-weight: 700;
  text-align: center;
}

.form-popup label {
  display: block;
  margin-top: 15px;
  margin-bottom: 8px;
  color: #34495e;
  font-weight: 600;
  font-size: 0.95em;
  text-align: left;
}

.form-popup input,
.form-popup select,
.form-popup textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1em;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.form-popup input:focus,
.form-popup select:focus,
.form-popup textarea:focus {
  outline: none;
  border-color: #1abc9c;
  box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

.form-popup button {
  padding: 12px 30px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  margin: 8px 5px;
}

.form-popup button[onclick*="save"],
.form-popup button[onclick*="Guardar"] {
  background: linear-gradient(135deg, #1abc9c, #16a085);
  color: white;
}

.form-popup button[onclick*="save"]:hover,
.form-popup button[onclick*="Guardar"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(26, 188, 156, 0.3);
}

.form-popup button[onclick*="close"],
.form-popup button[onclick*="Cerrar"],
.form-popup button[onclick*="Cancelar"] {
  background: #95a5a6;
  color: white;
}

.form-popup button[onclick*="close"]:hover,
.form-popup button[onclick*="Cerrar"]:hover,
.form-popup button[onclick*="Cancelar"]:hover {
  background: #7f8c8d;
  transform: translateY(-2px);
}

/* Botones mejorados */
button {
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

/* Inputs y selects mejorados */
input[type="number"],
input[type="text"],
input[type="date"],
select {
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: #1abc9c;
  box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

/* Contenedores de filtros mejorados */
.filter-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 16px;
  margin: 20px auto;
  max-width: 500px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.8);
}

.filter-container label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95em;
  text-align: left;
}

.filter-container input[type="number"],
.filter-container select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1em;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  background: white;
}

.filter-container input[type="number"]:focus,
.filter-container select:focus {
  outline: none;
  border-color: #1abc9c;
  box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

/* Botones de exportación mejorados */
.export-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.export-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.export-btn-pdf {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.export-btn-pdf:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

.export-btn-excel {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
}

.export-btn-excel:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
}

/* Result container mejorado */
.result-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 25px;
  display: inline-block;
  margin-top: 30px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.8);
}

.result-container p {
  font-size: 1.3em;
  color: #2c3e50;
  margin: 0;
  font-weight: 600;
}

/* Mejoras para los botones de acción en las cards */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.btn-edit {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(52, 152, 219, 0.3);
}

.btn-delete {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.btn-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(231, 76, 60, 0.3);
}

/* Animación de carga */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.truck-box {
  animation: fadeIn 0.5s ease;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #1abc9c, #16a085);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #16a085, #1abc9c);
}

/* Responsive */
@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
  }
  
  .dashboard h2 {
    font-size: 2em;
  }
  
  .form-popup {
    width: 95%;
    padding: 25px;
  }
  
  .export-buttons {
    flex-direction: column;
  }
  
  .export-btn {
    width: 100%;
  }
}
