/* =================================================================== */
/* BASE.CSS - SIGEGPRO Sistema de Gestión de Proyectos                */
/* Ministerio de Obras Públicas y Comunicaciones (MOPC)               */
/* Versión: 2.1 - Optimizada                                          */
/* =================================================================== */

/* Importar fuentes desde Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Material+Icons&display=swap');

/* ==================== VARIABLES CSS ==================== */
:root {
  /* Colores MOPC */
  --primary-color: #00529B;
  --secondary-color: #F37021;
  --primary-dark: #003d82;
  
  /* Colores de estado */
  --success-color: #4caf50;
  --error-color: #f44336;
  --warning-color: #ff9800;
  --info-color: #2196f3;
  
  /* Colores de fondo y texto */
  --background-color: #f4f4f4;
  --surface-color: #ffffff;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --text-white: #ffffff;
  
  /* Espaciados */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;
  
  /* Bordes y sombras */
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  
  /* Sombras */
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 8px 25px rgba(0, 0, 0, 0.2);
  
  /* Transiciones */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Z-indices */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ==================== RESET Y BASE ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', 'Arial', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== LAYOUT PRINCIPAL ==================== */
.main-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==================== ACCESIBILIDAD ==================== */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip links para accesibilidad */
a[href="#main-content"] {
  position: absolute;
  top: -40px;
  left: 6px;
  z-index: var(--z-tooltip);
  padding: 8px 16px;
  background: var(--primary-color);
  color: var(--text-white);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  transition: top var(--transition-fast);
}

a[href="#main-content"]:focus {
  top: 6px;
}

/* Estados de focus mejorados */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button:focus,
.btn:focus,
a:focus {
  outline-offset: 4px;
}

/* ==================== CONTENIDO PRINCIPAL ==================== */
main {
  flex: 1;
  padding: var(--spacing-lg);
  margin-left: 260px;
  min-height: calc(100vh - 200px);
  transition: margin-left var(--transition-normal);
  width: calc(100% - 260px);
}

.container {
  max-width: 95%;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ==================== TIPOGRAFÍA ==================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--primary-color);
  font-weight: 500;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* Títulos con línea decorativa */
h2.with-line {
  position: relative;
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--secondary-color);
}

h2.with-line::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 50px;
  height: 2px;
  background: var(--primary-color);
}

/* ==================== NAVEGACIÓN MÓVIL ==================== */
.sidenav-trigger {
  position: fixed;
  top: var(--spacing-lg);
  left: var(--spacing-lg);
  z-index: var(--z-fixed);
  background: var(--primary-color);
  color: var(--text-white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
  transition: all var(--transition-normal);
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.sidenav-trigger:hover {
  background: var(--secondary-color);
  transform: scale(1.1);
  box-shadow: var(--shadow-heavy);
}

/* ==================== FLASH MESSAGES ==================== */
.flash-messages {
  margin-bottom: var(--spacing-lg);
}

.flash-message {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  animation: slideInFromTop 0.4s ease-out;
  position: relative;
  border-left: 4px solid transparent;
}

.flash-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.flash-message.success {
  background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
  color: #155724;
  border-color: var(--success-color);
}

.flash-message.success::before {
  background: var(--success-color);
}

.flash-message.error {
  background: linear-gradient(135deg, #ffebee 0%, #f8d7da 100%);
  color: #721c24;
  border-color: var(--error-color);
}

.flash-message.error::before {
  background: var(--error-color);
}

.flash-message i {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.flash-close {
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  margin-left: auto;
  padding: var(--spacing-xs);
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-fast);
}

.flash-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== BOTONES ==================== */
.btn,
button {
  background-color: var(--secondary-color);
  color: var(--text-white);
  border: none;
  padding: 12px 24px;
  cursor: pointer;
  border-radius: var(--border-radius);
  text-decoration: none;
  transition: all var(--transition-fast);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  font-family: inherit;
  font-size: 0.875rem;
}

.btn:hover,
button:hover {
  background-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  text-decoration: none;
  color: var(--text-white);
}

.btn:active,
button:active {
  transform: translateY(0);
}

.btn-large {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
}

.btn-small {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.75rem;
}

.btn-floating {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 0;
}

.btn-floating:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-heavy);
}

/* Variantes de botones */
.btn-primary {
  background-color: var(--primary-color);
}

.btn-secondary {
  background-color: var(--secondary-color);
}

.btn-success {
  background-color: var(--success-color);
}

.btn-error {
  background-color: var(--error-color);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: var(--text-white);
}

/* ==================== TARJETAS ==================== */
.card {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  overflow: hidden;
  transition: all var(--transition-normal);
  margin-bottom: var(--spacing-lg);
}

.card.hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
}

