﻿/* ============================================
   VARIABLES DE TEMA ATFA - Modo Claro y Oscuro
   ============================================ */

:root {
    /* Colores principales ATFA (Modo Claro) */
    --atfa-primary: #003d7a;
    --atfa-primary-dark: #002952;
    --atfa-primary-light: #0056a8;
    --atfa-secondary: #e30613;
    --atfa-secondary-dark: #b5050f;
    --atfa-accent: #f39200;
    --atfa-success: #28a745;
    --atfa-info: #17a2b8;
    --atfa-warning: #ffc107;
    --atfa-danger: #dc3545;
    
    /* Colores de fondo */
    --atfa-bg-primary: #ffffff;
    --atfa-bg-secondary: #f8f9fa;
    --atfa-bg-terciary: #e9ecef;
    --atfa-bg-sidebar: #003d7a;
    --atfa-bg-navbar: #ffffff;
    
    /* Colores de texto */
    --atfa-text-primary: #212529;
    --atfa-text-secondary: #6c757d;
    --atfa-text-light: #ffffff;
    --atfa-text-muted: #8b95a1;
    
    /* Bordes y sombras */
    --atfa-border-color: #dee2e6;
    --atfa-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --atfa-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    
    /* Tipograf�as */
    --atfa-font-primary: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --atfa-font-headings: 'Segoe UI Semibold', 'Segoe UI', sans-serif;
    
    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --navbar-height: 60px;
}

/* Modo Oscuro */
[data-theme="dark"] {
    --atfa-primary: #4a9eff;
    --atfa-primary-dark: #2678d6;
    --atfa-primary-light: #6bb1ff;
    --atfa-secondary: #ff4757;
    --atfa-secondary-dark: #e63946;
    --atfa-accent: #ffa500;
    
    --atfa-bg-primary: #1a1d23;
    --atfa-bg-secondary: #252930;
    --atfa-bg-terciary: #2f343d;
    --atfa-bg-sidebar: #1e2228;
    --atfa-bg-navbar: #252930;
    
    --atfa-text-primary: #e8eaed;
    --atfa-text-secondary: #9aa0a6;
    --atfa-text-light: #ffffff;
    --atfa-text-muted: #71767b;
    
    --atfa-border-color: #3c4043;
    --atfa-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --atfa-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Modo Oscuro - Soportar ambos atributos */
[data-theme="dark"],
[data-bs-theme="dark"] {
    --atfa-primary: #4a9eff;
    --atfa-primary-dark: #2678d6;
    --atfa-primary-light: #6bb1ff;
    --atfa-secondary: #ff4757;
    --atfa-secondary-dark: #e63946;
    --atfa-accent: #ffa500;
    
    --atfa-bg-primary: #1a1d23;
    --atfa-bg-secondary: #252930;
    --atfa-bg-terciary: #2f343d;
    --atfa-bg-sidebar: #1e2228;
    --atfa-bg-navbar: #252930;
    
    --atfa-text-primary: #e8eaed;
    --atfa-text-secondary: #9aa0a6;
    --atfa-text-light: #ffffff;
    --atfa-text-muted: #71767b;
    
    --atfa-border-color: #3c4043;
    --atfa-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --atfa-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================
   ESTILOS GLOBALES
   ============================================ */

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: var(--atfa-font-primary);
    background-color: var(--atfa-bg-secondary);
    color: var(--atfa-text-primary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--atfa-font-headings);
    color: var(--atfa-text-primary);
}

/* ============================================
   NAVBAR SUPERIOR
   ============================================ */

.navbar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background-color: var(--atfa-bg-navbar);
    border-bottom: 1px solid var(--atfa-border-color);
    box-shadow: var(--atfa-shadow);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--atfa-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar-brand:hover {
    color: var(--atfa-primary-dark) !important;
}

.navbar-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--atfa-border-color);
    color: var(--atfa-text-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--atfa-bg-terciary);
    border-color: var(--atfa-primary);
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--atfa-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    display: block;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--atfa-primary);
}

/* ============================================
   SIDEBAR OVERLAY (para cerrar al hacer clic fuera)
   ============================================ */

.sidebar-overlay {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--navbar-height));
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1019;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SIDEBAR LATERAL
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background-color: var(--atfa-bg-sidebar);
    box-shadow: var(--atfa-shadow);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1020;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Bot�n de toggle dentro del sidebar */
