/* ============================================================
   components.css — Shared component library
   ------------------------------------------------------------
   Every rule is expressed in var(--app-*) tokens from theme.css
   so all components follow the active light/dark theme.
   ============================================================ */

/* === SHELL ================================================= */
.app-navbar {
    background: var(--app-gradient-navbar);
    box-shadow: var(--app-shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar-brand-logo {
    height: 40px;
    width: auto;
}

.brand-logo {
    height: 40px;
    width: auto;
}

.brand-logo-sm {
    height: 24px;
    width: auto;
}

.app-footer {
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    font-size: 0.85rem;
}

.footer-brand {
    color: var(--app-text-muted);
}

.footer-link {
    color: var(--app-text-muted);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--app-brand);
    text-decoration: underline;
}

/* BETA banner — remove together with the block in layout.html */
.beta-banner {
    background: var(--app-warning-subtle);
    border-bottom: 1px solid var(--app-warning);
    color: var(--app-warning);
    padding: 6px 16px;
    text-align: center;
    font-size: 0.8rem;
}

.theme-toggle-btn {
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    padding: 0.25rem 0.6rem;
    font-size: 0.875rem;
    border-radius: var(--app-radius-sm);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.8);
}

/* Floating variant for standalone public pages (no navbar) */
.theme-toggle-floating {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1040;
}

.theme-toggle-floating .theme-toggle-btn {
    color: var(--app-text-muted);
    border-color: var(--app-border-strong);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.theme-toggle-floating .theme-toggle-btn:hover {
    color: var(--app-brand);
    border-color: var(--app-brand);
    background: var(--app-surface);
}

.dropdown-item[data-theme-value].active,
.dropdown-item[data-theme-value].active:hover {
    background: var(--app-brand);
    color: var(--app-brand-contrast);
}

/* Branded modal header (create-session / view-context modals) */
.modal-header-brand {
    background: var(--app-gradient-brand);
    color: #ffffff;
    border-radius: 0.5rem 0.5rem 0 0;
}

/* === TYPOGRAPHY SCALE ======================================= */
/* Use these instead of ad hoc h3/h4/h5 + fw-bold combinations so
   heading weight/size stays consistent across every page. */
.page-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--app-text);
}

.page-subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--app-text-muted);
    margin-bottom: 0;
}

.section-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--app-text);
}

/* === BREADCRUMB ============================================= */
.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A"; /* › */
    color: var(--app-text-subtle);
}

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

.app-breadcrumb .breadcrumb-item a:hover {
    color: var(--app-brand);
    text-decoration: underline;
}

.app-breadcrumb .breadcrumb-item.active span {
    color: var(--app-text);
    font-weight: 600;
}

/* === EMPTY STATE ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--app-text-muted);
}

.empty-state .empty-state-icon {
    font-size: 2.25rem;
    color: var(--app-text-subtle);
    margin-bottom: 12px;
}

.empty-state .empty-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 4px;
}

.empty-state .empty-state-desc {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* === TOAST =================================================== */
.app-toast {
    background: var(--app-surface);
    color: var(--app-text);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
    border: 1px solid var(--app-border);
    min-width: 280px;
}

/* === PAGE SCAFFOLDING ====================================== */
.page-header {
    padding: 20px 30px;
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
    margin-bottom: 30px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-left: 4px solid var(--app-brand);
}

.card-modern {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-md);
    border: 1px solid var(--app-border);
}

.section-block {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-left: 4px solid var(--app-brand);
    border-radius: var(--app-radius);
    padding: 25px;
    margin-bottom: 25px;
}

.section-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 20px;
}

.sticky-submit {
    position: sticky;
    bottom: 0;
    background: var(--app-surface);
    padding: 15px 20px;
    border-top: 1px solid var(--app-border);
    border-radius: 0 0 var(--app-radius-lg) var(--app-radius-lg);
    text-align: right;
}

.ai-hint {
    background: var(--app-info-subtle);
    border: 1px solid var(--app-info);
    border-radius: var(--app-radius-sm);
    padding: 14px 18px;
    font-size: 0.85rem;
    color: var(--app-info);
}

.form-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--app-border);
}

