﻿/* Main Layout Styles */
:root {
    --sc-header-height: 60px;
}

.sc-main-layout {
    --sc-sidebar-width: 280px;
    --sc-sidebar-collapsed-width: 0px;
}

/* Header Styles */
.sc-header {
    height: var(--sc-header-height);
    background: var(--sc-header-bg, var(--sc-surface));
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(var(--sc-primary-rgb, 59, 130, 246), 0.08);
    z-index: 1100;
    transition: background 0.3s ease;
}

.sc-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    gap: 1rem;
}

.sc-header-left,
.sc-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sc-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sc-space-2, 0.5rem);
    max-width: 600px;
}

/* Logo */
.sc-logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.5rem;
}

.sc-logo {
    width: 36px;
    height: 36px;
}

.sc-brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sc-text-primary);
    letter-spacing: -0.02em;
}

/* Global Search */
.sc-global-search {
    position: relative;
    width: 100%;
    max-width: 480px;
}

.sc-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sc-text-disabled);
    font-size: 1.25rem;
}

.sc-search-input {
    width: 100%;
    padding: 0.625rem 4rem 0.625rem 2.75rem;
    border: 1px solid var(--sc-border);
    border-radius: 8px;
    background: var(--sc-surface-variant);
    font-size: 0.875rem;
    color: var(--sc-text-primary);
    transition: all 0.2s ease;
}

.sc-search-input:focus {
    outline: none;
    border-color: var(--sc-primary-500);
    background: var(--sc-surface);
}

.sc-search-input::placeholder {
    color: var(--sc-text-disabled);
}

.sc-search-shortcut {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.125rem 0.5rem;
    background: var(--sc-surface-variant);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sc-text-secondary);
}

/* Header Icons */
.sc-header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px !important;
}

.sc-notification-wrapper {
    position: relative;
}

.sc-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--sc-danger-500);
    color: var(--sc-text-inverse);
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.sc-header-divider {
    width: 1px;
    height: 32px;
    background: var(--sc-border);
    margin: 0 0.5rem;
}

/* User Menu */
.sc-user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sc-user-menu:hover {
    background: var(--sc-surface-variant);
}

.sc-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--theme-primary-500);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sc-text-inverse);
}

.sc-user-info {
    display: flex;
    flex-direction: column;
}

.sc-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sc-text-primary);
    line-height: 1.2;
}

.sc-user-role {
    font-size: 0.75rem;
    color: var(--sc-text-secondary);
    line-height: 1.2;
}

.sc-user-dropdown-icon {
    color: var(--sc-primary-500);
    font-size: 1.25rem;
}

/* Sidebar Styles */
.sc-sidebar {
    width: var(--sc-sidebar-width);
    background: var(--theme-primary-500);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.sc-sidebar-expanded {
    width: var(--sc-sidebar-width);
}

.sc-sidebar-collapsed {
    width: var(--sc-sidebar-collapsed-width);
}

/* Body/Content Styles */
.sc-body {
    background: var(--sc-body-bg, var(--sc-background));
    color: var(--sc-text-primary);
    min-height: calc(100vh - var(--sc-header-height));
    position: relative;
}

/* Subtle decorative mesh gradient */
.sc-body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(var(--sc-primary-rgb, 59, 130, 246), 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(var(--sc-primary-rgb, 59, 130, 246), 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.sc-content-wrapper {
    /* UI-012: box-sizing must be border-box so padding is included in the 100% width.
       Without this, the wrapper renders at width = parent + 64px of horizontal padding,
       pushing every page's content (and right-edge cards like Staff Directory's
       "Recently Added") past the viewport. */
    box-sizing: border-box;
    padding: var(--sc-space-6) var(--sc-space-8);
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: contentFadeIn 0.4s ease-out;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sc-content-container {
    background: transparent;
}

/* Menu Toggle Button */
.sc-menu-toggle {
    border-radius: 8px !important;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .sc-brand-name {
        display: none;
    }

    .sc-user-info {
        display: none;
    }

    .sc-header-center {
        flex: 0 0 auto;
        max-width: none;
        justify-content: flex-start;
    }

    .sc-global-search {
        display: none;
    }

    .sc-content-wrapper {
        padding: var(--sc-space-4) var(--sc-space-6);
    }
}

@media (max-width: 768px) {
    .sc-header-bar {
        padding: 0 0.5rem;
    }

    .sc-sidebar {
        position: fixed;
        z-index: 999;
        height: calc(100vh - var(--sc-header-height));
        top: var(--sc-header-height);
    }

    .sc-sidebar-collapsed {
        transform: translateX(-100%);
    }

    .sc-content-wrapper {
        padding: var(--sc-space-3);
    }
}

/* Phone: the header has room for the nav trigger, notifications, dark-mode,
   and the user avatar — but not all five action icons + the "Menu" label.
   Hide the non-essential icons (help, layout, settings — all reachable from
   the Settings page / menu) and the menu label so the header fits 360px and
   never forces horizontal page overflow. */
@media (max-width: 480px) {
    .sc-header-right .sc-hide-phone {
        display: none !important;
    }

    .sc-mega-menu-trigger .trigger-text {
        display: none;
    }

    .sc-header-right {
        gap: var(--sc-space-1);
    }

    .sc-header-bar {
        padding: 0 var(--sc-space-2);
    }

    /* The user menu is just the avatar on phone — the name/role is already
       hidden (<=1024) and the dropdown chevron is redundant (tapping the avatar
       opens the menu). Strip its padding so the header fits 360px. */
    .sc-user-menu {
        padding: 0 !important;
        gap: 0 !important;
    }

    .sc-user-dropdown-icon {
        display: none !important;
    }
}

/* The phone overflow: the three icons the bar hides below 480px, behind one button.
   Hidden ABOVE that width, where the icons themselves are on the bar. */
.sc-header-overflow {
    position: relative;
    display: none;
}

.sc-header-overflow-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 13rem;
    z-index: 1200;
}

@media (max-width: 480px) {
    .sc-header-right .sc-phone-only {
        display: block;
    }
}
