/* =================================================================== */
/* 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 principales inspirados en el portal institucional (azules y naranjas) */
  --primary-color: #0b3c89;
  --primary-light: #1d5bbf;
  --primary-dark: #06245c;
  --secondary-color: #f97316;
  --secondary-light: #fb923c;
  --secondary-dark: #ea580c;
  --accent-color: #d8213b;
  --sidebar-width: 280px;
  
  /* Colores de estado */
  --success-color: #10b981;
  --success-light: #34d399;
  --error-color: #ef4444;
  --error-light: #f87171;
  --warning-color: #f59e0b;
  --warning-light: #fbbf24;
  --info-color: #3b82f6;
  --info-light: #60a5fa;
  
  /* Colores de fondo y texto */
  --background-color: #edf2fa;
  --background-secondary: #dbe5f4;
  --surface-color: #ffffff;
  --surface-elevated: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --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: 12px;
  --border-radius-sm: 6px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  
  /* Sombras modernas */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-heavy: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transiciones */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 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: var(--sidebar-width);
  min-height: calc(100vh - 200px);
  transition: margin-left var(--transition-normal);
  width: calc(100% - var(--sidebar-width));
}

.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: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
  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: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  font-family: inherit;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.btn::before,
button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before,
button:hover::before {
  left: 100%;
}

.btn:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  text-decoration: none;
  color: var(--text-white);
}

.btn:active,
button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-large {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
}

.btn-small {
  padding: 10px 20px;
  font-size: 0.85rem;
}

.btn-floating {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 0;
  box-shadow: var(--shadow-medium);
}

.btn-floating:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-heavy);
}

/* Variantes de botones */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--secondary-light) 0%, var(--secondary-color) 100%);
}

/* Ajustes de contraste para headers tipo dashboard */
.dashboard-header h1,
.dashboard-header h2,
.dashboard-header h3 {
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 8px 20px rgba(4, 24, 54, 0.35);
  letter-spacing: 0.04em;
}

.dashboard-header .material-icons {
  color: #ffffff;
  filter: drop-shadow(0 6px 12px rgba(4, 24, 54, 0.35));
}

.dashboard-header p {
  color: rgba(255, 255, 255, 0.9);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-light) 100%);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--success-light) 0%, var(--success-color) 100%);
}

.btn-error {
  background: linear-gradient(135deg, var(--error-color) 0%, var(--error-light) 100%);
}

.btn-error:hover {
  background: linear-gradient(135deg, var(--error-light) 0%, var(--error-color) 100%);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--primary-color);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

