﻿/* =========================================================
   CONFIGURACIÓN GENERAL
   ========================================================= */

html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f8;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Foco de botones */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ============================================
   VARIABLES CSS MODERNAS
   ============================================ */
:root {
    --sidebar-width: 280px;
    --topbar-height: 64px;
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilo general para PC / pantallas grandes */
.titulo-vista {
    white-space: nowrap; /* Mantiene todo en una sola línea */
    display: flex; /* Ícono y texto alineados */
    align-items: center; /* Centrado vertical */
    font-size: 1.5rem; /* Tamaño más grande en escritorio */
    font-weight: bold; /* Negrita */
    color: #0d6efd; /* Azul Bootstrap (text-primary) */
    margin-bottom: 1.5rem; /* Espaciado inferior */
}

    .titulo-vista i {
        margin-right: 0.75rem; /* Espacio entre ícono y texto */
    }

/* Ajustes para móviles */
@media (max-width: 576px) {
    .titulo-vista {
        font-size: 1rem; /* Texto más pequeño en móviles */
        margin-bottom: 1rem; /* Menos espacio inferior */
    }

        .titulo-vista i {
            margin-right: 0.5rem; /* Espacio reducido entre ícono y texto */
        }
}
/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #1e293b 100%);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition-smooth);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Header del Sidebar */
.sidebar-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.sidebar-header i {
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Navegación del Sidebar */
.sidebar .nav {
    padding: 1rem 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
    padding-left: 1.5rem;
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

.sidebar .nav-link i {
    font-size: 1.125rem;
    width: 24px;
    transition: var(--transition-smooth);
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* Toggle Submenu */
.toggle-submenu {
    cursor: pointer;
}

.toggle-submenu .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.toggle-submenu.active .bi-chevron-down {
    transform: rotate(180deg);
}

/* Submenú Moderno */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 2px solid var(--border-color);
    margin-left: 1.25rem;
}

.submenu.show {
    max-height: 1000px;
}

.submenu .nav-link {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.875rem;
    border-left: none;
    position: relative;
}

.submenu .nav-link::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--secondary-color);
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.submenu .nav-link:hover::before,
.submenu .nav-link.active::before {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.3);
}

/* Submenu nivel 3 */
.submenu .submenu {
    margin-left: 1rem;
    border-left-color: rgba(100, 116, 139, 0.3);
}

.submenu .submenu .nav-link {
    padding-left: 3.5rem;
    font-size: 0.8125rem;
}

/* =========================================================
   TOPBAR - AHORA CON GRADIENTE DEL MENÚ
   ========================================================= */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    z-index: 1040;
    transition: var(--transition-smooth);
}

/* Botón del menú hamburguesa */
.topbar .btn-link {
    color: var(--text-primary) !important;
    text-decoration: none;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.topbar .btn-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.topbar .fw-semibold {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Notificaciones */
.topbar .text-white {
    color: var(--text-primary) !important;
}

/* Badge de notificaciones */
.topbar .badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.4rem;
    font-weight: 600;
}

/* Dropdown del Usuario */
.topbar .dropdown-toggle {
    color: var(--text-primary) !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.topbar .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.topbar .dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    margin-top: 0.5rem;
    min-width: 220px;
}

.topbar .dropdown-item {
    padding: 0.75rem 1.25rem;
    transition: var(--transition-smooth);
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
}

.topbar .dropdown-item:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.topbar .dropdown-item i {
    width: 20px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 2rem;
    min-height: calc(100vh - var(--topbar-height) - 60px);
    transition: var(--transition-smooth);
    flex: 1 0 auto;
}

/* ============================================
   FOOTER - FIJO AL FINAL CON COLOR BLANCO
   ============================================ */
footer {
    margin-left: var(--sidebar-width);
    transition: var(--transition-smooth);
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    padding: 1rem 0;
    flex-shrink: 0;
    width: calc(100% - var(--sidebar-width));
    position: relative;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1060;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .content {
        margin-left: 0;
    }

    footer {
        margin-left: 0;
        width: 100%;
    }

    /* Overlay oscuro cuando el menú está abierto */
    .sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 100%;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: -1;
    }

    .sidebar.show::before {
        opacity: 1;
        pointer-events: all;
    }
}

/* ============================================
   ALERTAS MEJORADAS
   ============================================ */
.alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar .nav > li {
    animation: slideIn 0.3s ease forwards;
}

.sidebar .nav > li:nth-child(1) { animation-delay: 0.05s; }
.sidebar .nav > li:nth-child(2) { animation-delay: 0.1s; }
.sidebar .nav > li:nth-child(3) { animation-delay: 0.15s; }
.sidebar .nav > li:nth-child(4) { animation-delay: 0.2s; }
.sidebar .nav > li:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   MEJORAS VISUALES
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* ============================================
  Interruptor moderno CHECK MODERN SWITCH
   ============================================ *//* Interruptor moderno */

.modern-switch .form-check-input {
    width: 50px;
    height: 28px;
    background-color: #ccc;
    border-radius: 14px;
    position: relative;
    transition: background-color 0.3s ease;
}

    .modern-switch .form-check-input:checked {
        background-color: #4CAF50;
    }

    .modern-switch .form-check-input::before {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 22px;
        height: 22px;
        background-color: white;
        border-radius: 50%;
        transition: transform 0.3s ease;
    }

    .modern-switch .form-check-input:checked::before {
        transform: translateX(22px);
    }

/* ============================================
   BADGE DE NOTIFICACIONES
   ============================================ */
.topbar .position-relative .badge {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

/* ============================================
   BOTON DE AYUDA
   ============================================ */
.help-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1085;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .75rem .95rem;
    border-radius: 999px;
    text-decoration: none;
    background: #0d6efd;
    color: #fff;
    box-shadow: 0 .6rem 1.2rem rgba(0,0,0,.18);
    border: 1px solid rgba(255,255,255,.15);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    user-select: none;
}

.help-fab:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 .75rem 1.4rem rgba(0,0,0,.22);
    opacity: .98;
}

.help-fab:active {
    transform: translateY(0);
    box-shadow: 0 .55rem 1.1rem rgba(0,0,0,.18);
}

.help-fab i {
    font-size: 1.25rem;
    line-height: 1;
}

.help-fab-text {
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .2px;
    line-height: 1;
}

@media (max-width: 576px) {
    .help-fab {
        right: 14px;
        bottom: 14px;
        padding: .7rem .8rem;
    }

    .help-fab-text {
        display: none !important;
    }
}


