@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {

    --primary: #1e4fa3;
    --primary-dark: #163c80;
    --secondary: #2d6cdf;
    --accent: #38bdf8;

    --sidebar-from: #1e4fa3;
    --sidebar-to: #163c80;

    --background: #f3f5fa;
    --card: #ffffff;
    --card-alt: #f8f9fc;

    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e6e9f0;

    --shadow-sm: 0 2px 10px rgba(30, 41, 59, .06);
    --shadow: 0 8px 24px rgba(30, 41, 59, .08);
    --shadow-lg: 0 16px 40px rgba(30, 41, 59, .12);

    --radius: 16px;
    --radius-sm: 10px;

    color-scheme: light;

}

:root[data-theme="dark"] {

    --primary: #4c8dff;
    --primary-dark: #2d6cdf;
    --secondary: #5b9bff;
    --accent: #38bdf8;

    --sidebar-from: #0f1c33;
    --sidebar-to: #060c18;

    --background: #0f1420;
    --card: #171d2b;
    --card-alt: #1c2334;

    --text: #e7eaf1;
    --text-muted: #9aa4b8;
    --border: #2a3245;

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow: 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);

    color-scheme: dark;

}

* {
    font-family: 'Poppins', sans-serif;
}

html {
    scrollbar-color: var(--border) transparent;
}

body {

    background: var(--background);
    color: var(--text);

    transition: background-color .25s ease, color .25s ease;

}

a {
    color: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
}

hr {
    border-color: var(--border);
    opacity: 1;
}

/* ===== LOGIN ===== */

.login-body {

    display: flex;
    justify-content: center;
    align-items: center;

    min-height: 100vh;

    background:
        radial-gradient(circle at 15% 20%, rgba(56, 189, 248, .18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(45, 108, 223, .18), transparent 45%),
        var(--background);

}

.login-container {

    width: 100%;
    max-width: 400px;

    padding: 20px;

}

.login-card {

    background: var(--card);

    padding: 36px 32px;

    border-radius: 22px;

    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);

}

.logo {

    width: 70%;

    display: block;

    margin: auto;

    margin-bottom: 20px;

    border-radius: 14px;

}

[data-theme="dark"] .logo {
    background: #ffffff;
    padding: 10px;
}

h2 {

    text-align: center;

    margin-bottom: 25px;

}

/* ===== SIDEBAR (ESCRITORIO) ===== */

.sidebar {

    width: 264px;
    height: 100vh;

    position: fixed;
    left: 0;
    top: 0;

    background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));

    color: white;

    box-shadow: var(--shadow-lg);

    z-index: 100;

}

.sidebar-logo {

    text-align: center;

    padding: 24px 20px 20px;

    border-bottom: 1px solid rgba(255,255,255,.12);

}

.sidebar-logo h5 {
    color: rgba(255,255,255,.85);
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 0;
}

.logo-menu {

    width: 100%;

    margin-bottom: 12px;

}

.offcanvas-titulo {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar ul {

    list-style: none;

    padding: 12px;

    margin: 0;

    overflow-y: auto;

}

.sidebar ul li {
    margin-bottom: 4px;
}

.sidebar ul li a {

    display: flex;
    align-items: center;

    padding: 12px 16px;

    color: rgba(255,255,255,.82);

    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;

    border-radius: var(--radius-sm);

    transition: background-color .2s ease, color .2s ease, transform .15s ease;

}

.sidebar ul li a:hover {

    background: rgba(255,255,255,.10);
    color: white;

}

.sidebar ul li a.activo {

    background: rgba(255,255,255,.16);
    color: white;
    box-shadow: inset 3px 0 0 var(--accent);

}

.sidebar i {

    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.05rem;

}

.sidebar-tema {

    padding: 4px 20px 16px;

}

.sidebar-usuario {

    display: flex;
    align-items: center;
    gap: 12px;

    margin: 8px 12px 16px;
    padding: 12px 14px;

    background: rgba(255,255,255,.08);
    border-radius: var(--radius-sm);

}

.sidebar-usuario-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    overflow: hidden;
}

.sidebar-usuario-info strong {
    color: white;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-usuario-info small {
    color: rgba(255,255,255,.65);
    font-size: .75rem;
}

.avatar-circulo {

    flex-shrink: 0;

    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,.16);
    color: white;

    border-radius: 50%;

    font-weight: 600;
    font-size: .85rem;

    border: 1px solid rgba(255,255,255,.25);

}

/* ===== TOGGLE DE TEMA ===== */

.theme-toggle-btn {

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    width: 100%;

    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    color: white;

    padding: 12px 14px;
    border-radius: var(--radius-sm);

    font-size: .9rem;
    font-weight: 500;

    cursor: pointer;
    user-select: none;

    transition: background-color .2s ease, transform .12s ease;

}

.theme-toggle-btn:hover {
    background: rgba(255,255,255,.18);
    color: white;
}

.theme-toggle-btn:active {
    transform: translateY(1px);
}