/* === TABLES ================================================ */
.table-modern thead {
    background: var(--app-surface-2);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-modern thead th {
    background: var(--app-surface-2);
    color: var(--app-text-muted);
    border-bottom: 1px solid var(--app-border);
}

.table-modern td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.action-btn {
    min-width: 80px;
}

/* Row "Actions" cell responsive layout — see fragments/action-menu.html for usage */
.action-cell-outside {
    display: none;
    gap: .25rem;
    align-items: center;
}
.action-cell-mobile {
    display: flex;
}
@media (min-width: 576px) {
    .action-cell-outside { display: flex; }
    .action-cell-mobile  { display: none; }
}

.pagination {
    flex-wrap: wrap;
    gap: 2px;
}

.pagination .page-link {
    border-radius: var(--app-radius-sm) !important;
    margin: 0 3px;
}

/* === HERO / MARKETING ====================================== */
.hero {
    background: var(--app-gradient-brand);
    color: #ffffff;
    border-radius: var(--app-radius-lg);
    padding: 48px 24px;
    text-align: center;
    box-shadow: var(--app-shadow-md);
}

.feature-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--app-shadow-lg);
}

.icon-large {
    font-size: 2rem;
}

.icon-accent {
    color: var(--app-accent);
}

.icon-accent-alt {
    color: var(--app-brand-alt);
}

/* Token-driven button variants (companions to the bridged .btn-primary) */
.btn-accent {
    background-color: var(--app-accent);
    border-color: var(--app-accent);
    color: var(--app-brand-contrast);
}

.btn-accent:hover,
.btn-accent:active,
.btn-accent:focus-visible {
    background-color: var(--app-accent-hover);
    border-color: var(--app-accent-hover);
    color: var(--app-brand-contrast);
}

.btn-accent:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(var(--app-accent-rgb), 0.25);
}

.btn-brand-alt {
    background-color: var(--app-brand-alt);
    border-color: var(--app-brand-alt);
    color: var(--app-brand-contrast);
}

.btn-brand-alt:hover,
.btn-brand-alt:active,
.btn-brand-alt:focus-visible {
    background-color: var(--app-brand-alt-hover);
    border-color: var(--app-brand-alt-hover);
    color: var(--app-brand-contrast);
}

.btn-brand-alt:focus-visible {
    box-shadow: 0 0 0 0.25rem var(--app-focus-ring);
}

/* === NAV CARDS (tenant-management, admin-hub) ============== */
.nav-card {
    background: var(--app-surface);
    border-radius: var(--app-radius-lg);
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-md);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    color: inherit;
    display: block;
    height: 100%;
}

.nav-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-lg);
    color: inherit;
}

.card-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.card-title {
    font-weight: 600;
    font-size: 16px;
}

.card-desc {
    font-size: 13px;
    color: var(--app-text-muted);
}

