/*
 * ==========================================================================
 * 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/pyeza/*.css
 * Import via /assets/css/ui.css
 * ==========================================================================
 */

/* ========================================
   SKIP LINK (accessibility)
   ======================================== */

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: -999;
}

.skip-link:focus {
    position: fixed;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    overflow: visible;
    z-index: var(--z-modal);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    border-radius: 0 0 0.25rem 0;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* ========================================
   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 var(--spacing-4xl); /* 0 32px */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: var(--border-width) solid var(--border-light);
    background: var(--bg-base);
    position: sticky;
    top: 0;
    z-index: 50;
}

.greeting {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg); /* 16px */
}

.greeting-icon {
    width: 2.75rem; /* 44px */
    height: 2.75rem;
    border-radius: var(--radius-lg); /* 12px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-4xl); /* 24px */
}

.greeting-icon svg {
    width: var(--icon-md); /* 24px */
    height: var(--icon-md);
    color: var(--text-inverse);
}

.greeting-text h1 {
    font-family: var(--font-display);
    font-size: var(--text-4xl); /* 24px */
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    line-height: 1.2;
}

.greeting-text p {
    font-size: var(--text-md); /* 14px */
    color: var(--text-muted);
}

/* Inline breadcrumb rendered inside the h1 of the page header.
   Layout: <parent link>  >  <current page title>
   Parent link is muted + underlines on hover; current is the page title. */
.greeting-text h1 .greeting-crumb-parent {
    color: var(--text-muted);
    font-weight: var(--font-weight-normal);
    text-decoration: none;
}

.greeting-text h1 a.greeting-crumb-parent:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Subtitle-as-link (HeaderSubtitleURL) — muted like the crumb parent,
   underlines on hover. */
.greeting-text p a.greeting-subtitle-link {
    color: inherit;
    text-decoration: none;
}

.greeting-text p a.greeting-subtitle-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.greeting-text h1 .greeting-crumb-separator {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    margin: 0 0.25rem; /* 4px */
    vertical-align: -0.125rem; /* nudge the icon to sit on the text baseline */
}

.greeting-text h1 .greeting-crumb-separator svg {
    width: var(--icon-xs, 1rem);
    height: var(--icon-xs, 1rem);
}

.greeting-text h1 .greeting-crumb-current {
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md); /* 12px */
}

.header-btn {
    width: 2.5rem; /* 40px */
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: var(--border-width) solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    position: relative;
}

.header-btn:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.header-btn svg {
    width: var(--icon-sm); /* 20px */
    height: var(--icon-sm);
}

.notification-indicator {
    position: absolute;
    top: var(--spacing-sm); /* 8px */
    right: var(--spacing-sm);
    width: 0.5rem; /* 8px */
    height: 0.5rem;
    background: var(--accent-terracotta);
    border-radius: var(--radius-round);
    border: var(--border-width-thick) 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 var(--spacing-2xs); /* 4px */
    font-size: var(--text-2xs); /* 11px */
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full); /* 9px - half of height */
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: var(--border-width-thick) solid var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem; /* 10px */
    padding: 0.625rem var(--spacing-lg); /* 10px 16px */
    background: var(--bg-card);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-md);
    width: 17.5rem; /* 280px */
    transition: all var(--transition-base);
}

.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: var(--text-base); /* 15px */
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-shortcut {
    font-size: var(--text-2xs); /* 11px */
    font-weight: var(--font-weight-semibold);
    padding: 0.1875rem var(--spacing-xs); /* 3px 6px */
    background: var(--bg-base);
    border-radius: var(--radius-sm); /* 4px */
    color: var(--text-muted);
}

/* ========================================
   THEME SWITCHER POPOVER
   ======================================== */

.theme-switcher-popover {
    position: relative;
}

.theme-panel {
    padding: var(--spacing-md);
    min-width: 220px;
}

.theme-panel-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.theme-panel-title {
    font-size: var(--text-2xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-normal);
    color: var(--text-muted);
    padding: 0 0.125rem;
}

.theme-panel-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--spacing-sm) 0;
}

/* Theme swatches grid */
.theme-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: var(--border-width-thick) 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: var(--spacing-2xs);
    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: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    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: var(--font-weight-semibold);
}

.font-option-preview {
    font-size: var(--text-lg);
    width: var(--icon-md);
    text-align: center;
    font-weight: var(--font-weight-bold);
    color: inherit;
}

.font-option-name {
    white-space: nowrap;
}

/* Axis selectors (density, radius, border) */
.axis-selector {
    display: flex;
    gap: 0.25rem;
}

