﻿/* =========================
   LOKER'S - Inicio Layout
   Responsive sidebar + topbar
   ========================= */

:root {
    --bg: #0b1220;
    --panel: rgba(255,255,255,.06);
    --panel2: rgba(255,255,255,.08);
    --border: rgba(255,255,255,.10);
    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.70);
    --muted2: rgba(255,255,255,.55);
    --card: rgba(255,255,255,.08);
    --shadow: 0 16px 50px rgba(0,0,0,.35);
    --accent: #4ea1ff;
    --accent2: #7cc1ff;
    --ok: #25c26e;
    --warn: #ffc107;
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-w: 280px;
    --topbar-h: 68px;
}

/* ✅ Fix global overflow */
html, body {
    width: 100%;
    overflow-x: hidden;
}

/* ✅ IMPORTANTE: usar minmax(0,1fr) para que el main pueda encogerse */
.inicio-shell {
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    background: radial-gradient(900px 500px at 20% 0%, rgba(78,161,255,.25), transparent 60%), radial-gradient(700px 400px at 90% 10%, rgba(124,193,255,.18), transparent 55%), linear-gradient(180deg, #0a0f1c, #070b14);
    color: var(--text);
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    position: relative;
}

/* =========================
   BACKDROP (móvil)
   ========================= */
.inicio-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(5px);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

/* =========================
   SIDEBAR
   ========================= */
.inicio-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
    background: rgba(255,255,255,.05);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 18px;
    background: linear-gradient(135deg, rgba(78,161,255,.35), rgba(124,193,255,.18));
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.brand-title {
    font-weight: 900;
    letter-spacing: .6px;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted2);
    margin-top: 2px;
}

.sidebar-nav {
    padding: 14px 10px;
    overflow: auto;
}

.nav-section {
    font-size: 11px;
    color: var(--muted2);
    letter-spacing: 1px;
    padding: 10px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

    .nav-item:hover {
        background: rgba(255,255,255,.06);
        border-color: rgba(255,255,255,.10);
    }

    .nav-item:active {
        transform: translateY(1px);
    }

    .nav-item.active {
        background: linear-gradient(135deg, rgba(78,161,255,.22), rgba(124,193,255,.10));
        border-color: rgba(78,161,255,.28);
    }

.nav-ico {
    width: 26px;
    display: inline-flex;
    justify-content: center;
    opacity: .95;
}

.nav-text {
    flex: 1;
    font-weight: 700;
    font-size: 14px;
}

.nav-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--muted);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 12px;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.12);
}

.user-name {
    font-weight: 800;
    font-size: 13px;
}

.user-role {
    font-size: 12px;
    color: var(--muted2);
}

.btn-logout {
    width: 100%;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
}

    .btn-logout:hover {
        background: rgba(255,255,255,.09);
    }

/* =========================
   MAIN + TOPBAR
   ========================= */
.inicio-main {
    display: grid;
    grid-template-rows: var(--topbar-h) 1fr auto;
    min-height: 100vh;
    min-width: 0;
}

.inicio-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    min-width: 0;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    flex: 0 0 auto;
}

    .btn-icon:hover {
        background: rgba(255,255,255,.09);
    }

.topbar-title {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.topbar-h1 {
    font-weight: 900;
    line-height: 1.05;
}

.topbar-h2 {
    font-size: 12px;
    color: var(--muted2);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    min-width: 260px;
}

.search-ico {
    opacity: .8;
}

.search-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
}

    .search-input::placeholder {
        color: rgba(255,255,255,.55);
    }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    min-width: 0;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    background: linear-gradient(135deg, rgba(78,161,255,.25), rgba(124,193,255,.12));
    border: 1px solid rgba(255,255,255,.14);
    flex: 0 0 auto;
}

.topbar-userinfo {
    min-width: 0;
}

