/* ===========================================
   DINING HALL THEME SYSTEM
   Basado en la guía de marca oficial
   =========================================== */

:root {
  /* === TEMA CLARO (Marca sobre fondo claro) === */
  --theme-light-primary: #2c3e50;        /* Gris oscuro/carbón */
  --theme-light-secondary: #f5f5dc;      /* Crema/beige claro */
  --theme-light-accent: #34495e;         /* Gris medio */
  --theme-light-text: #2c3e50;           /* Texto principal - oscuro sobre claro */
  --theme-light-text-secondary: #7f8c8d; /* Texto secundario */
  --theme-light-background: #f5f5dc;    /* Fondo principal */
  --theme-light-surface: #ffffff;        /* Superficies */
  --theme-light-border: #bdc3c7;        /* Bordes */
  --theme-light-text-on-dark: #ffffff;   /* Texto claro sobre fondos oscuros */
  --theme-light-text-on-light: #2c3e50;  /* Texto oscuro sobre fondos claros */
  --theme-light-success: #27ae60;        /* Verde éxito */
  --theme-light-warning: #f39c12;        /* Amarillo advertencia */
  --theme-light-danger: #e74c3c;         /* Rojo peligro */
  --theme-light-info: #3498db;           /* Azul información */
  
  /* === TEMA OSCURO (Marca sobre fondo oscuro) === */
  --theme-dark-primary: #f5f5dc;        /* Crema/beige claro */
  --theme-dark-secondary: #556b2f;      /* Verde oliva oscuro */
  --theme-dark-accent: #8fbc8f;         /* Verde oliva claro */
  --theme-dark-text: #f5f5dc;           /* Texto principal - claro sobre oscuro */
  --theme-dark-text-secondary: #d3d3d3; /* Texto secundario */
  --theme-dark-background: #556b2f;     /* Fondo principal */
  --theme-dark-surface: #6b7c32;        /* Superficies */
  --theme-dark-border: #8fbc8f;          /* Bordes */
  --theme-dark-text-on-dark: #f5f5dc;   /* Texto claro sobre fondos oscuros */
  --theme-dark-text-on-light: #2c3e50;  /* Texto oscuro sobre fondos claros */
  --theme-dark-success: #2ecc71;        /* Verde éxito */
  --theme-dark-warning: #f1c40f;        /* Amarillo advertencia */
  --theme-dark-danger: #e67e22;         /* Naranja peligro */
  --theme-dark-info: #5dade2;           /* Azul información */
  
  /* === TEMA NEGATIVO (Marca en negativo) === */
  --theme-negative-primary: #ffffff;    /* Blanco */
  --theme-negative-secondary: #000000;  /* Negro */
  --theme-negative-accent: #f0f0f0;     /* Gris muy claro */
  --theme-negative-text: #ffffff;       /* Texto principal - blanco sobre negro */
  --theme-negative-text-secondary: #cccccc; /* Texto secundario */
  --theme-negative-background: #000000;  /* Fondo principal */
  --theme-negative-surface: #1a1a1a;    /* Superficies */
  --theme-negative-border: #333333;      /* Bordes */
  --theme-negative-text-on-dark: #ffffff; /* Texto blanco sobre fondos oscuros */
  --theme-negative-text-on-light: #000000; /* Texto negro sobre fondos claros */
  --theme-negative-success: #00ff00;    /* Verde brillante */
  --theme-negative-warning: #ffff00;    /* Amarillo brillante */
  --theme-negative-danger: #ff0000;     /* Rojo brillante */
  --theme-negative-info: #00ffff;       /* Cian brillante */
  
  /* === TEMA POSITIVO (Marca en positivo) === */
  --theme-positive-primary: #000000;    /* Negro */
  --theme-positive-secondary: #ffffff;  /* Blanco */
  --theme-positive-accent: #f5f5f5;    /* Gris muy claro */
  --theme-positive-text: #000000;       /* Texto principal */
  --theme-positive-text-secondary: #666666; /* Texto secundario */
  --theme-positive-background: #ffffff; /* Fondo principal */
  --theme-positive-surface: #f8f9fa;    /* Superficies */
  --theme-positive-border: #dee2e6;     /* Bordes */
  --theme-positive-success: #28a745;    /* Verde éxito */
  --theme-positive-warning: #ffc107;    /* Amarillo advertencia */
  --theme-positive-danger: #dc3545;     /* Rojo peligro */
  --theme-positive-info: #17a2b8;       /* Azul información */
  --theme-positive-text-on-dark: #ffffff; /* Texto blanco sobre fondos oscuros */
  --theme-positive-text-on-light: #000000; /* Texto negro sobre fondos claros */
  
  /* === VARIABLES ACTIVAS (por defecto tema claro) === */
  --primary-color: var(--theme-light-primary);
  --secondary-color: var(--theme-light-secondary);
  --accent-color: var(--theme-light-accent);
  --text-color: var(--theme-light-text);
  --text-secondary-color: var(--theme-light-text-secondary);
  --background-color: var(--theme-light-background);
  --surface-color: var(--theme-light-surface);
  --border-color: var(--theme-light-border);
}