/* ==================== 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);
  border: 1px solid rgba(148, 163, 184, 0.12);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.card:hover::before {
  opacity: 1;
}

.card.hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(249, 115, 22, 0.25);
}

.card-content {
  padding: var(--spacing-xl);
}

.card-title {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.01em;
}

.card-title i {
  margin-right: var(--spacing-md);
  font-size: 1.6rem;
  color: var(--secondary-color);
}

.card-action {
  padding: var(--spacing-md) var(--spacing-xl);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  background: rgba(241, 245, 249, 0.5);
}

/* ==================== 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);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

th,
td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: middle;
}

th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: var(--text-white);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--secondary-color);
}

tr {
  transition: all var(--transition-fast);
}

tr:hover {
  background: linear-gradient(90deg, rgba(11, 60, 137, 0.08) 0%, rgba(11, 60, 137, 0.04) 100%);
  transform: translateX(2px);
}

tr:nth-child(even) {
  background-color: rgba(241, 245, 249, 0.5);
}

tr:nth-child(even):hover {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, rgba(11, 60, 137, 0.05) 100%);
}

/* ==================== FORMULARIOS ==================== */
.input-field {
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.input-field input:focus + label,
.input-field textarea:focus + label {
  color: var(--secondary-color) !important;
}

.input-field input:focus,
.input-field textarea:focus {
  border-bottom: 2px solid var(--secondary-color) !important;
  box-shadow: 0 1px 0 0 var(--secondary-color) !important;
}

.input-field .prefix.active {
  color: var(--secondary-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: 90vh;
  box-shadow: var(--shadow-heavy);
  overflow-y: auto;
}

.modal.modal-fixed-footer {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.modal-fixed-footer .modal-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.modal-fixed-footer .modal-footer {
  flex: 0 0 auto;
}

.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;
}

/* ==================== FOOTER ==================== */
.page-footer {
  background: linear-gradient(135deg, #1a365d 0%, #2d4a7c 100%);
  margin-top: auto;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 999; /* Z-index alto para estar por encima del sidebar */
  position: relative;
}

.footer-content {
  padding: 40px 0 20px;
}

.footer-title {
  font-weight: 700;
  margin-bottom: 16px;
  font-size: 1.6rem;
  color: var(--primary-dark);
}

.footer-description {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.footer-subtitle {
  font-size: 0.9rem;
  margin-bottom: 0;
  font-weight: 600;
  color: rgba(249, 115, 22, 0.85);
}

.footer-links-title {
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.footer-links-wrapper {
  background: linear-gradient(135deg, #ffffff 0%, #f5f7fb 100%);
  border-radius: var(--border-radius);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadow-light);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-link {
  color: rgba(15, 23, 42, 0.75) !important;
  transition: all 0.3s ease;
  text-decoration: none;
}

.footer-link:hover {
  color: #f97316 !important;
  padding-left: 8px;
}

.footer-copyright {
  background: rgba(15, 23, 42, 0.06);
  padding: 16px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

.footer-copyright-row {
  margin-bottom: 0;
}

.copyright-text,
.version-text {
  font-size: 0.9rem;
}

.copyright-text {
  color: rgba(15, 23, 42, 0.7);
}

.version-text {
  color: #f97316;
  font-weight: 600;
}

/* ==================== 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,
  .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: var(--sidebar-width) !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;
  }
}

/* ==================== FIX PARA SELECT DROPDOWNS EN TABLAS ==================== */
/* Corrige problemas de visualización de selects de Materialize dentro de tablas */

.table-container .input-field {
  margin-top: 0;
  margin-bottom: 0;
  min-height: 50px;
}

.table-container .input-field input,
.table-container .input-field select {
  margin-bottom: 0;
  height: 2.5rem;
  font-size: 14px;
}

.table-container .input-field label {
  position: absolute;
  top: -14px;
  font-size: 0.8rem;
  left: 0;
  color: #9e9e9e;
}

.table-container .input-field label.active {
  transform: translateY(0);
  color: #26a69a;
}

/* Fix para dropdowns de select */
.table-container select {
  display: block !important;
  opacity: 1 !important;
  position: relative !important;
}

.table-container .select-wrapper {
  position: relative;
  display: block;
}

.table-container .select-wrapper input.select-dropdown {
  margin-bottom: 0;
  padding: 0 30px 0 0;
  font-size: 14px;
  cursor: pointer;
  background-color: transparent;
  border-bottom: 1px solid #9e9e9e;
}

.table-container .select-wrapper .caret {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  color: #9e9e9e;
}

.table-container td {
  padding: 10px 5px;
  vertical-align: top;
}

.table-container {
  overflow-x: auto;
}

/* Fix general para todos los selects en cualquier tabla */
table .input-field {
  margin-top: 0;
  margin-bottom: 0;
  min-height: 50px;
}

table .input-field input,
table .input-field select {
  margin-bottom: 0;
  font-size: 14px;
}

table .select-wrapper input.select-dropdown {
  margin-bottom: 0;
  height: 2.5rem;
  padding: 0 30px 0 0;
  cursor: pointer;
}

table select {
  display: block !important;
}

table .select-wrapper {
  display: block;
  position: relative;
}

table td .input-field input {
  font-size: 14px;
  margin: 0;
}

table td .input-field label {
  font-size: 0.8rem;
  top: -14px;
}