.topbar-username {
    font-weight: 900;
    font-size: 13px;
    line-height: 1.0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.topbar-userrole {
    font-size: 12px;
    color: var(--muted2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.inicio-content {
    padding: 16px;
    min-width: 0;
}

.inicio-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    color: var(--muted2);
    background: rgba(255,255,255,.03);
}

/* =========================
   COLLAPSE SIDEBAR (Desktop)
   ========================= */
.inicio-shell.sidebar-closed {
    grid-template-columns: 92px minmax(0, 1fr);
}

    .inicio-shell.sidebar-closed .brand-text,
    .inicio-shell.sidebar-closed .nav-text,
    .inicio-shell.sidebar-closed .nav-badge,
    .inicio-shell.sidebar-closed .user-info,
    .inicio-shell.sidebar-closed .btn-logout span:last-child {
        display: none;
    }

    .inicio-shell.sidebar-closed .sidebar-brand {
        justify-content: center;
    }

    .inicio-shell.sidebar-closed .nav-item {
        justify-content: center;
    }

    .inicio-shell.sidebar-closed .user-mini {
        justify-content: center;
    }

/* =========================
   RESPONSIVE (Mobile)
   ========================= */
@media (max-width: 980px) {
    .search-box {
        display: none;
    }
}

/* ✅ Topbar ultra responsive */
@media (max-width: 560px) {
    .inicio-topbar {
        gap: 10px;
        padding: 10px 10px;
    }

    .topbar-userinfo {
        display: none;
    }

    .topbar-user {
        padding: 8px 8px;
        border-radius: 14px;
    }
}

@media (max-width: 860px) {
    .inicio-shell {
        grid-template-columns: 1fr;
    }

    .inicio-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-w);
        transform: translateX(-105%);
        transition: transform .18s ease;
        box-shadow: var(--shadow);
    }

    .inicio-shell.sidebar-open .inicio-sidebar {
        transform: translateX(0);
    }

    .inicio-shell.sidebar-open .inicio-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .inicio-shell.sidebar-closed {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   ✅ DASHBOARD UI (base) - necesario para que el full-width funcione bien
   ===================================================== */

.dash {
    display: grid;
    gap: 16px;
}

.dash-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.dash-title {
    margin: 0;
    font-weight: 900;
    letter-spacing: .2px;
}

.dash-subtitle {
    margin-top: 4px;
    color: var(--muted2);
    font-size: 13px;
}

.dash-actions {
    display: flex;
    gap: 10px;
}

.dash-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
}

    .dash-btn:hover {
        background: rgba(255,255,255,.09);
    }

.dash-btn-primary {
    background: linear-gradient(135deg, rgba(78,161,255,.28), rgba(124,193,255,.12));
    border-color: rgba(78,161,255,.28);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.05);
    padding: 12px 12px;
    box-shadow: var(--shadow);
}

.kpi-top {
    display: flex;
    gap: 10px;
    align-items: center;
}

.kpi-ico {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
}

.kpi-label {
    color: var(--muted2);
    font-size: 12px;
    font-weight: 800;
}

.kpi-value {
    font-weight: 900;
    font-size: 18px;
    margin-top: 2px;
}

.kpi-foot {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.kpi-badge {
    font-size: 11px;
    font-weight: 900;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.08);
}

    .kpi-badge.ok {
        color: #25c26e;
        border-color: rgba(37,194,110,.25);
        background: rgba(37,194,110,.10);
    }

    .kpi-badge.warn {
        color: #ffc107;
        border-color: rgba(255,193,7,.25);
        background: rgba(255,193,7,.10);
    }

    .kpi-badge.info {
        color: rgba(124,193,255,.95);
        border-color: rgba(124,193,255,.25);
        background: rgba(124,193,255,.10);
    }

.kpi-muted {
    color: var(--muted2);
    font-size: 12px;
}

/* Grid principal del dashboard */
.dash-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 12px;
    align-items: start;
    grid-auto-flow: row dense; /* ✅ ayuda a que el full-width se ubique bien */
}

@media (max-width: 1100px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel base */
.panel {
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.05);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.03);
}

.panel-title {
    font-weight: 900;
}

.panel-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted2);
}

.link-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.12);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
}

    .link-btn:hover {
        background: rgba(255,255,255,.06);
    }

.quick-grid {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 560px) {
    .quick-grid {
        grid-template-columns: 1fr;
    }
}

