/* ============================================
   ARCHIVO DE CONFIGURACIÓN DE TEMA
   Modifica estos valores para personalizar los colores
   ============================================ */

/* TEMA POR DEFECTO - BLANCO Y NEGRO */
:root,
[data-theme="light"] {
    /* Colores Principales */
    --primary-color: #000000;
    --primary-hover: #333333;
    --primary-light: #f5f5f5;

    /* Colores de Fondo */
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #000000;
    --bg-hover: #f0f0f0;
    --bg-card: #ffffff;

    /* Colores de Texto */
    --text-color: #000000;
    --text-secondary: #666666;
    --text-light: #999999;
    --text-inverse: #ffffff;

    /* Colores de Borde */
    --border-color: #e0e0e0;
    --border-dark: #cccccc;

    /* Estados de Tareas */
    --estado-pendiente-bg: #f5f5f5;
    --estado-pendiente-text: #000000;
    --estado-proceso-bg: #e0e0e0;
    --estado-proceso-text: #000000;
    --estado-completada-bg: #cccccc;
    --estado-completada-text: #000000;

    /* Prioridades - Con colores */
    --prioridad-baja: #4caf50;
    --prioridad-baja-text: #ffffff;
    --prioridad-media: #ffeb3b;
    --prioridad-media-text: #000000;
    --prioridad-alta: #ff9800;
    --prioridad-alta-text: #ffffff;
    --prioridad-urgente: #f44336;
    --prioridad-urgente-text: #ffffff;
}

/* ============================================
   EJEMPLOS DE TEMAS ALTERNATIVOS
   Para usar un tema, comenta el anterior y descomenta el que desees
   ============================================ */

/* TEMA AZUL CORPORATIVO
:root {
    --primary-color: #1a56db;
    --primary-hover: #1e429f;
    --primary-light: #e1effe;

    --bg-color: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-sidebar: #1a56db;
    --bg-hover: #e5e7eb;
    --bg-card: #ffffff;

    --text-color: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --text-inverse: #ffffff;

    --border-color: #e5e7eb;
    --border-dark: #d1d5db;

    --estado-pendiente-bg: #fef3c7;
    --estado-pendiente-text: #92400e;
    --estado-proceso-bg: #dbeafe;
    --estado-proceso-text: #1e40af;
    --estado-completada-bg: #d1fae5;
    --estado-completada-text: #065f46;

    --prioridad-baja: #d1fae5;
    --prioridad-media: #dbeafe;
    --prioridad-alta: #fed7aa;
    --prioridad-urgente: #fee2e2;
}
*/

/* TEMA VERDE MODERNO
:root {
    --primary-color: #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;

    --bg-color: #ffffff;
    --bg-secondary: #f0fdf4;
    --bg-sidebar: #064e3b;
    --bg-hover: #dcfce7;
    --bg-card: #ffffff;

    --text-color: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: #e2e8f0;
    --border-dark: #cbd5e1;

    --estado-pendiente-bg: #fef3c7;
    --estado-pendiente-text: #92400e;
    --estado-proceso-bg: #dbeafe;
    --estado-proceso-text: #1e40af;
    --estado-completada-bg: #d1fae5;
    --estado-completada-text: #065f46;

    --prioridad-baja: #d1fae5;
    --prioridad-media: #dbeafe;
    --prioridad-alta: #fed7aa;
    --prioridad-urgente: #fee2e2;
}
*/

/* TEMA OSCURO
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e293b;

    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #000000;
    --bg-hover: #334155;
    --bg-card: #1e293b;

    --text-color: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: #334155;
    --border-dark: #475569;

    --estado-pendiente-bg: #713f12;
    --estado-pendiente-text: #fef3c7;
    --estado-proceso-bg: #1e3a8a;
    --estado-proceso-text: #dbeafe;
    --estado-completada-bg: #064e3b;
    --estado-completada-text: #d1fae5;

    --prioridad-baja: #064e3b;
    --prioridad-media: #1e3a8a;
    --prioridad-alta: #9a3412;
    --prioridad-urgente: #991b1b;
}
*/

/* TEMA MINIMALISTA GRIS
:root {
    --primary-color: #404040;
    --primary-hover: #525252;
    --primary-light: #f5f5f5;

    --bg-color: #ffffff;
    --bg-secondary: #fafafa;
    --bg-sidebar: #262626;
    --bg-hover: #f5f5f5;
    --bg-card: #ffffff;

    --text-color: #171717;
    --text-secondary: #737373;
    --text-light: #a3a3a3;
    --text-inverse: #ffffff;

    --border-color: #e5e5e5;
    --border-dark: #d4d4d4;

    --estado-pendiente-bg: #f5f5f5;
    --estado-pendiente-text: #171717;
    --estado-proceso-bg: #e5e5e5;
    --estado-proceso-text: #171717;
    --estado-completada-bg: #d4d4d4;
    --estado-completada-text: #171717;

    --prioridad-baja: #f5f5f5;
    --prioridad-media: #e5e5e5;
    --prioridad-alta: #d4d4d4;
    --prioridad-urgente: #404040;
}
*/

