/*
 * Hoja de estilos principal para ContaPerú ERP
 *
 * Paleta clara/luminosa compartida por toda la aplicación: la app autenticada
 * (sidebar), el panel de superadmin y las páginas públicas (bienvenida,
 * capacitación, login, registro). Un solo archivo evita que cada página
 * defina su propia versión (ligeramente distinta) de los mismos colores.
 */

:root {
    --brand-primary: #4A90E2;
    --brand-primary-dark: #357ABD;
    --brand-primary-soft: #EAF2FC;
    --text-title: #34495e;
    --text-primary: #4A4A4A;
    --text-secondary: #6b7280;
    --text-muted-soft: #9aa5b1;
    --bg-light: #ffffff;
    --surface-bg: #f6f8fb;
    --border-color: #e5e7eb;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(20, 30, 55, 0.05), 0 1px 2px rgba(20, 30, 55, 0.04);
    --shadow-md: 0 6px 20px rgba(20, 30, 55, 0.07);
}

* { scrollbar-width: thin; scrollbar-color: #d5dbe3 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background-color: #d5dbe3; border-radius: 8px; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--surface-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--text-title);
}

.text-muted { color: var(--text-secondary) !important; }
a { color: var(--brand-primary); }

/* --- Componentes de Bootstrap sobreescritos --- */

.btn { border-radius: 9px; font-weight: 600; padding: 0.5rem 1.25rem; transition: all 0.15s ease-in-out; }
.btn:active { transform: translateY(1px); }

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

.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background-color: var(--brand-primary); border-color: var(--brand-primary); }

.card { border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { overflow-x: auto; } /* deja que cualquier tabla ancha dentro de una card sea scrolleable en pantallas chicas */
.card-body h6 { font-size: 0.92rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body h6 i { color: var(--brand-primary); }
.card-header { background-color: #fff; border-bottom: 1px solid var(--border-color); font-weight: 600; }

.card-stat { border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.card-stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-primary); }
.card-stat h3 { font-weight: 700; }

.nav-tabs { border-bottom: 1px solid var(--border-color); gap: 2px; }
.nav-tabs .nav-link { border: none; color: var(--text-secondary); font-weight: 500; border-radius: 8px 8px 0 0; padding: 10px 16px; }
.nav-tabs .nav-link:hover { background-color: var(--brand-primary-soft); color: var(--brand-primary-dark); }
.nav-tabs .nav-link.active { color: var(--brand-primary-dark); background-color: var(--brand-primary-soft); border-bottom: 2px solid var(--brand-primary); font-weight: 600; }

.table { --bs-table-hover-bg: var(--brand-primary-soft); }
.table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); font-weight: 600; border-bottom-width: 1px; background-color: #fafbfd; }
.table td, .table th { vertical-align: middle; padding-top: 0.65rem; padding-bottom: 0.65rem; }

.badge { font-weight: 500; border-radius: 20px; padding: 0.4em 0.75em; }
.badge-sunat { background-color: #e67e22; }

.form-control, .form-select { border-radius: 9px; border-color: var(--border-color); }
.form-control:focus, .form-select:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.15); }

.alert { border: none; border-radius: 9px; }

.navbar { box-shadow: 0 2px 4px rgba(0,0,0,0.04); }

/* --- Clases de utilidad personalizadas --- */

.brand-badge {
    width: 52px; height: 52px; border-radius: 14px;
    background: var(--brand-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; margin: 0 auto 14px;
}

.modulo-icono, .benefit-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: var(--brand-primary-soft); color: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}

.benefit-card, .modulo-card {
    border: 1px solid var(--border-color); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.benefit-card:hover, .modulo-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.pricing-card { border: 2px solid var(--brand-primary); border-radius: 18px; }

/* --- Barra lateral (sidebar) de la app autenticada --- */

.sidebar {
    min-height: 100vh;
    background: var(--bg-light);
    color: var(--text-primary);
    padding-top: 8px;
    border-right: 1px solid var(--border-color);
}
.sidebar a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    padding: 11px 20px;
    font-size: 0.93rem;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.sidebar a:hover { background-color: var(--brand-primary-soft); color: var(--brand-primary-dark); }
.sidebar a.active { background-color: var(--brand-primary-soft); border-left: 3px solid var(--brand-primary); color: var(--brand-primary-dark); font-weight: 600; }
.sidebar i { width: 24px; text-align: center; }
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--border-color); margin-bottom: 12px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text-title); }
.sidebar-brand .brand-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.sidebar-user { font-size: 0.78rem; color: var(--text-secondary); }
.sidebar small.text-uppercase { color: var(--text-muted-soft) !important; letter-spacing: 0.06em; }

.content-area { padding: 32px; max-width: 1400px; }

/* Barra superior y overlay: solo se ven por debajo del breakpoint md (menú lateral off-canvas) */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-light);
    color: var(--text-title);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1030;
}
.mobile-topbar button { color: var(--text-title); background: none; border: none; font-size: 1.3rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 767.98px) {
    .mobile-topbar { display: flex; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        box-shadow: var(--shadow-md);
    }
    .sidebar.show { transform: translateX(0); }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(31, 41, 55, 0.35);
        z-index: 1040;
    }
    .sidebar-backdrop.show { display: block; }
    .content-area { padding: 18px; }
}

/* --- Páginas públicas: landing, capacitación, login, registro --- */

.hero {
    background: linear-gradient(135deg, var(--brand-primary-soft), #ffffff 65%);
    color: var(--text-title);
    padding: 90px 0 110px;
    border-bottom: 1px solid var(--border-color);
}
.hero p.lead { color: var(--text-secondary); }
@media (max-width: 576px) {
    .hero { padding: 55px 0 75px; }
}

section { padding: 60px 0; }
@media (max-width: 576px) {
    section { padding: 40px 0; }
}

.auth-page {
    background: linear-gradient(135deg, var(--brand-primary-soft), var(--surface-bg) 70%);
    min-height: 100vh;
}
.auth-card { max-width: 380px; margin: auto; border: 1px solid var(--border-color); border-radius: 16px; box-shadow: var(--shadow-md); }
.auth-card.auth-card-wide { max-width: 560px; }