/* === PERMISSION BADGES (share pages) ======================= */
.permission-badge {
    padding: 3px 10px;
    border-radius: var(--app-radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.badge-view {
    background: var(--app-brand-subtle);
    color: var(--app-brand);
}

.badge-update {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

/* === DASHBOARD METRICS ===================================== */
.card-metric {
    background: var(--app-brand);
    border-radius: var(--app-radius-lg);
    padding: 22px;
    box-shadow: var(--app-shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-metric:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-lg);
}

.metric-title {
    font-size: 14px;
    color: var(--app-brand-contrast);
    opacity: 0.9;
}

.metric-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--app-brand-contrast);
}

.status-badge {
    padding: 4px 10px;
    border-radius: var(--app-radius-pill);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-completed {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.status-progress {
    background: var(--app-warning-subtle);
    color: var(--app-warning);
}

.status-neutral {
    background: var(--app-surface-2);
    color: var(--app-text-muted);
}

/* === RESULTS (interview-result + showcase-result) ========== */
.header-summary {
    background: var(--app-gradient-brand);
    color: #ffffff;
    border-radius: var(--app-radius-lg);
    border: none;
}

.header-summary .divider-top {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.score-display {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.8rem;
    opacity: 0.85;
    letter-spacing: 0.04em;
}

.skill-progress {
    height: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.25);
}

.question-card {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    border: 1px solid var(--app-border);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.question-card:hover {
    box-shadow: 0 4px 16px rgba(var(--app-brand-rgb), 0.12);
}

.question-header {
    background: var(--app-surface-2);
    border-bottom: 1px solid var(--app-border);
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.question-footer {
    background: var(--app-surface-2);
    border-top: 1px solid var(--app-border);
    padding: 10px 16px;
}

.q-number {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-text-muted);
}

.question-text {
    font-size: 0.975rem;
    color: var(--app-text);
    font-style: italic;
    line-height: 1.5;
    background: var(--app-brand-subtle);
    border-left: 3px solid var(--app-brand);
    padding: 10px 14px;
    border-radius: 0 var(--app-radius-sm) var(--app-radius-sm) 0;
    margin-bottom: 16px;
}

.question-preview {
    font-size: 0.8rem;
    color: var(--app-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(420px, 55vw);
}

.collapse-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.question-header[aria-expanded="true"] .collapse-chevron {
    transform: rotate(180deg);
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-bottom: 6px;
}

/* Small uppercase heading over a block (e.g. "Skill Breakdown") */
.overline {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.6;
}

/* De-emphasized footnote text (e.g. "3 question(s)") */
.micro-note {
    font-size: 0.7rem;
    opacity: 0.55;
}

/* Score text tones on the gradient header (do not flip in dark) */
.score-tone-high { color: #ffffff; }
.score-tone-mid  { color: #fde68a; }
.score-tone-low  { color: #fecaca; }

.feedback-answer,
.feedback-eval,
.feedback-strength,
.feedback-improve {
    padding: 12px 14px;
    border-radius: 0 var(--app-radius-sm) var(--app-radius-sm) 0;
    margin-bottom: 12px;
}

.feedback-answer {
    background: var(--app-brand-subtle);
    border-left: 4px solid var(--app-brand);
}

.feedback-eval {
    background: var(--app-surface-2);
    border-left: 4px solid var(--app-text-subtle);
    white-space: pre-line;
}

.feedback-strength {
    background: var(--app-success-subtle);
    border-left: 4px solid var(--app-success);
    white-space: pre-line;
}

.feedback-improve {
    background: var(--app-danger-subtle);
    border-left: 4px solid var(--app-danger);
    white-space: pre-line;
}

.code-block {
    background: var(--app-surface-3);
    color: var(--app-text);
    padding: 10px 12px;
    border-radius: var(--app-radius-sm);
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Score pills — semantic, theme-aware (replaces bg-success/bg-warning
   text-dark/bg-danger/bg-light ternaries that break in dark mode) */
.score-pill {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--app-radius-pill);
    white-space: nowrap;
}

.score-pill-high {
    background: var(--app-score-high);
    color: #ffffff;
}

.score-pill-mid {
    background: var(--app-score-mid);
    color: #ffffff;
}

.score-pill-low {
    background: var(--app-score-low);
    color: #ffffff;
}

[data-bs-theme="dark"] .score-pill-high,
[data-bs-theme="dark"] .score-pill-mid,
[data-bs-theme="dark"] .score-pill-low {
    color: #0f172a;
}

.score-pill-pending {
    background: var(--app-surface-2);
    color: var(--app-text-muted);
    border: 1px solid var(--app-border);
}

/* Progress bar variants matching score semantics */
.bar-high { background-color: var(--app-score-high); }
.bar-mid  { background-color: var(--app-score-mid); }
.bar-low  { background-color: var(--app-score-low); }

/* === AUTH ================================================== */
.auth-wrap {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.auth-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
    padding: 10px;
}

.brand-title {
    font-weight: 600;
    font-size: 22px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--app-text-muted);
}

/* === PLANS / PRICING ======================================= */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    text-align: center;
}

.plan-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-md);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--app-shadow-lg);
}

.plan-card-recommended {
    border: 2px solid var(--app-brand);
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--app-brand);
    color: var(--app-brand-contrast);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: var(--app-radius-pill);
}

.plan-price {
    font-size: 2rem;
    font-weight: 700;
}

.plan-price small {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--app-text-muted);
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    text-align: left;
    flex-grow: 1;
}

.plan-features li {
    padding: 6px 0;
}

.plan-features li::before {
    content: "\2713";
    color: var(--app-brand);
    font-weight: 700;
    margin-right: 8px;
}

/* === PUBLIC PAGES (jobs / showcase) ======================== */
.jd-header {
    background: var(--app-gradient-brand);
    color: #ffffff;
    padding: 40px 0;
}

.jd-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
}

