/* ====================================================================
   Dashboard Shell (DashboardLayout.razor) — scoped under .app-shell
   so it never affects the public pages still using MainLayout.
   ==================================================================== */

.app-shell {
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 76px;
    --sidebar-bg: #171a25;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.07);
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #7d8598;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.18);
    --content-bg: #f5f6fa;

    display: flex;
    min-height: 100vh;
    background: var(--content-bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Hidden checkbox driving the collapse state — no JS required */
.sidebar-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-toggle-input:checked ~ .sidebar {
    width: var(--sidebar-width-collapsed);
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    color: var(--sidebar-text);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.15rem;
}

    .collapse-btn:hover {
        background: var(--sidebar-bg-hover);
    }

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    overflow: hidden;
}

.brand-logo {
    height: 3rem;
    width: auto;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 0.9rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
    white-space: nowrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.55rem;
    color: var(--sidebar-text) !important;
    text-decoration: none !important;
    white-space: nowrap;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 0.92rem;
}

    .nav-link i {
        font-size: 1.15rem;
        width: 1.4rem;
        text-align: center;
        flex-shrink: 0;
    }

    .nav-link:hover {
        background: var(--sidebar-bg-hover);
        color: #fff !important;
    }

    .nav-link.active {
        background: var(--accent-soft);
        color: #fff !important;
        box-shadow: inset 3px 0 0 var(--accent);
    }

.sidebar-bottom {
    padding: 0.9rem 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--sidebar-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
}

    .user-chip i {
        font-size: 1.3rem;
        flex-shrink: 0;
    }

.logout-form {
    margin: 0;
}

/* Collapsed state: hide all text labels, center icons */
.sidebar-toggle-input:checked ~ .sidebar .nav-label,
.sidebar-toggle-input:checked ~ .sidebar .nav-section-label,
.sidebar-toggle-input:checked ~ .sidebar .user-chip span {
    display: none;
}

.sidebar-toggle-input:checked ~ .sidebar .nav-link,
.sidebar-toggle-input:checked ~ .sidebar .user-chip {
    justify-content: center;
}

.sidebar-toggle-input:checked ~ .sidebar .nav-badge {
    display: none;
}

.sidebar-toggle-input:checked ~ .sidebar .brand-logo {
    height: 1.8rem;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.75rem 2rem;
}

/* Light polish for Bootstrap cards/tables inside the dashboard shell only */
.app-shell .card {
    border: 1px solid #e9eaf0;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.app-shell h3 {
    font-weight: 600;
    color: #1f2430;
}

.app-shell .table thead {
    background: #f8f9fc;
}

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

    .app-shell .btn-primary:hover {
        background-color: #5457d9;
        border-color: #5457d9;
    }

/* Reusable pill tab switcher (SurveyManagement.razor, ManageDrivers.razor) */
.app-shell .dashboard-tabs {
    display: inline-flex;
    gap: 0.25rem;
    background: #eef0f5;
    border-radius: 10px;
    padding: 0.25rem;
}

.app-shell .dashboard-tab-link {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    color: #6c757d;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .app-shell .dashboard-tab-link:hover:not(.active) {
        color: #343a40;
    }

    .app-shell .dashboard-tab-link.active {
        background: #fff;
        color: var(--accent, #6366f1);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }

/* Responsive "stack on mobile" table — avoids horizontal scrolling on phones */
@media (max-width: 768px) {
    .app-shell .table-stack thead {
        display: none;
    }

    .app-shell .table-stack,
    .app-shell .table-stack tbody,
    .app-shell .table-stack tr,
    .app-shell .table-stack td {
        display: block;
        width: 100%;
    }

    .app-shell .table-stack tr {
        margin-bottom: 1rem;
        border: 1px solid #e9eaf0;
        border-radius: 0.5rem;
        padding: 0.5rem;
    }

    .app-shell .table-stack td {
        border: none;
        padding: 0.35rem 0.5rem;
    }

    .app-shell .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        font-size: 0.72rem;
        color: #6c757d;
        text-transform: uppercase;
    }
}

/* On mobile the sidebar is always icon-only — no room for the expanded 240px rail */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width-collapsed);
    }

    .sidebar .nav-label,
    .sidebar .nav-section-label,
    .sidebar .user-chip span {
        display: none;
    }

    .sidebar .nav-link,
    .sidebar .user-chip {
        justify-content: center;
    }

    .sidebar .collapse-btn {
        display: none;
    }

    .brand-logo {
        height: 1.8rem;
    }

    .app-content {
        padding: 1.25rem 1rem;
    }
}


/* ====================================================================
   Dashboard widget cards (DashboardHome.razor) — the whole card is
   clickable via an invisible .stretched-link anchor, and drills into
   the page providing the full data.
   ==================================================================== */
.app-shell .card.clickable-card {
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

    .app-shell .card.clickable-card:hover {
        box-shadow: 0 4px 14px rgba(16, 24, 40, 0.1);
        transform: translateY(-2px);
    }

    .app-shell .card.clickable-card .stretched-link {
        cursor: pointer;
    }

    a.dashboard-widget .card {
        cursor: pointer;
    }

/* ====================================================================
   Notification Badge (NotificationBadge.razor) — simple unread count
   pill shown inline on the "Notificaciones" nav link.
   ==================================================================== */
.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    min-width: 1.2rem;
    text-align: center;
}