.axis-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs);
    border: var(--border-width) solid var(--border-light);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.axis-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.axis-option.active {
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Axis option icons — small visual previews */
.axis-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-md);
    height: var(--icon-md);
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

/* Density icons — "Aa" at different sizes */
.axis-option-icon--density-dense { font-size: 0.5625rem; }
.axis-option-icon--density-compact { font-size: 0.6875rem; }
.axis-option-icon--density-default { font-size: 0.8125rem; }
.axis-option-icon--density-comfortable { font-size: 0.9375rem; }

/* Radius icons — small squares with increasing corner rounding */
.axis-option-icon--radius-none,
.axis-option-icon--radius-sm,
.axis-option-icon--radius-default,
.axis-option-icon--radius-lg,
.axis-option-icon--radius-full {
    width: var(--icon-xs);
    height: var(--icon-xs);
    border: 2px solid currentColor;
}

.axis-option-icon--radius-none { border-radius: 0; }
.axis-option-icon--radius-sm { border-radius: 2px; }
.axis-option-icon--radius-default { border-radius: 4px; }
.axis-option-icon--radius-lg { border-radius: 6px; }
.axis-option-icon--radius-full { border-radius: 50%; }

/* Border icons — small squares with varying border weight */
.axis-option-icon--border-none,
.axis-option-icon--border-default,
.axis-option-icon--border-heavy {
    width: var(--icon-xs);
    height: var(--icon-xs);
    background: var(--bg-hover);
}

.axis-option-icon--border-none { border: none; }
.axis-option-icon--border-default { border: 1px solid currentColor; }
.axis-option-icon--border-heavy { border: 3px solid currentColor; }

/* Reset to theme defaults button */
.theme-reset-btn {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-align: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.theme-reset-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========================================
   CONTENT AREA
   ======================================== */

.page-content {
    padding: var(--spacing-4xl); /* 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: var(--spacing-2xl) var(--spacing-4xl); /* 24px 32px */
    gap: var(--spacing-xl); /* 20px */
}

/* Tabbed table page (e.g. Report Cards): the table-card lives inside #tabContent
   BELOW the tabstrip, not as a direct .page-content--table child, so it needs the
   same flex-fill/scroll container the card would otherwise inherit — otherwise the
   card grows to its full content height and the whole page scrolls (pagination
   below the fold). The .table-card inside is already flex:1/min-height:0, so
   making #tabContent a flex column lets it fill the space left by the tabs and
   scroll internally (pagination pinned to the bottom). */
.page-content--table > #tabContent {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Calendar page variant - full height for calendar views (cyta schedule) */
.page-content--calendar {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    padding: var(--spacing-lg) var(--spacing-4xl);
    gap: var(--spacing-md);
}

/* Regulations page variant - no top padding (has sticky toolbar above) */
.page-content--regulations {
    padding: 0 var(--spacing-4xl) var(--spacing-4xl); /* 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: var(--spacing-2xl); /* 24px */
}

.page-title {
    font-family: var(--font-display);
    font-size: var(--text-5xl); /* 28px */
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.page-subtitle {
    font-size: var(--text-base); /* 15px */
    color: var(--text-muted);
    margin-top: var(--spacing-sm); /* 8px */
}

/* ========================================
   CONTENT GRID
   ======================================== */

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl); /* 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: var(--spacing-md); /* 12px */
    margin-bottom: var(--spacing-2xl); /* 24px */
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl); /* 20px */
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.section-badge {
    padding: var(--spacing-2xs) var(--spacing-md); /* 4px 12px */
    font-size: var(--text-xs); /* 12px */
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-full); /* 100px */
    background: var(--accent-sage-light);
    color: var(--accent-sage);
}

/* ========================================
   BREADCRUMB
   ======================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm); /* 8px */
    margin-bottom: var(--spacing-2xl); /* 24px */
    font-size: var(--text-md); /* 14px */
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb a:hover {
    color: var(--accent-terracotta);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

.breadcrumb-link { color: var(--text-link); text-decoration: none; font-size: var(--text-sm); }
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); font-size: var(--text-sm); margin: 0 var(--spacing-xs); }

/* ========================================
   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 var(--spacing-lg); /* 16px */
    }

    .search-bar {
        display: none;
    }

    .page-content {
        padding: var(--spacing-lg); /* 16px */
    }

    .page-content--table {
        padding: var(--spacing-lg); /* 16px */
        height: auto; /* override calc(100vh - header) — let .main handle scroll */
    }

    .page-content--regulations {
        padding: 0 var(--spacing-lg) var(--spacing-lg); /* 0 16px 16px */
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

a:focus-visible,
button:focus-visible {
    outline: var(--border-width-focus) solid var(--border-focus);
    outline-offset: 0.125rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