/* === APLICACIÓN DE TEMAS === */
.theme-light {
  --primary-color: var(--theme-light-primary);
  --secondary-color: var(--theme-light-secondary);
  --accent-color: var(--theme-light-accent);
  --text-color: var(--theme-light-text);
  --text-secondary-color: var(--theme-light-text-secondary);
  --background-color: var(--theme-light-background);
  --surface-color: var(--theme-light-surface);
  --border-color: var(--theme-light-border);
}

.theme-dark {
  --primary-color: var(--theme-dark-primary);
  --secondary-color: var(--theme-dark-secondary);
  --accent-color: var(--theme-dark-accent);
  --text-color: var(--theme-dark-text);
  --text-secondary-color: var(--theme-dark-text-secondary);
  --background-color: var(--theme-dark-background);
  --surface-color: var(--theme-dark-surface);
  --border-color: var(--theme-dark-border);
}

.theme-negative {
  --primary-color: var(--theme-negative-primary);
  --secondary-color: var(--theme-negative-secondary);
  --accent-color: var(--theme-negative-accent);
  --text-color: var(--theme-negative-text);
  --text-secondary-color: var(--theme-negative-text-secondary);
  --background-color: var(--theme-negative-background);
  --surface-color: var(--theme-negative-surface);
  --border-color: var(--theme-negative-border);
}

.theme-positive {
  --primary-color: var(--theme-positive-primary);
  --secondary-color: var(--theme-positive-secondary);
  --accent-color: var(--theme-positive-accent);
  --text-color: var(--theme-positive-text);
  --text-secondary-color: var(--theme-positive-text-secondary);
  --background-color: var(--theme-positive-background);
  --surface-color: var(--theme-positive-surface);
  --border-color: var(--theme-positive-border);
}

/* === ESTILOS BASE === */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === COMPONENTES COMUNES === */
.card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--secondary-color);
}

.btn-primary:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--primary-color);
}

.form-control {
  background-color: var(--surface-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

.form-control:focus {
  background-color: var(--surface-color);
  border-color: var(--primary-color);
  color: var(--text-color);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-color), 0.25);
}

/* === SELECTOR DE TEMAS === */
.theme-selector {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 9999;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 120px;
  max-width: 150px;
}

.theme-selector select {
  background: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  width: 100%;
  cursor: pointer;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}