.theme-toggle-icon {
    font-size: 1.05rem;
}

/* ===== NAVBAR MÓVIL ===== */

.navbar-mobile {

    background: linear-gradient(90deg, var(--sidebar-from), var(--sidebar-to));
    padding: 12px 8px;

}

.navbar-mobile-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.navbar-mobile-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.btn-icon-toggle {

    background: rgba(255,255,255,.12);
    border: none;
    color: white;

    width: 40px;
    height: 40px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background-color .2s ease;

}

.btn-icon-toggle:hover {
    background: rgba(255,255,255,.22);
    color: white;
}

/* ===== OFFCANVAS MÓVIL (mismo azul que la sidebar) ===== */

.sidebar-offcanvas {

    width: 300px !important;

    background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
    color: white;

}

.sidebar-offcanvas .offcanvas-header {
    border-bottom: 1px solid rgba(255,255,255,.15);
    padding: 16px 20px;
}

.sidebar-offcanvas .offcanvas-body {
    padding: 12px;
}

.menu-link {

    display: flex;
    align-items: center;

    text-decoration: none;
    color: rgba(255,255,255,.85);

    padding: 13px 16px;
    margin: 3px 4px;

    border-radius: var(--radius-sm);

    transition: background-color .2s ease, color .2s ease;

    font-size: .95rem;
    font-weight: 500;

}

.menu-link:hover {
    background: rgba(255,255,255,.10);
    color: white;
}

.menu-link.activo {
    background: rgba(255,255,255,.18);
    color: white;
    box-shadow: inset 3px 0 0 var(--accent);
}

.menu-link i {
    margin-right: 12px;
    width: 22px;
    text-align: center;
}

.sidebar-tema-movil {
    border-top: 1px solid rgba(255,255,255,.12);
    padding: 16px 20px;
    margin-top: 8px;
}

.usuario-menu {

    display: flex;
    align-items: center;
    gap: 12px;

    background: rgba(255,255,255,.08);
    border-radius: var(--radius-sm);
    margin: 4px;
    padding: 14px;

}

.usuario-menu strong {
    display: block;
    font-size: .9rem;
    color: white;
}

.usuario-menu small {
    color: rgba(255,255,255,.65);
}

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

.contenido {
    margin-left: 264px;
    padding: 40px;
    min-height: 100vh;
}

@media (max-width: 991px) {

    .contenido {
        margin-left: 0;
        padding: 20px;
        margin-top: 12px;
    }

}

@media (min-width: 992px) {

    .contenido {
        padding: 36px 48px;
    }

}

/* ===== TARJETAS ===== */

.card {

    background: var(--card);
    color: var(--text);

    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;

    overflow: hidden;

    box-shadow: var(--shadow-sm);

    transition: transform .18s ease, box-shadow .18s ease, background-color .25s ease, border-color .25s ease;

}

.card.shadow, .card.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.card-body h2,
.card-body h3,
.card-body h5 {
    color: var(--text);
}

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

/* ===== FORMULARIOS ===== */

.form-label {
    font-weight: 500;
    font-size: .88rem;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control,
.form-select {

    background-color: var(--card);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    padding: 10px 14px;

    transition: border-color .2s ease, box-shadow .2s ease, background-color .25s ease;

}

.form-control:focus,
.form-select:focus {

    background-color: var(--card);
    color: var(--text);

    border-color: var(--secondary);
    box-shadow: 0 0 0 .2rem rgba(45, 108, 223, .18);

}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: .7;
}

.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ===== BOTONES ===== */

.btn {

    border-radius: var(--radius-sm);

    font-weight: 500;

    padding: 10px 18px;

    transition: transform .12s ease, box-shadow .18s ease, background-color .18s ease, filter .18s ease;

}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    padding: 6px 14px;
    border-radius: 8px;
}

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

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

.btn-primary:not(:disabled):hover {
    box-shadow: 0 6px 16px rgba(30, 79, 163, .3);
}

.btn-outline-warning,
.btn-outline-danger,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning {
    border-radius: var(--radius-sm);
}

/* ===== BADGES / ALERTAS ===== */

.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
}

.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

/* ===== MODALES ===== */

.modal-content {
    background: var(--card);
    color: var(--text);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
}

/* ===== PROGRESO ===== */

.progress {
    background-color: var(--card-alt);
    border-radius: 999px;
}

/* ===== OFFCANVAS GENÉRICO (por si el navegador lo usa fuera de la sidebar) ===== */

.offcanvas {
    width: 300px !important;
}

.offcanvas-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* ===== VARIOS ===== */

::selection {
    background: var(--secondary);
    color: white;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

/* ===== MODO OSCURO: UTILIDADES DE BOOTSTRAP ===== */

[data-theme="dark"] .bg-light {
    background-color: var(--card-alt) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--card) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border) !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .alert-light {
    background-color: var(--card-alt);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.menu-footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    color: rgba(255,255,255,.6);
    font-size: 0.85rem;
}