.quick-card {
    text-decoration: none;
    color: var(--text);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.04);
    padding: 12px 12px;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
}

    .quick-card:hover {
        background: rgba(255,255,255,.06);
        border-color: rgba(78,161,255,.25);
    }

.quick-ico {
    font-size: 18px;
    opacity: .95;
}

.quick-title {
    margin-top: 10px;
    font-weight: 900;
}

.quick-sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted2);
}

/* =====================================================
   ✅ TURNOS (solo esta section) - FULL WIDTH + UI PRO
   Se aplica únicamente al <section class="panel mt-4"> de Turnos
   ===================================================== */

.dash-grid > .panel.mt-4 {
    grid-column: 1 / -1; /* ✅ full width */
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    box-shadow: 0 18px 60px rgba(0,0,0,.35);
    overflow: hidden;
}

    .dash-grid > .panel.mt-4 .panel-head {
        padding: 14px 16px;
        border-bottom: 1px solid rgba(255,255,255,.10);
        background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
    }

    .dash-grid > .panel.mt-4 .panel-title {
        font-weight: 900;
        letter-spacing: .2px;
    }

    .dash-grid > .panel.mt-4 .panel-sub {
        color: rgba(255,255,255,.62);
    }

    .dash-grid > .panel.mt-4 .table-wrap {
        margin-top: 0;
        overflow-x: auto;
    }

        .dash-grid > .panel.mt-4 .table-wrap::-webkit-scrollbar {
            height: 10px;
        }

        .dash-grid > .panel.mt-4 .table-wrap::-webkit-scrollbar-track {
            background: rgba(255,255,255,.04);
        }

        .dash-grid > .panel.mt-4 .table-wrap::-webkit-scrollbar-thumb {
            background: rgba(255,255,255,.16);
            border-radius: 999px;
        }

            .dash-grid > .panel.mt-4 .table-wrap::-webkit-scrollbar-thumb:hover {
                background: rgba(255,255,255,.24);
            }

    .dash-grid > .panel.mt-4 .lk-table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        min-width: 980px;
    }

        .dash-grid > .panel.mt-4 .lk-table thead th {
            position: sticky;
            top: 0;
            z-index: 2;
            padding: 12px 14px;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: .6px;
            color: rgba(255,255,255,.78);
            background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05));
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255,255,255,.12);
            white-space: nowrap;
        }

        .dash-grid > .panel.mt-4 .lk-table td {
            padding: 12px 14px;
            border-bottom: 1px solid rgba(255,255,255,.06);
            font-size: 13px;
            color: rgba(255,255,255,.90);
            white-space: nowrap;
        }

        .dash-grid > .panel.mt-4 .lk-table tbody tr:nth-child(odd) {
            background: rgba(255,255,255,.02);
        }

        .dash-grid > .panel.mt-4 .lk-table tbody tr:hover {
            background: rgba(78,161,255,.08);
        }

    .dash-grid > .panel.mt-4 .text-right {
        text-align: right;
    }

    .dash-grid > .panel.mt-4 .text-center {
        text-align: center;
    }

    .dash-grid > .panel.mt-4 .badge-status {
        padding: 6px 10px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 900;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

        .dash-grid > .panel.mt-4 .badge-status::before {
            content: "";
            width: 7px;
            height: 7px;
            border-radius: 99px;
            display: inline-block;
        }

        .dash-grid > .panel.mt-4 .badge-status.activo {
            background: rgba(37,194,110,.14);
            color: #25c26e;
            border: 1px solid rgba(37,194,110,.28);
        }

            .dash-grid > .panel.mt-4 .badge-status.activo::before {
                background: #25c26e;
            }

        .dash-grid > .panel.mt-4 .badge-status.cerrado {
            background: rgba(255,193,7,.14);
            color: #ffc107;
            border: 1px solid rgba(255,193,7,.28);
        }

            .dash-grid > .panel.mt-4 .badge-status.cerrado::before {
                background: #ffc107;
            }

.empty-table {
    text-align: center;
    padding: 18px 14px;
    color: rgba(255,255,255,.60);
}
