/*
 * ==========================================================================
 * APP LAYOUT VARIABLES - Recruiter-specific shell dimensions
 * ==========================================================================
 * These are app-level structural decisions. A different app in the
 * monorepo might have completely different values (or no sidebar at all).
 * Shared design tokens (radii, transitions) live in packages/ui/styles/layout.css.
 * ==========================================================================
 */
:root {
    /* Layout Dimensions (rem-based for density scaling) */
    --sidebar-width: 16.25rem;           /* 260px */
    --sidebar-collapsed-width: 4.5rem;   /* 72px */
    --header-height: 4.5rem;             /* 72px */
    --help-pane-width: 22.5rem;          /* 360px */
}

/*
 * ==========================================================================
 * LAYOUT.CSS - Core Layout Styles (rem-based for density scaling)
 * ==========================================================================
 * This file contains layout-only styles:
 * - Sidebar navigation
 * - Main content area
 * - Header
 * - Content grids
 * - Page structure
 * - Animations
 * - Responsive breakpoints
 *
 * All dimensions use rem units for density control via root font-size.
 * Conversion formula: px / 16 = rem
 *
 * Component styles are now in /assets/css/components/*.css
 * Import via /assets/css/ui.css
 * ==========================================================================
 */

/* ========================================
   MAIN CONTENT
   ======================================== */

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
    overflow-x: hidden;
    position: relative;
}

body.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
}

/* ========================================
   HEADER
   ======================================== */

.header {
    height: var(--header-height);
    padding: 0 2rem; /* 0 32px */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-base);
    position: sticky;
    top: 0;
    z-index: 50;
}

.greeting {
    display: flex;
    align-items: center;
    gap: 1rem; /* 16px */
}

.greeting-icon {
    width: 2.75rem; /* 44px */
    height: 2.75rem;
    border-radius: 0.75rem; /* 12px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* 24px */
}

.greeting-icon svg {
    width: 1.5rem; /* 24px */
    height: 1.5rem;
    color: white;
}

.greeting-text h1 {
    font-family: var(--font-display);
    font-size: 1.5rem; /* 24px */
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.greeting-text p {
    font-size: 0.875rem; /* 14px */
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 12px */
}

.header-btn {
    width: 2.5rem; /* 40px */
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
}

.header-btn:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.header-btn svg {
    width: 1.25rem; /* 20px */
    height: 1.25rem;
}

.notification-indicator {
    position: absolute;
    top: 0.5rem; /* 8px */
    right: 0.5rem;
    width: 0.5rem; /* 8px */
    height: 0.5rem;
    background: var(--accent-terracotta);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* Header button count badge (notification count overlay) */
.header-btn .count-badge {
    position: absolute;
    top: -0.25rem; /* -4px */
    right: -0.25rem;
    min-width: 1.125rem; /* 18px */
    height: 1.125rem;
    padding: 0 0.25rem; /* 4px */
    font-size: 0.6875rem; /* 11px */
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5625rem; /* 9px - half of height */
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: 2px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem; /* 10px */
    padding: 0.625rem 1rem; /* 10px 16px */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 17.5rem; /* 280px */
    transition: all 0.2s ease;
}

.search-bar:focus-within {
    border-color: var(--accent-terracotta);
    box-shadow: 0 0 0 0.1875rem var(--accent-terracotta-light); /* 3px */
}

.search-bar svg {
    width: 1.125rem; /* 18px */
    height: 1.125rem;
    color: var(--text-muted);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 0.9375rem; /* 15px */
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-shortcut {
    font-size: 0.6875rem; /* 11px */
    font-weight: 600;
    padding: 0.1875rem 0.375rem; /* 3px 6px */
    background: var(--bg-base);
    border-radius: 0.25rem; /* 4px */
    color: var(--text-muted);
}

/* ========================================
   THEME SWITCHER POPOVER
   ======================================== */

.theme-switcher-popover {
    position: relative;
}

.theme-panel {
    padding: 0.75rem;
    min-width: 220px;
}

.theme-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-panel-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.125rem;
}

.theme-panel-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.5rem 0;
}

/* Theme swatches grid */
.theme-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: none;
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.theme-option:hover {
    transform: scale(1.08);
}

.theme-option.active {
    border-color: var(--accent-primary);
}

.theme-swatch {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: calc(var(--radius-md) - 2px);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0.25rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.theme-swatch-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Font options list */
.font-options {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.font-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.font-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.font-option.active {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    font-weight: 600;
}

.font-option-preview {
    font-size: 1rem;
    width: 1.5rem;
    text-align: center;
    font-weight: 700;
    color: inherit;
}

.font-option-name {
    white-space: nowrap;
}

/* ========================================
   CONTENT AREA
   ======================================== */

.page-content {
    padding: 2rem; /* 32px */
}

/* Table page variant - full height with flexbox for scrollable tables */
.page-content--table {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    padding: 1.5rem 2rem; /* 24px 32px */
    gap: 1.25rem; /* 20px */
}

/* Regulations page variant - no top padding (has sticky toolbar above) */
.page-content--regulations {
    padding: 0 2rem 2rem; /* 0 32px 32px */
}

/* Settings page layout - sidebar + content, no padding */
.page-content.settings-layout {
    display: flex;
    gap: 0;
    padding: 0;
    max-width: none;
    min-height: calc(100vh - var(--header-height));
}

/* Client detail layout - full height flex with sticky header zone */
.page-content.client-detail {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    padding: 0;
    max-width: none;
    overflow: hidden;
}

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem; /* 24px */
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.75rem; /* 28px */
    font-weight: 500;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.9375rem; /* 15px */
    color: var(--text-muted);
    margin-top: 0.5rem; /* 8px */
}

/* ========================================
   CONTENT GRID
   ======================================== */

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem; /* 24px */
}

.content-grid.full-width {
    grid-template-columns: 1fr;
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SECTION HEADER
   ======================================== */

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 12px */
    margin-bottom: 1.5rem; /* 24px */
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem; /* 20px */
    font-weight: 500;
    color: var(--text-primary);
}

.section-badge {
    padding: 0.25rem 0.75rem; /* 4px 12px */
    font-size: 0.75rem; /* 12px */
    font-weight: 600;
    border-radius: 6.25rem; /* 100px */
    background: var(--accent-sage-light);
    color: var(--accent-sage);
}

/* ========================================
   BREADCRUMB
   ======================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px */
    margin-bottom: 1.5rem; /* 24px */
    font-size: 0.875rem; /* 14px */
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent-terracotta);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-0.5rem); } /* -8px */
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(1rem); } /* 16px */
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-1.25rem); opacity: 0; } /* -20px */
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        height: 100vh;
        height: 100dvh; /* dynamic viewport height for mobile address bar */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* main doesn't scroll — #main-content does */
    }

    #main-content {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: 4.5rem; /* space for bottom nav */
    }

    .desktop-only {
        display: none;
    }

    .header {
        padding: 0 1rem; /* 16px */
    }

    .search-bar {
        display: none;
    }

    .page-content {
        padding: 1rem; /* 16px */
    }

    .page-content--table {
        padding: 1rem; /* 16px */
        height: auto; /* override calc(100vh - header) — let .main handle scroll */
    }

    .page-content--regulations {
        padding: 0 1rem 1rem; /* 0 16px 16px */
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-terracotta);
    outline-offset: 0.125rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