.sidebar-toggle-internal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.sidebar-toggle-internal:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.sidebar.collapsed .sidebar-toggle-internal {
    right: 50%;
    transform: translateX(50%);
}

/* ============================================
   MEN� SIDEBAR
   ============================================ */

.sidebar-menu {
    list-style: none;
    padding: 50px 0 15px 0; /* Espacio para el bot�n de toggle */
    margin: 0;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--atfa-accent);
}

.menu-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-left-color: var(--atfa-secondary);
    font-weight: 600;
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.menu-link.expanded .menu-arrow {
    transform: rotate(180deg);
}

/* Submen� */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.2);
}

.submenu.expanded {
    max-height: 500px;
}

.submenu .menu-link {
    padding-left: 60px;
    font-size: 0.95rem;
}

.submenu .menu-icon {
    font-size: 1rem;
}

/* Sidebar colapsada */
.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-arrow {
    display: none;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
}

.sidebar.collapsed .submenu {
    display: none;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.main-content {
    display: flex;
    flex-direction: column;
    margin-top: var(--navbar-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--navbar-height) - 60px);
    transition: margin-left 0.3s ease;
    background-color: var(--atfa-bg-secondary);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

/* ============================================
   ESTILOS KENDO UI - TEMA PERSONALIZADO
   ============================================ */

/* Sobrescribir colores de Kendo UI */
.k-grid,
.k-grid-header,
.k-grid-header-wrap {
    background-color: var(--atfa-bg-primary);
    color: var(--atfa-text-primary);
    border-color: var(--atfa-border-color);
}

.k-grid td,
.k-grid th {
    border-color: var(--atfa-border-color);
    color: var(--atfa-text-primary);
}

.k-grid tr:hover {
    background-color: var(--atfa-bg-terciary);
}

.k-grid .k-alt {
    background-color: var(--atfa-bg-secondary);
}

.k-button,
.k-button-solid-primary {
    background-color: var(--atfa-primary);
    border-color: var(--atfa-primary);
    color: var(--atfa-text-light);
}

.k-button:hover,
.k-button-solid-primary:hover {
    background-color: var(--atfa-primary-dark);
    border-color: var(--atfa-primary-dark);
}

.k-input,
.k-textbox,
.k-picker {
    background-color: var(--atfa-bg-primary);
    border-color: var(--atfa-border-color);
    color: var(--atfa-text-primary);
}

.k-dropdown,
.k-dropdownlist {
    background-color: var(--atfa-bg-primary);
    border-color: var(--atfa-border-color);
    color: var(--atfa-text-primary);
}

/* ============================================
   TARJETAS Y CONTENEDORES
   ============================================ */

.card {
    background-color: var(--atfa-bg-primary);
    border: 1px solid var(--atfa-border-color);
    box-shadow: var(--atfa-shadow);
    color: var(--atfa-text-primary);
}

.card-header {
    background-color: var(--atfa-bg-terciary);
    border-bottom: 1px solid var(--atfa-border-color);
    color: var(--atfa-text-primary);
}

/* ============================================
   BOTONES BOOTSTRAP PERSONALIZADOS
   ============================================ */

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

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

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

.btn-secondary:hover {
    background-color: var(--atfa-secondary-dark);
    border-color: var(--atfa-secondary-dark);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background-color: var(--atfa-bg-primary);
    border-top: 1px solid var(--atfa-border-color);
    color: var(--atfa-text-secondary);
    padding: 20px 0;
    margin-top: 40px;
}

.footer a {
    color: var(--atfa-primary);
}

.footer a:hover {
    color: var(--atfa-primary-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle-btn {
        display: block;
    }
}

/* En desktop, ocultar el bot�n de toggle del navbar cuando el sidebar no est� oculto */
@media (min-width: 769px) {
    .sidebar-toggle-btn {
        display: none;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.text-atfa-primary {
    color: var(--atfa-primary) !important;
}

.text-atfa-secondary {
    color: var(--atfa-secondary) !important;
}

.bg-atfa-primary {
    background-color: var(--atfa-primary) !important;
}

.bg-atfa-secondary {
    background-color: var(--atfa-secondary) !important;
}

.border-atfa {
    border-color: var(--atfa-border-color) !important;
}

