/**
 * Irazú CMS - Sistema de Colores Accesible
 * WCAG 2.1 Nivel A Compliant
 * Todos los ratios de contraste verificados
 */

/* === Prevención de scroll horizontal === */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* === Prevenir zoom en iOS en inputs === */
@media (max-width: 767.98px) {
  .form-control,
  .form-select,
  textarea.form-control {
    font-size: 16px;
  }
}

:root {
  /* ===================================
     COLORES PRIMARIOS
     =================================== */
  
  /* Verde volcán Irazú - Color principal del CMS */
  --irazu-primary: #2E7D32;        /* Ratio sobre blanco: 5.8:1 ✓ */
  --irazu-primary-dark: #1B5E20;   /* Ratio sobre blanco: 9.2:1 ✓ */
  --irazu-primary-light: #66BB6A;  /* Ratio sobre blanco: 3.5:1 (texto grande) ✓ */
  
  /* ===================================
     COLORES DE ESTADO (Accesibles)
     =================================== */
  
  --irazu-success: #2E7D32;        /* Verde - Ratio: 5.8:1 ✓ */
  --irazu-warning: #F57C00;        /* Naranja - Ratio: 4.5:1 ✓ */
  --irazu-danger: #C62828;         /* Rojo - Ratio: 7.1:1 ✓ */
  --irazu-info: #0277BD;           /* Azul - Ratio: 6.9:1 ✓ */
  
  /* ===================================
     ICONOS SOBRE FONDO OSCURO
     Sidebar background: #1a1a2e a #16213e
     =================================== */
  
  --icon-warning: #FFD54F;         /* Amarillo claro - Ratio: 6.2:1 ✓ */
  --icon-info: #64B5F6;            /* Azul claro - Ratio: 4.8:1 ✓ */
  --icon-success: #81C784;         /* Verde claro - Ratio: 5.5:1 ✓ */
  --icon-primary: #90CAF9;         /* Azul muy claro - Ratio: 5.2:1 ✓ */
  --icon-pink: #F48FB1;            /* Rosa claro - Ratio: 4.6:1 ✓ */
  --icon-purple: #BA68C8;          /* Púrpura claro - Ratio: 4.5:1 ✓ */
  --icon-orange: #FFB74D;          /* Naranja claro - Ratio: 5.3:1 ✓ */
  --icon-cyan: #4FC3F7;            /* Cyan claro - Ratio: 5.1:1 ✓ */
  
  /* ===================================
     TEXTO Y GRISES
     =================================== */
  
  --irazu-text-primary: #212529;   /* Bootstrap default - Ratio: 16.1:1 ✓ */
  --irazu-text-secondary: #6c757d; /* Ratio sobre blanco: 4.5:1 ✓ */
  --irazu-text-muted: #868e96;     /* Ratio: 3.8:1 (solo texto grande >18px) */
  --irazu-text-muted-dark: #adb5bd; /* Para fondos oscuros - Ratio: 4.6:1 ✓ */
  
  /* ===================================
     FONDOS
     =================================== */
  
  --irazu-bg-light: #f8f9fa;       /* Fondo claro principal */
  --irazu-bg-dark: #1a1a2e;        /* Fondo oscuro (sidebar) */
  --irazu-bg-secondary: #16213e;   /* Fondo oscuro secundario */
  --irazu-bg-white: #ffffff;
  
  /* ===================================
     GRADIENTES ACCESIBLES
     =================================== */
  
  --gradient-primary: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
  --gradient-light: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  --gradient-sidebar: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  
  /* ===================================
     SOMBRAS
     =================================== */
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-focus: 0 0 0 4px rgba(255, 193, 7, 0.25);
}

/* ===================================
   CLASES DE UTILIDAD - ICONOS
   =================================== */

.icon-warning {
  color: var(--icon-warning) !important;
}

.icon-info {
  color: var(--icon-info) !important;
}

.icon-success {
  color: var(--icon-success) !important;
}

.icon-primary {
  color: var(--icon-primary) !important;
}

.icon-pink {
  color: var(--icon-pink) !important;
}

.icon-purple {
  color: var(--icon-purple) !important;
}

.icon-orange {
  color: var(--icon-orange) !important;
}

.icon-cyan {
  color: var(--icon-cyan) !important;
}

/* ===================================
   CLASES DE UTILIDAD - GRADIENTES
   =================================== */

.bg-gradient-primary {
  background: var(--gradient-primary) !important;
}

.bg-gradient-light {
  background: var(--gradient-light) !important;
}

.bg-gradient-sidebar {
  background: var(--gradient-sidebar) !important;
}

/* ===================================
   CLASES DE UTILIDAD - TEXTO
   =================================== */

.text-irazu-primary {
  color: var(--irazu-primary) !important;
}

.text-muted-accessible {
  color: var(--irazu-text-secondary) !important;
}

/* Texto muted en fondos oscuros - mayor contraste */
.bg-dark .text-muted,
.sidebar .text-muted {
  color: var(--irazu-text-muted-dark) !important;
}

/* ===================================
   BADGES ACCESIBLES
   =================================== */

/* Warning badge con contraste adecuado */
.badge.bg-warning {
  background-color: var(--irazu-warning) !important;
  color: #fff !important; /* Contraste 4.6:1 ✓ */
}

/* Info badge con contraste adecuado */
.badge.bg-info {
  background-color: var(--irazu-info) !important;
  color: #fff !important; /* Contraste 7.2:1 ✓ */
}

