/* Portal Layout - Sidebar + Main Content */

.portal-layout {
    display: flex;
    min-height: 100vh;
    background: var(--surface-secondary);
}

/* --- Sidebar --- */

.portal-sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    font-family: var(--font-sans);
}

.sidebar-logo svg {
    flex-shrink: 0;
}

/* --- Sidebar Navigation --- */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-3);
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: var(--space-4) var(--space-3) var(--space-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.sidebar-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* --- Sidebar Footer --- */

.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
}

.sidebar-org-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Main Content Area --- */

.portal-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Top Bar --- */

.portal-topbar {
    height: 56px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* --- User Menu --- */

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--surface-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: var(--space-2);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: var(--space-2);
    display: none;
    z-index: 200;
}

.user-menu-dropdown.active {
    display: block;
}

.user-menu-dropdown a {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.user-menu-dropdown a:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

/* --- Portal Content --- */

.portal-content {
    flex: 1;
    padding: var(--space-6) 0;
}

/* --- Sidebar Toggle (Mobile) --- */

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* --- Mobile Responsive --- */

@media (max-width: 768px) {
    .portal-sidebar {
        transform: translateX(-100%);
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

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

    .sidebar-toggle {
        display: flex;
    }
}

/* =============================================================================
   AUTH PAGES
   ============================================================================= */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--surface-secondary);
    padding: var(--space-4);
}

.auth-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: var(--space-8);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-6) 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- SSO Buttons --- */

.sso-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-3);
}

.sso-btn:hover {
    background: var(--surface-secondary);
    border-color: var(--text-muted);
}

.sso-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Button Block (full width) --- */

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: 1rem;
}
