/* Importar fuente premium Outfit desde Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #08090a; /* Negro profundo */
  --bg-secondary: #121417; /* Gris oscuro carbón */
  --bg-glass: rgba(18, 20, 23, 0.75);
  --bg-glass-card: rgba(31, 34, 39, 0.45);
  --text-primary: #f3f4f6; /* Gris muy claro / Blanco */
  --text-secondary: #9ca3af; /* Gris medio */
  --text-muted: #6b7280; /* Gris apagado */
  
  /* Colores de acento */
  --accent: #f5be18; /* Amarillo corporativo Egaña */
  --accent-hover: #dab212; /* Amarillo hover */
  --accent-glow: rgba(245, 190, 24, 0.15);
  --accent-gold: #eab308;
  --accent-gold-hover: #ca8a04;
  
  /* Estados */
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f5be18;
  
  /* Bordes y Sombras */
  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: #f5be18;
  --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-glow: 0 0 20px rgba(245, 190, 24, 0.12);
  
  --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(245, 190, 24, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(107, 114, 128, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* --- DISEÑO DE PANTALLAS --- */
.screen {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen.active {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* --- PANTALLA DE ACCESO (LOGIN) --- */
#login-screen {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-container {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-premium);
  text-align: center;
}

.login-logo {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 30px;
  font-weight: 300;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
  background: rgba(0, 0, 0, 0.3);
}

.input-error {
  color: var(--color-danger);
  font-size: 0.8rem;
  margin-top: 5px;
  display: none;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #0284c7);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4), var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

/* --- CATALOGUE HEADER --- */
header {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-logo {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-admin {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
}

.btn-admin:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: white;
}

/* --- MAIN CONTAINER --- */
main {
  flex: 1;
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* --- FILTROS DE BÚSQUEDA --- */
.filters-section {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--border-radius-md);
  margin-bottom: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  box-shadow: var(--shadow-premium);
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group.search {
  flex: 2;
}

.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* --- CATÁLOGO GRID --- */
.catalog-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.catalog-title-bar h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.stock-count {
  color: var(--text-secondary);
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
}

/* --- TARJETA DE VEHÍCULO --- */
.vehicle-card {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.vehicle-card:hover {
  transform: translateY(-8px);
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), var(--shadow-glow);
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* Relación de aspecto 16:9 */
  overflow: hidden;
  background-color: #1a202c;
}

.card-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.vehicle-card:hover .card-image-wrapper img {
  transform: scale(1.08);
}

.status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-badge.disponible {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge.reservado {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-badge.vendido {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.vehicle-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.vehicle-year {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-weight: 500;
}

.vehicle-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
}

.vehicle-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 4px;
}

.vehicle-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.spec-item svg {
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
}

.btn-card {
  margin-top: auto;
  width: 100%;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--accent);
  padding: 10px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.vehicle-card:hover .btn-card {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* --- MODALES --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.vehicle-summary-mini {
  display: flex;
  gap: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.vehicle-summary-mini img {
  width: 80px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

.vehicle-summary-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.vehicle-summary-info p {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* --- PANEL DE ADMINISTRACIÓN --- */
.admin-modal {
  max-width: 900px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 500px;
}

.admin-sidebar {
  border-right: 1px solid var(--border-color);
  padding-right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-tab-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.admin-tab-btn.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.admin-content {
  padding-left: 24px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* Listado de stock en Admin */
.admin-stock-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th, 
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-thumb {
  width: 50px;
  height: 35px;
  object-fit: cover;
  border-radius: 4px;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-icon.edit:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.05);
}

.btn-icon.delete:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.05);
}

/* Entradas editables en la tabla de vista previa del PDF */
.pdf-table-input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  width: 100%;
  transition: all 0.3s ease;
}
.pdf-table-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.7);
}

/* Vista previa de subida */
.image-upload-preview {
  margin-top: 10px;
  border: 2px dashed var(--border-color);
  padding: 10px;
  border-radius: var(--border-radius-sm);
  text-align: center;
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-preview img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.image-upload-preview .placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Footer styling */
footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Botón flotante de administración en desktop */
.admin-trigger-footer {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
  margin-top: 10px;
  display: inline-block;
}

.admin-trigger-footer:hover {
  color: var(--accent-gold);
}

/* Responsivo */
@media (max-width: 768px) {
  header {
    padding: 16px 20px;
  }
  
  main {
    padding: 20px;
  }
  
  .filters-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding-right: 0;
    padding-bottom: 16px;
    margin-bottom: 16px;
    flex-direction: row;
    overflow-x: auto;
  }
  
  .admin-tab-btn {
    white-space: nowrap;
    width: auto;
  }
  
  .admin-content {
    padding-left: 0;
  }
}

/* Mobile específico (pantallas pequeñas <= 480px) */
@media (max-width: 480px) {
  header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .header-logo {
    font-size: 1.25rem;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  .btn-secondary {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .login-container {
    padding: 30px 16px;
  }
  
  .login-logo {
    font-size: 2rem;
  }
  
  .catalog-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .catalog-title-bar h2 {
    font-size: 1.4rem;
  }
  
  .vehicles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .vehicle-specs {
    display: none;
  }
  
  .card-content {
    padding: 10px;
  }
  
  .card-header-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 4px;
  }
  
  .vehicle-title {
    font-size: 0.9rem;
    margin-bottom: 2px;
  }
  
  .vehicle-year {
    font-size: 0.7rem;
    padding: 1px 4px;
  }
  
  .vehicle-price {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }
  
  .btn-card {
    padding: 8px 4px;
    font-size: 0.8rem;
  }
  
  .modal-overlay {
    padding: 10px;
  }
  
  .modal-container {
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .admin-content {
    padding: 16px 8px;
  }
  
  .admin-table th, .admin-table td {
    padding: 8px 6px;
    font-size: 0.8rem;
  }
}