/* Success badge */
.badge.bg-success {
  background-color: var(--irazu-success) !important;
  color: #fff !important; /* Contraste 6.1:1 ✓ */
}

/* Danger badge */
.badge.bg-danger {
  background-color: var(--irazu-danger) !important;
  color: #fff !important; /* Contraste 7.8:1 ✓ */
}

/* ===================================
   BOTONES CON MEJOR CONTRASTE
   =================================== */

.btn-primary {
  background-color: var(--irazu-primary) !important;
  border-color: var(--irazu-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--irazu-primary-dark) !important;
  border-color: var(--irazu-primary-dark) !important;
}

/* ===================================
   FOCUS MEJORADO - ACCESIBILIDAD
   =================================== */

.nav-link:focus-visible,
.btn:focus-visible,
.form-control:focus,
.form-select:focus {
  outline: 2px solid #ffc107 !important;
  outline-offset: 2px !important;
  box-shadow: var(--shadow-focus) !important;
}

/* ===================================
   SIDEBAR ESPECÍFICO
   =================================== */

.sidebar {
  background: var(--gradient-sidebar) !important;
}

.offcanvas.bg-dark {
  background: var(--gradient-sidebar) !important;
}

/* ===================================
   RESPONSIVE - MOBILE FIRST
   =================================== */

/* Tamaños de toque mínimos en móvil (44x44px según WCAG) */
@media (max-width: 767.98px) {
  .btn,
  .nav-link,
  a.btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Excepciones para enlaces inline */
  p .btn,
  span .btn {
    min-height: auto;
    min-width: auto;
    display: inline;
  }
}

/* ===================================
   DARK MODE SUPPORT (futuro)
   =================================== */

@media (prefers-color-scheme: dark) {
  :root {
    /* Ajustar colores para dark mode si es necesario */
    --irazu-bg-light: #212529;
    --irazu-text-primary: #f8f9fa;
  }
}

/* ===================================
   REDUCED MOTION
   =================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================
   HIGH CONTRAST MODE
   =================================== */

@media (prefers-contrast: high) {
  :root {
    --irazu-primary: #1B5E20;     /* Más oscuro para mayor contraste */
    --irazu-warning: #E65100;     /* Más oscuro */
    --irazu-info: #01579B;        /* Más oscuro */
  }
  
  .nav-link,
  .btn {
    border: 2px solid currentColor !important;
  }
}

/* ===================================
   UTILIDADES ADICIONALES
   =================================== */

/* Border colors accesibles */
.border-primary-accessible {
  border-color: var(--irazu-primary) !important;
}

.border-success-accessible {
  border-color: var(--irazu-success) !important;
}

.border-warning-accessible {
  border-color: var(--irazu-warning) !important;
}

.border-danger-accessible {
  border-color: var(--irazu-danger) !important;
}

.border-info-accessible {
  border-color: var(--irazu-info) !important;
}

/* Sombras utilitarias */
.shadow-sm-custom {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-md-custom {
  box-shadow: var(--shadow-md) !important;
}

.shadow-lg-custom {
  box-shadow: var(--shadow-lg) !important;
}

/* z-index utilities */
.z-index-skip-links {
  z-index: 9999;
}

.z-index-modal {
  z-index: 1050;
}

.z-index-offcanvas {
  z-index: 1030;
}

/* Width utilities para sidebar */
.sidebar-width-desktop {
  width: 260px;
}

.offcanvas-width-mobile {
  width: 280px;
}

/* ===================================
   UTILITY CLASSES ADICIONALES
   =================================== */

/* Max-height utilities */
.max-h-400 {
  max-height: 400px;
  overflow-y: auto;
}

.max-h-200 {
  max-height: 200px;
}

.max-h-300 {
  max-height: 300px;
}

/* Max-width utilities */
.mw-300 {
  max-width: 300px;
}

.mw-400 {
  max-width: 400px;
}

/* Object-fit utilities (Bootstrap 5.3 ya tiene object-fit-contain pero por compatibilidad) */
.object-fit-contain {
  object-fit: contain;
}

/* Cursor utilities */
.cursor-pointer {
  cursor: pointer;
}

/* Progress bar height */
.progress-thin {
  height: 4px;
}

/* Border purple utility */
.border-purple {
  border-color: #BA68C8 !important;
}

/* ===================================
   TOAST NOTIFICATION - SESSION EXPIRED
   =================================== */

.toast-session-expired {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--gradient-primary);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  z-index: 9999;
  animation: slideInRight 0.5s ease-out;
}

.toast-session-expired .toast-icon {
  font-size: 1.5rem;
}

.toast-session-expired .toast-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.toast-session-expired .toast-message {
  font-size: 0.9rem;
  opacity: 0.9;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* === Utilities adicionales para documentación === */
.fs-1-2rem {
  font-size: 1.2rem !important;
}

.w-20 {
  width: 20% !important;
}

.w-40 {
  width: 40% !important;
}

.feature-icon {
  width: 4rem !important;
  height: 4rem !important;
}

/* Utilities para perfil y modales */
.mw-520 {
  max-width: 520px !important;
}

.mw-370 {
  max-width: 370px !important;
}

.mw-220 {
  max-width: 220px !important;
}

.mw-200 {
  max-width: 200px !important;
}

.min-h-380 {
  min-height: 380px !important;
}

.min-h-400 {
  min-height: 400px !important;
}

.max-h-500 {
  max-height: 500px !important;
}

.letter-spacing-wide {
  letter-spacing: 0.2em !important;
}

.d-inline {
  display: inline !important;
}