.card-content {
  padding: var(--spacing-lg);
}

.card-title {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--spacing-md);
}

.card-title i {
  margin-right: var(--spacing-md);
  font-size: 1.5rem;
}

.card-action {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

/* ==================== TABLAS ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--spacing-lg);
  background: var(--surface-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}

th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-white);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

tr:hover {
  background-color: #f8f9fa;
  transition: background-color var(--transition-fast);
}

tr:nth-child(even) {
  background-color: #fafafa;
}

tr:nth-child(even):hover {
  background-color: #f0f0f0;
}

/* ==================== FORMULARIOS ==================== */
.input-field {
  margin-bottom: var(--spacing-lg);
}

.input-field input:focus + label,
.input-field textarea:focus + label {
  color: var(--primary-color) !important;
}

.input-field input:focus,
.input-field textarea:focus {
  border-bottom: 1px solid var(--primary-color) !important;
  box-shadow: 0 1px 0 0 var(--primary-color) !important;
}

.input-field .prefix.active {
  color: var(--primary-color);
}

/* ==================== ESTADOS DE VALIDACIÓN ==================== */
.valid {
  border-bottom-color: var(--success-color) !important;
  box-shadow: 0 1px 0 0 var(--success-color) !important;
}

.invalid {
  border-bottom-color: var(--error-color) !important;
  box-shadow: 0 1px 0 0 var(--error-color) !important;
}

.helper-text {
  font-size: 0.8rem;
  margin-top: var(--spacing-xs);
}

.helper-text.valid-text {
  color: var(--success-color);
}

.helper-text.invalid-text {
  color: var(--error-color);
}

/* ==================== BADGES Y CHIPS ==================== */
.chip {
  border-radius: 16px;
  font-weight: 500;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.875rem;
}

.chip:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-light);
}