/* ============================================
   TEMA OSCURO - Activado con atributo [data-theme="dark"]
   ============================================ */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e293b;

    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #020617;
    --bg-hover: #334155;
    --bg-card: #1e293b;

    --text-color: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: #334155;
    --border-dark: #475569;

    --estado-pendiente-bg: #713f12;
    --estado-pendiente-text: #fef3c7;
    --estado-proceso-bg: #1e3a8a;
    --estado-proceso-text: #dbeafe;
    --estado-completada-bg: #064e3b;
    --estado-completada-text: #d1fae5;

    --prioridad-baja: #065f46;
    --prioridad-baja-text: #d1fae5;
    --prioridad-media: #ca8a04;
    --prioridad-media-text: #fef3c7;
    --prioridad-alta: #c2410c;
    --prioridad-alta-text: #fed7aa;
    --prioridad-urgente: #991b1b;
    --prioridad-urgente-text: #fee2e2;
}

/* ============================================
   TAMAÑOS DE FUENTE
   ============================================ */
.font-small {
    font-size: 14px;
}

.font-medium {
    font-size: 16px;
}

.font-large {
    font-size: 18px;
}


/* Selector de Normas ISO con Chips */
.normas-selector {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    background: var(--bg-color);
}

.normas-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    min-height: 32px;
}

.norma-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

.norma-chip-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.norma-chip-remove:hover {
    opacity: 1;
}

.normas-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.norma-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.norma-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.norma-checkbox {
    cursor: pointer;
}

.norma-checkbox:checked + .norma-label {
    font-weight: 600;
    color: var(--primary-color);
}

.norma-label {
    cursor: pointer;
    font-size: 0.875rem;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Cabecera móvil */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #1a1a1a;
    color: white;
    z-index: 1002;
    align-items: center;
    padding: 0 var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.mobile-header-title {
    flex: 1;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Botón hamburguesa para móvil */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 16px;
    z-index: 1003 !important;
    background: transparent;
    color: white;
    border: none;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:active {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle:hover {
    opacity: 0.8;
}

.mobile-menu-toggle svg {
    display: block;
    width: 28px;
    height: 28px;
    pointer-events: none;
}

/* Overlay para cerrar menú en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* TABLETS - 768px to 1024px */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 220px 1fr;
    }

    .sidebar {
        width: 220px;
    }

    .main-content {
        padding: var(--spacing-lg);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* MOBILE - menos de 768px */
@media (max-width: 768px) {
    /* Mostrar cabecera y botón móvil */
    .mobile-header {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Sidebar oculto por defecto en móvil */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1001 !important;
        transform: translateX(0) !important;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
        background: var(--bg-sidebar);
    }

    .sidebar.mobile-open {
        left: 0 !important;
        transform: translateX(0) !important;
    }

    /* Main content ocupa todo el ancho */
    .app-container {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding-top: 80px;
        margin-left: 0;
    }

    /* Stats en dos columnas en móvil */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-card {
        padding: var(--spacing-sm);
    }

    .stat-card h3 {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    /* Cards apilados */
    .card {
        margin-bottom: var(--spacing-md);
    }

    /* Calendario en móvil - solo vista mes */
    .btn-view {
        display: none !important;
    }

    .card-header > div {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .calendario-navegacion {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .calendario-navegacion h3 {
        font-size: 0.9rem;
        margin: 0;
        min-width: auto;
        flex: 1;
        text-align: center;
    }

    .calendario-navegacion .btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        min-width: auto;
    }

    /* Tablas responsive - scroll horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
    }

    /* Formularios en una columna */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    /* Modal más pequeño */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px auto;
        padding: var(--spacing-md);
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    /* Botones más grandes para touch */
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    /* Calendario responsive */
    .calendario-navegacion {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
        justify-content: center;
    }

    .calendario-navegacion h2,
    .calendario-navegacion h3 {
        width: 100%;
        text-align: center;
        margin: var(--spacing-xs) 0;
    }

    /* Filtros apilados */
    .filters-card {
        padding: var(--spacing-md);
    }

    .filter-group {
        margin-bottom: var(--spacing-sm);
    }

    /* Sidebar footer más compacto */
    .sidebar-footer {
        padding: var(--spacing-sm);
    }

    .user-info {
        display: none;
    }

    .user-avatar {
        margin-right: 0;
    }

    /* Ocultar elementos no esenciales en móvil */
    .sidebar-tagline {
        font-size: 0.7rem;
    }

    /* Cards de 2 columnas a 1 columna */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* MOBILE PEQUEÑO - menos de 480px */
@media (max-width: 480px) {
    .main-content {
        padding: 70px var(--spacing-sm) var(--spacing-sm);
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .card {
        padding: var(--spacing-md);
    }

    .modal-content {
        width: 100%;
        max-width: none;
        border-radius: 0;
        max-height: 100vh;
        margin: 0;
    }

    /* Stats más compactos */
    .stat-card {
        padding: var(--spacing-sm);
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Tabla muy compacta */
    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }

    /* Form inputs más grandes para touch */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 12px;
    }

    /* Normas selector responsive */
    .normas-options {
        gap: 4px;
    }

    .norma-option {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* LANDSCAPE MOBILE */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        padding-top: 70px;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* PRINT STYLES */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .sidebar-overlay,
    .btn-group,
    .filters-card {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