.jd-text {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.95rem;
    color: var(--app-text);
}

.badge-role {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--app-radius-pill);
    font-size: 0.85rem;
}

.file-hint {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

.showcase-card {
    max-width: 680px;
    margin: 0 auto;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(var(--app-brand-rgb), 0.10);
}

.hero-banner {
    background: var(--app-gradient-brand);
    color: #ffffff;
    border-radius: 20px 20px 0 0;
    padding: 2.5rem 2rem 2rem;
}

.hero-banner h1 {
    font-size: 1.65rem;
    font-weight: 700;
}

.hero-banner p {
    opacity: 0.88;
    font-size: 0.97rem;
}

.badge-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 8px;
}

.hint {
    font-size: 0.78rem;
    color: var(--app-text-muted);
}

.submit-btn {
    background: var(--app-gradient-brand);
    border: none;
    border-radius: 10px;
    padding: 12px 32px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.submit-btn:hover {
    opacity: 0.92;
}

.powered-by {
    font-size: 0.75rem;
    color: var(--app-text-subtle);
    text-align: center;
    margin-top: 1.5rem;
}

.footer-note {
    font-size: 0.75rem;
    color: var(--app-text-subtle);
    text-align: center;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.brand-line {
    font-size: 0.85rem;
    opacity: 0.85;
    letter-spacing: 0.04em;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--app-gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--app-brand-subtle);
    color: var(--app-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

/* === SOFT BADGES =========================================== */
.badge-soft-success,
.badge-soft-warning,
.badge-soft-danger,
.badge-soft-info {
    padding: 6px 10px;
    border-radius: var(--app-radius-sm);
}

.badge-soft-success {
    background: var(--app-success-subtle);
    color: var(--app-success);
}

.badge-soft-warning {
    background: var(--app-warning-subtle);
    color: var(--app-warning);
}

.badge-soft-danger {
    background: var(--app-danger-subtle);
    color: var(--app-danger);
}

.badge-soft-info {
    background: var(--app-info-subtle);
    color: var(--app-info);
}

/* === ACCESSIBILITY / RESPONSIVE ============================ */
:focus-visible {
    outline: 2px solid var(--app-brand);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .feature-card,
    .card-metric,
    .question-card,
    .collapse-chevron {
        transition: none;
    }

    .feature-card:hover,
    .card-metric:hover {
        transform: none;
    }
}

@media (max-width: 575.98px) {
    .page-header {
        padding: 16px 18px;
    }

    .page-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .hero {
        padding: 32px 16px;
    }

    .score-display {
        font-size: 2rem;
    }

    .section-block {
        padding: 16px;
        margin-bottom: 16px;
    }

    .card-metric {
        padding: 16px;
    }

    .metric-value {
        font-size: 22px;
    }

    .hero-banner {
        padding: 1.75rem 1.25rem 1.5rem;
    }

    .hero-banner h1 {
        font-size: 1.35rem;
    }

    .jd-header {
        padding: 24px 0;
    }

    .action-btn {
        min-width: 0;
    }
}

/* === PRINT ================================================= */
@media print {
    :root,
    [data-bs-theme="light"],
    [data-bs-theme="dark"] {
        --app-bg: #ffffff;
        --app-surface: #ffffff;
        --app-surface-2: #f3f4f6;
        --app-surface-3: #eef2f7;
        --app-text: #1f2937;
        --app-text-muted: #6b7280;
        --app-text-subtle: #9ca3af;
        --app-border: #e5e7eb;
        --app-border-strong: #d1d5db;
        --app-success: #198754;  --app-success-subtle: #f0fdf4;
        --app-warning: #b45309;  --app-warning-subtle: #fef3c7;
        --app-danger: #dc3545;   --app-danger-subtle: #fff5f5;
        --app-info: #0ea5e9;     --app-info-subtle: #f0f9ff;
        --app-shadow-sm: none;
        --app-shadow-md: none;
        --app-shadow-lg: none;
    }

    .app-navbar,
    .app-footer,
    .beta-banner,
    .theme-toggle-floating,
    .btn,
    form.card,
    .pagination {
        display: none !important;
    }

    .collapse:not(.show) {
        display: block !important;
    }

    .question-card {
        break-inside: avoid;
    }
}