/* Estados específicos para chips */
.status-badge {
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-subiendo_incremento {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-en_cola {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #74b9ff;
}

.status-supervision_correccion {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #fd79a8;
}

.status-aprobado {
  background: #d4edda;
  color: #155724;
  border: 1px solid #00b894;
}

/* ==================== MODALES ==================== */
.modal {
  border-radius: var(--border-radius);
  max-height: 85vh;
  box-shadow: var(--shadow-heavy);
}

.modal-content h5 {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  border-bottom: 2px solid #eee;
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  font-weight: 500;
}

.modal-content h5 i {
  margin-right: var(--spacing-md);
  font-size: 1.5rem;
}

.modal-footer {
  background: #f8f9fa;
  border-top: 1px solid #eee;
}

/* ==================== LOADING STATES ==================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(4px);
}

.loading-spinner {
  background: var(--surface-color);
  padding: var(--spacing-xxl);
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: var(--shadow-heavy);
  max-width: 300px;
}

.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--text-white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Forzar visibilidad del overlay por aria-hidden */
.loading-overlay[aria-hidden="true"]  { display: none !important; }
.loading-overlay[aria-hidden="false"] { display: flex !important; }

/* ==================== FOOTER ==================== */
.page-footer {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  margin-top: auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 999; /* Z-index alto para estar por encima del sidebar */
  position: relative;
}

.footer-content {
  padding: var(--spacing-lg) 0;
}

.footer-title {
  font-weight: 300;
  margin-bottom: var(--spacing-md);
}

.footer-subtitle {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.footer-links-title {
  margin-bottom: var(--spacing-md);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: var(--spacing-sm);
}

.footer-link {
  color: rgba(255, 255, 255, 0.8) !important;
  transition: color var(--transition-fast);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--secondary-color) !important;
}

.footer-copyright {
  background: rgba(0, 0, 0, 0.2);
  padding: var(--spacing-md) 0;
}

.footer-copyright-row {
  margin-bottom: 0;
}

.copyright-text,
.version-text {
  font-size: 0.875rem;
}

/* ==================== UTILIDADES ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

.bold { font-weight: bold; }
.semi-bold { font-weight: 500; }
.normal { font-weight: normal; }

/* ==================== ANIMACIONES ==================== */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

.bounce {
  animation: bounce 1s;
}

.shake {
  animation: shake 0.6s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes bounce {
  0%, 20%, 60%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  80% {
    transform: translateY(-5px);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* ==================== DATATABLES MEJORADO ==================== */
.dataTables_wrapper {
  margin-top: var(--spacing-lg);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin: var(--spacing-md) 0;
}

.dataTables_wrapper .dataTables_filter input {
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  padding: 10px 15px;
  margin-left: 10px;
  transition: all var(--transition-normal);
  font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 82, 155, 0.1);
}

.dataTables_wrapper .dataTables_length select {
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  padding: 8px 12px;
  margin: 0 10px;
  transition: border-color var(--transition-normal);
}

.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--primary-color);
  outline: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  padding: 10px 16px;
  margin: 0 3px;
  background: var(--surface-color);
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  transition: all var(--transition-normal);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
  font-weight: 600;
  box-shadow: var(--shadow-light);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: var(--surface-color);
  color: var(--text-light);
  border-color: #e0e0e0;
  transform: none;
  box-shadow: none;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media screen and (max-width: 1200px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

@media screen and (max-width: 992px) {
  main {
    margin-left: 0;
    padding: var(--spacing-md);
  }
  
  .sidenav-trigger {
    display: flex;
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: center;
    margin-bottom: var(--spacing-md);
  }
  
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: center;
    margin-top: var(--spacing-md);
  }
}

@media screen and (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  main {
    padding: var(--spacing-md);
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .btn-large {
    width: 100%;
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-md) var(--spacing-lg);
  }
  
  .flash-message {
    padding: var(--spacing-md);
    font-size: 0.9rem;
  }
  
  .card-content {
    padding: var(--spacing-md);
  }
  
  th,
  td {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .modal {
    margin: var(--spacing-sm);
    max-height: 90vh;
  }
}

@media screen and (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .flash-message {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .card-action {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .footer-copyright .row {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-copyright .right-align {
    text-align: center;
    margin-top: var(--spacing-sm);
  }
}

/* ==================== ESTADOS DE VALIDACIÓN ESPECÍFICOS ==================== */
.vencido {
  background-color: #ffebee;
  color: #c62828;
  border-left: 4px solid #c62828;
}

.proximo-vencer {
  background-color: #fff3e0;
  color: #f57c00;
  border-left: 4px solid #f57c00;
}

.en-correcto {
  background-color: #e8f5e8;
  color: #2e7d32;
  border-left: 4px solid #2e7d32;
}

.faltan-datos {
  background-color: #fafafa;
  color: #d32f2f;
  border-left: 4px solid #d32f2f;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  border-radius: var(--border-radius);
  font-weight: 500;
  box-shadow: var(--shadow-medium);
  padding: var(--spacing-md) var(--spacing-lg);
}

.toast.success {
  background-color: var(--success-color) !important;
  color: var(--text-white) !important;
}

.toast.error {
  background-color: var(--error-color) !important;
  color: var(--text-white) !important;
}

.toast.warning {
  background-color: var(--warning-color) !important;
  color: var(--text-white) !important;
}

.toast.info {
  background-color: var(--info-color) !important;
  color: var(--text-white) !important;
}

/* ==================== MEJORAS PARA ACCESIBILIDAD ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  /* Implementar tema oscuro en versiones futuras */
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .sidenav,
  .sidenav-trigger,
  .btn-floating,
  .modal-overlay,
  .loading-overlay,
  .flash-messages {
    display: none !important;
  }
  
  main {
    margin-left: 0 !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ==================== OPTIMIZACIONES DE RENDIMIENTO ==================== */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* Lazy loading para elementos no críticos */
.lazy-load {
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.lazy-load.loaded {
  opacity: 1;
}

/* ==================== ESTADOS FINALES ==================== */
.success-state,
.error-state,
.empty-state {
  padding: var(--spacing-xxl) var(--spacing-lg);
  text-align: center;
  border-radius: var(--border-radius);
}

.success-state {
  background: #e8f5e8;
  color: #2e7d32;
}

.error-state {
  background: #ffebee;
  color: #c62828;
}

.empty-state {
  color: var(--text-light);
}

.success-state i,
.error-state i,
.empty-state i {
  font-size: 4rem !important;
  margin-bottom: var(--spacing-lg);
  display: block;
  opacity: 0.7;
}

.success-state h5,
.error-state h5,
.empty-state h5 {
  font-weight: 300;
  margin-bottom: var(--spacing-md);
}

.success-state p,
.error-state p,
.empty-state p {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ==================== FOOTER DESPUÉS DEL SIDEBAR ==================== */
.page-footer {
  margin-left: 260px !important; /* Footer inicia después del sidebar */
  transition: margin-left 0.3s ease !important;
}

/* En móvil, footer ocupa todo el ancho */
@media screen and (max-width: 992px) {
  .page-footer {
    margin-left: 0 !important;
  }
}
/* ==================== OPTIMIZACIÓN MÓVIL ==================== */
@media screen and (max-width: 992px) {
  main {
    padding: 8px !important; /* Menos padding */
    margin-left: 0 !important;
  }
  
  .container {
    padding: 0 4px !important; /* Padding mínimo */
    max-width: 100% !important;
  }
}

@media screen and (max-width: 768px) {
  main {
    padding: 4px !important; /* Padding súper mínimo */
  }
  
  .container {
    padding: 0 2px !important;
  }
  
  .card {
    margin: 4px -2px !important; /* Cards de borde a borde */
    border-radius: 0 !important;
  }
  
  .card-content {
    padding: 8px !important;
  }
  
  /* Mapas más compactos */
  .leaflet-container {
    height: 250px !important;
    margin: 0 -2px !important;
  }
  
  /* Tablas más compactas */
  th, td {
    padding: 4px 2px !important;
    font-size: 0.8rem !important;
  }
  
  /* Botones más pequeños */
  .btn {
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
  }
  
  /* Títulos más pequeños */
  h1 { font-size: 1.4rem !important; }
  h2 { font-size: 1.2rem !important; }
  h3 { font-size: 1.1rem !important; }
}
/* Ajustes adicionales móviles */
@media screen and (max-width: 768px) {
  main {
    margin-left: 0 !important;
    padding: 8px !important;
    width: 100% !important;
  }

/* ✅ Deja que Materialize controle el open/close con su estilo inline */
@media screen and (max-width: 768px) {
  .sidenav.sidenav-fixed {
    position: fixed !important;
    z-index: 2000 !important;
    left: 0;
    top: 0;
    height: 100%;
    transform: translateX(-105%); /* sin !important */
    will-change: transform;
  }

  /* Asegura que la capa oscura quede debajo del menú */
  .sidenav-overlay {
    z-index: 1999;
  }
}


  .container {
    max-width: 100% !important;
    padding: 0 8px !important;
  }

  img, video, iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  .card {
    margin: 8px 0 !important;
    border-radius: 6px !important;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