.theme-preview {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.theme-preview.light {
  background: linear-gradient(45deg, #2c3e50 50%, #f5f5dc 50%);
}

.theme-preview.dark {
  background: linear-gradient(45deg, #f5f5dc 50%, #556b2f 50%);
}

.theme-preview.negative {
  background: linear-gradient(45deg, #ffffff 50%, #000000 50%);
}

.theme-preview.positive {
  background: linear-gradient(45deg, #000000 50%, #ffffff 50%);
}

/* === RESPONSIVE === */
/* === BOTONES MEJORADOS === */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--secondary-color);
  font-weight: 500;
}

.btn-primary:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--secondary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--primary-color);
  font-weight: 500;
}

.btn-secondary:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-success {
  background-color: #27ae60;
  border-color: #27ae60;
  color: white;
  font-weight: 500;
}

.btn-success:hover {
  background-color: #229954;
  border-color: #229954;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-warning {
  background-color: #f39c12;
  border-color: #f39c12;
  color: white;
  font-weight: 500;
}

.btn-warning:hover {
  background-color: #e67e22;
  border-color: #e67e22;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
  background-color: #e74c3c;
  border-color: #e74c3c;
  color: white;
  font-weight: 500;
}

.btn-danger:hover {
  background-color: #c0392b;
  border-color: #c0392b;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-info {
  background-color: #3498db;
  border-color: #3498db;
  color: white;
  font-weight: 500;
}

.btn-info:hover {
  background-color: #2980b9;
  border-color: #2980b9;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* === TABLAS === */
.table {
  color: var(--text-color);
  background-color: var(--surface-color);
}

.table th {
  background-color: var(--accent-color);
  color: var(--text-color);
  border-color: var(--border-color);
}

.table td {
  border-color: var(--border-color);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--background-color);
}

/* === NAVEGACIÓN === */
.navbar {
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
}

.nav-link {
  color: var(--text-color);
}

.nav-link:hover {
  color: var(--primary-color);
}

/* === MODALES === */
.modal-content {
  background-color: var(--surface-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

.modal-header {
  border-bottom-color: var(--border-color);
}

.modal-footer {
  border-top-color: var(--border-color);
}

/* === VARIABLES DE CONTRASTE ADICIONALES === */
:root {
  --text-on-dark: #ffffff;
  --text-on-light: #2c3e50;
}

.theme-light {
  --text-on-dark: #ffffff;
  --text-on-light: #2c3e50;
}

.theme-dark {
  --text-on-dark: #f5f5dc;
  --text-on-light: #2c3e50;
}

.theme-negative {
  --text-on-dark: #ffffff;
  --text-on-light: #000000;
}

.theme-positive {
  --text-on-dark: #ffffff;
  --text-on-light: #000000;
}

/* === CORRECCIONES DE CONTRASTE === */
/* Headers y títulos siempre con buen contraste */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-color) !important;
  font-weight: 700;
}

/* Títulos de página específicos */
.page-title {
  color: var(--text-color) !important;
  font-weight: 700;
  font-size: 1.5rem;
}

/* Texto de secciones */
.section-title {
  color: var(--text-color) !important;
  font-weight: 600;
}

/* Texto en botones siempre contrastante */
.btn-primary, .btn-success, .btn-info, .btn-danger {
  color: var(--text-on-dark) !important;
}

.btn-secondary, .btn-warning {
  color: var(--text-on-light) !important;
}

/* Texto en cards y modales */
.card-body, .modal-body {
  color: var(--text-color);
}

/* Enlaces siempre visibles */
a {
  color: var(--primary-color);
}

a:hover {
  color: var(--accent-color);
}

/* Texto en formularios */
label, .form-label {
  color: var(--text-color);
}

/* Texto en navegación */
.navbar-brand, .nav-link {
  color: var(--text-color);
}

/* Texto en tablas */
.table th, .table td {
  color: var(--text-color);
}

/* Estados vacíos de tablas */
.table-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary-color);
  font-style: italic;
}

.table-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Mejorar visibilidad de placeholders */
.form-control::placeholder {
  color: var(--text-secondary-color);
  opacity: 0.8;
}

/* Headers de página más visibles */
.page-header {
  background: var(--surface-color);
  border-bottom: 2px solid var(--border-color);
  padding: 20px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  color: var(--text-color) !important;
}

/* Texto en alerts */
.alert {
  color: var(--text-color);
}

.alert-success {
  background-color: var(--success-color);
  color: white;
}

.alert-warning {
  background-color: var(--warning-color);
  color: var(--text-on-light);
}

.alert-danger {
  background-color: var(--danger-color);
  color: white;
}

.alert-info {
  background-color: var(--info-color);
  color: white;
}

@media (max-width: 768px) {
  .theme-selector {
    position: relative;
    top: auto;
    right: auto;
    margin: 10px;
    width: calc(100% - 20px);
  }
}
