/* ============================================================
   Panel Lockers — Custom styles
   Base: Bootstrap 5.3
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #2d3f55;
    --topbar-height: 56px;
}

/* ── Body ───────────────────────────────────────────────────── */
body {
    background: #f0f2f5;
}

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar .sidebar-brand {
    height: var(--topbar-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: #111d2b;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    border-bottom: 1px solid #2d3f55;
}

.sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #2d3f55 transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #2d3f55;
    border-radius: 2px;
}

/* ── Sidebar tenant bar ─────────────────────────────────────── */
.sidebar-tenant-bar {
    flex-shrink: 0;
    padding: .55rem 1.25rem;
    background: #17212f;
    border-bottom: 1px solid #2d3f55;
    font-size: .82rem;
}

.sidebar-tenant-bar .tenant-name {
    color: #7dd3fc;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-tenant-bar .tenant-db {
    color: #5a7a9a;
    font-size: .74rem;
    margin-top: .1rem;
}

.sidebar-tenant-bar .tenant-none {
    color: #5a7a9a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.sidebar-tenant-bar .tenant-none:hover {
    color: #a8b8cc;
}

.sidebar-tenant-bar .btn-exit {
    padding: .1rem .35rem;
    font-size: .72rem;
    color: #5a7a9a;
    border-color: #2d3f55;
    background: transparent;
    flex-shrink: 0;
}

.sidebar-tenant-bar .btn-exit:hover {
    color: #fff;
    background: #2d3f55;
}

/* ── Sidebar footer ─────────────────────────────────────────── */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid #2d3f55;
}

.sidebar-footer-langs {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem 1rem;
    border-bottom: 1px solid #2d3f55;
}

.lang-btn {
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .45rem;
    border-radius: .25rem;
    color: #a8b8cc;
    background: transparent;
    border: 1px solid #2d3f55;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    transition: background .2s, color .2s, border-color .2s;
    display: inline-flex;
    align-items: center;
    gap: .2rem;
}

.lang-btn:hover {
    background: #2d3f55;
    color: #fff;
    border-color: #2d3f55;
}

.lang-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.sidebar-footer-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1.25rem;
}

.sidebar-footer-user .bi-person-circle {
    font-size: 1.3rem;
    color: #5a7a9a;
    flex-shrink: 0;
}

.sidebar-footer-user .user-info {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.sidebar-footer-user .user-name {
    color: #e2e8f0;
    font-size: .84rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-user .user-role {
    color: #5a7a9a;
    font-size: .72rem;
}

#sidebar .nav-link {
    color: #a8b8cc;
    padding: .4rem 1.25rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .85rem;
    transition: background .2s, color .2s;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
}

#sidebar .nav-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5a7a9a;
    padding: .75rem 1.25rem .25rem;
}

/* ── Layout principal ───────────────────────────────────────── */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
#topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

/* ── Contenido de página ────────────────────────────────────── */
.page-content {
    padding: 1.75rem;
    flex: 1;
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
    border: none;
    border-radius: .75rem;
}

.stat-card .card-body {
    padding: 1.25rem 1.5rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ── Dark theme ─────────────────────────────────────────────── */
[data-bs-theme="dark"] body {
    background: #111827;
}

[data-bs-theme="dark"] #sidebar {
    background: #0d1520;
    border-right: 1px solid #1a2840;
}

[data-bs-theme="dark"] #sidebar .sidebar-brand {
    background: #060d17;
    border-bottom-color: #1a2840;
}

[data-bs-theme="dark"] .sidebar-tenant-bar {
    background: #0a1422;
    border-bottom-color: #1a2840;
}

[data-bs-theme="dark"] .sidebar-footer {
    border-top-color: #1a2840;
}

[data-bs-theme="dark"] .sidebar-footer-langs {
    border-bottom-color: #1a2840;
}

[data-bs-theme="dark"] .lang-btn {
    border-color: #1a2840;
}

[data-bs-theme="dark"] #topbar {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] #topbar .text-secondary,
[data-bs-theme="dark"] #topbar .text-muted {
    color: #94a3b8 !important;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
    }
}
