/**
 * Member portal — premium dashboard shell
 * Halar Memon Jamat Family Management System
 */

:root {
    --portal-primary: #0d6efd;
    --portal-sidebar-bg: #111827;
    --portal-sidebar-border: rgba(255, 255, 255, 0.06);
    --portal-sidebar-text: #e5e7eb;
    --portal-sidebar-muted: #9ca3af;
    --portal-sidebar-hover: rgba(255, 255, 255, 0.06);
    --portal-sidebar-active: rgba(13, 110, 253, 0.22);
    --portal-page-bg: #f9fafb;
    --portal-text: #333;
    --portal-topbar-h: 60px;
    --portal-sidebar-w: 250px;
    --portal-card-radius: 12px;
    --portal-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --portal-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
}

html.portal-html {
    height: 100%;
}

body.portal-body {
    margin: 0;
    min-height: 100%;
    background: var(--portal-page-bg);
    color: var(--portal-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.portal-app {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: var(--portal-sidebar-w);
    height: 100vh;
    background: var(--portal-sidebar-bg);
    color: var(--portal-sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--portal-sidebar-border);
    transform: translateX(0);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    overflow: hidden;
}

.portal-sidebar__brand {
    flex-shrink: 0;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--portal-sidebar-border);
}

.portal-sidebar__brand-link {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.35;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    transition: opacity 0.2s ease;
}

.portal-sidebar__brand-link:hover {
    color: #fff;
    opacity: 0.92;
}

.portal-sidebar__brand-link img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

.portal-sidebar__sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--portal-sidebar-muted);
    margin-top: 0.15rem;
}

.portal-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.65rem 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.portal-sidebar__nav::-webkit-scrollbar {
    width: 6px;
}

.portal-sidebar__nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--portal-sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.portal-nav-link .bi {
    font-size: 1.1rem;
    opacity: 0.9;
}

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

.portal-nav-link.is-active {
    background: var(--portal-sidebar-active);
    color: #fff;
    border-left-color: var(--portal-primary);
}

.portal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1030;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.portal-backdrop.is-visible {
    display: block;
    opacity: 1;
}

.portal-main {
    flex: 1;
    margin-left: var(--portal-sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.28s ease;
}

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--portal-topbar-h);
    min-height: var(--portal-topbar-h);
    padding: 0 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff;
    box-shadow: var(--portal-shadow-sm);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.portal-topbar__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.portal-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.portal-sidebar-toggle:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.portal-topbar__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-topbar__right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.portal-welcome {
    font-size: 0.85rem;
    color: #6b7280;
    display: none;
}

@media (min-width: 576px) {
    .portal-welcome {
        display: inline;
    }
}

.portal-welcome strong {
    color: #374151;
    font-weight: 600;
}

.portal-content {
    flex: 1;
    padding: 20px;
    background: var(--portal-page-bg);
}

.portal-content .card {
    border: none;
    border-radius: var(--portal-card-radius);
    box-shadow: var(--portal-shadow-md);
}

.portal-content .card-header {
    background: #fff;
    border-bottom: 1px solid #eef0f3;
    font-weight: 600;
}

.portal-content .btn {
    border-radius: 10px;
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.portal-content .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.35);
}

.portal-content .form-control,
.portal-content .form-select {
    border-radius: 10px;
}

.portal-content .form-control:focus,
.portal-content .form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.portal-content .table thead th {
    background: #f3f4f6;
    font-weight: 600;
    font-size: 0.8rem;
    color: #4b5563;
}

.portal-footer {
    background: #0f172a;
    color: #e5e7eb;
    margin-top: auto;
}

.portal-footer a {
    color: rgba(255, 255, 255, 0.75);
    transition: color 0.2s ease;
}

.portal-footer a:hover {
    color: var(--portal-primary);
}

.portal-footer .text-light-emphasis {
    color: rgba(255, 255, 255, 0.65) !important;
}

.portal-footer h5,
.portal-footer h6 {
    color: #fff;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .portal-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .portal-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    }

    .portal-main {
        margin-left: 0;
    }

    .portal-sidebar-toggle {
        display: inline-flex;
    }

    body.portal-sidebar-open {
        overflow: hidden;
    }
}

@media print {
    .portal-sidebar,
    .portal-backdrop,
    .portal-topbar,
    .portal-sidebar-toggle,
    .no-print {
        display: none !important;
    }

    .portal-main {
        margin-left: 0 !important;
    }

    .portal-content {
        padding: 0 !important;
        background: #fff !important;
    }
}
