/* ============================================================
   base.css - ArchivoFiscal
   Paleta oficial:
   Thunderbird (#B21826): acciones principales y alertas
   Martinique (#312A47): base de marca y textos oscuros
   Manatee (#8D85A1): secundarios y desactivados
   Quill Gray (#E5E6E3): fondos claros y contrastes suaves
   ============================================================ */

:root {
    --thunderbird: #B21826;
    --martinique: #312A47;
    --manatee: #8D85A1;
    --quill-gray: #E5E6E3;

    --primary-color: var(--thunderbird);
    --primary-dark: #8f1420;
    --danger-color: #dc3545;
    --secondary-color: var(--manatee);
    --light-color: var(--quill-gray);
    --dark-color: var(--martinique);

    --sidebar-width: 230px;
    --header-height: 64px;

    --body-bg: #f4f6f9;
    --sidebar-bg: #312A47;          /* Martinique - morado oscuro */
    --sidebar-hover: #3F3658;       /* un poco más claro */
    --sidebar-text: #E5E6E3;        /* Quill Gray para texto */
    --sidebar-icon: #8D85A1;        /* Manatee para iconos */
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e0e4e8;
    --text-color: #333333;
    --text-muted: #6c757d;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 20px 0;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 0 20px 25px;
    text-align: center;
    background: transparent;
    border-bottom: none;
    background-color: #F4F6F9 !important;  /* Igual que body */
    border-bottom: 1px solid #e0e4e8;      /* separador sutil */
}

.sidebar-brand img {
    max-width: 100%;
    height: auto;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 0 12px;
}

.sidebar .nav-link {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
}

.sidebar .nav-link i {
    width: 20px;
    color: var(--sidebar-icon);
    text-align: center;
    margin-right: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar .nav-link.active i {
    color: #ffffff;                /* icono blanco para resaltar */
}

.sidebar .nav-collapse .nav-link {
    padding-left: 2.5rem;
    font-size: 0.8rem;
}

.sidebar .nav-item {
    margin-bottom: 2px;
}

/* Títulos de sección */
.sidebar .section-title {
    padding: 15px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8a9bae;
}

/* Tema switcher dentro del sidebar */
.theme-switcher-full {
    margin-top: auto;
    padding: 1rem 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    position: static;
}

.theme-btn-group {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--manatee);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn:hover {
    border-color: #fff;
    color: #fff;
}

.theme-btn.active {
    border-color: var(--thunderbird);
    color: var(--thunderbird);
    background-color: rgba(178,24,38,0.15);
}

/* ============ HEADER ============ */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    min-height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 25px;
    z-index: 999;
    box-shadow: var(--shadow-sm);
    transition: left 0.3s ease;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    order: 1;
}

.theme-switcher-mini {
    order: 2;
    margin-left: 10px;
}

.theme-switcher-mini .btn {
    color: var(--text-muted);
    border-color: var(--border-color);
}

.theme-switcher-mini .btn:hover {
    color: var(--text-color);
}

.main-header .d-flex.align-items-center.ms-auto {
    order: 3;
    margin-left: auto;
}

.main-header .dropdown-menu {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.main-header .dropdown-item {
    color: var(--text-color);
}

.main-header .dropdown-item:hover {
    background-color: #f1f5f9;
    color: var(--text-color);
}

#notificacionBadge {
    background: var(--thunderbird) !important;
    color: #fff;
}

/* ============ CONTENIDO PRINCIPAL ============ */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 25px) 25px 25px 25px;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    width: 100%;
}

/* ============ FOOTER ============ */
.footer {
    background-color: var(--martinique);
    color: var(--manatee);
    text-align: center;
    padding: 15px 0;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.footer a {
    color: var(--manatee);
    text-decoration: none;
}

.footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ============ COMPONENTES COMUNES ============ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 15px 20px;
}

.btn-primary {
    background-color: var(--thunderbird);
    border-color: var(--thunderbird);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--thunderbird);
    border-color: var(--thunderbird);
}

.btn-outline-primary:hover {
    background-color: var(--thunderbird);
    color: #fff;
}

.btn-outline-soft {
    background: transparent;
    border: 1px solid var(--thunderbird);
    color: var(--thunderbird);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-soft:hover {
    background: var(--thunderbird);
    color: #fff;
}

.form-control:focus {
    border-color: var(--thunderbird);
    box-shadow: 0 0 0 0.25rem rgba(178,24,38,0.25);
}

a {
    color: var(--thunderbird);
    text-decoration: none;
}

a:hover {
    color: var(--martinique);
    text-decoration: none;
}

.table-responsive {
    overflow: auto;
}

.dropdown-menu {
    position: absolute !important;
    z-index: 9999 !important;
}

.card-body.p-0 {
    overflow: visible !important;
    background-color: #F4F6F9 !important;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-header {
        left: 0;
    }
    .content-wrapper {
        margin-left: 0;
        width: 100%;
        padding: calc(var(--header-height) + 15px) 15px 15px 15px;
    }
    .theme-switcher-mini {
        display: none;
    }
}