/* Base styles for djust scaffold project
 * Colors use djust-theming CSS variables exclusively (hsl(var(--name)) pattern).
 * Do not add hardcoded hex colors — use the theming tokens instead.
 *
 * Component styles (buttons, badges, cards, modals, tabs, spinners, forms)
 * are provided by djust-components and djust-theming — do NOT duplicate here.
 */

/* No :root fallbacks here — djust-theming provides all CSS custom properties
 * via inline <style> in <head>. Defining them here would override theme values
 * because external CSS loads after inline styles.
 *
 * If djust-theming is NOT installed, vars like --font-sans will be undefined.
 * Usage sites should include fallbacks: var(--font-sans, system-ui, sans-serif)
 */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans, system-ui, sans-serif);
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    line-height: var(--leading-body, 1.6);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Container ─────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
    background: hsl(var(--surface-2, var(--background)) / var(--navbar-opacity, 1));
    border-bottom: 1px solid hsl(var(--border));
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
    backdrop-filter: blur(var(--glass-blur, 0px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 0px));
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    font-size: 1.125rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-family: var(--font-sans, system-ui, sans-serif);
}

.navbar-logo:hover { text-decoration: none; color: hsl(var(--foreground)); }

.logo-mark {
    color: hsl(var(--brand, var(--primary)));
    font-family: var(--font-mono, ui-monospace, monospace);
    font-weight: 700;
    font-size: 0.95em;
}

.logo-brand {
    color: hsl(var(--brand, var(--primary)));
    font-weight: 800;
}

.logo-sub {
    color: hsl(var(--muted-foreground));
    font-weight: 400;
}

.logo-project {
    color: hsl(var(--brand, var(--primary)) / 0.7);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-weight: 400;
    font-size: 0.85em;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.navbar-item {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--duration-normal, 0.2s);
}

.navbar-item:hover {
    color: hsl(var(--foreground));
    text-decoration: none;
}

/* ── Main Content ───────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding-bottom: var(--section-spacing, 2.5rem);
}

/* Pages without a hero need top padding — add .main-padded to the content wrapper */
.main-padded {
    padding-top: var(--section-spacing, 2.5rem);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
    background: hsl(var(--surface-1, var(--muted)));
    border-top: var(--border-width, 1px) solid hsl(var(--border));
    padding: 1.5rem 0;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: var(--text-sm, 0.875rem);
}

.footer a {
    color: hsl(var(--link));
    text-decoration: none;
}

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

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: hsl(var(--foreground));
    font-family: var(--font-display, var(--font-sans, system-ui, sans-serif));
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: 0.75rem; }

a {
    color: hsl(var(--link));
    text-decoration: none;
}

a:hover {
    color: hsl(var(--link-hover));
    text-decoration: underline;
}

/* ── Grid ────────────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--grid-gap, 1.5rem); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Flash Messages ──────────────────────────────────────────────────────────── */
.messages:has(.message) { margin-bottom: 1.5rem; }

.message {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border: 1px solid;
    font-size: 0.875rem;
}

.message-success {
    background: hsl(var(--success) / 0.1);
    border-color: hsl(var(--success) / 0.3);
    color: hsl(var(--success));
}

.message-error {
    background: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
}

.message-warning {
    background: hsl(var(--warning) / 0.1);
    border-color: hsl(var(--warning) / 0.3);
    color: hsl(var(--warning));
}

.message-info {
    background: hsl(var(--info) / 0.1);
    border-color: hsl(var(--info) / 0.3);
    color: hsl(var(--info));
}

/* ── Code ────────────────────────────────────────────────────────────────────── */
code {
    font-family: var(--font-mono, ui-monospace, monospace);
    background: hsl(var(--code));
    color: hsl(var(--code-foreground));
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

pre {
    background: hsl(var(--code, var(--muted)));
    color: hsl(var(--code-foreground, var(--foreground)));
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

pre code { background: none; padding: 0; color: inherit; }


/* ── Accessibility ───────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: hsl(var(--muted-foreground)); }
.text-small   { font-size: 0.875rem; }

.mt-1 { margin-top: 0.5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }  .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }

.section-gap  { margin-top: var(--section-spacing, 2rem); }
.list-spaced  { padding-left: 1.25rem; line-height: 2; }

.flex         { display: flex; }
.flex-center  { display: flex; flex-direction: row; justify-content: center; align-items: center; }
.flex-between { display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
.card-header.flex-between { flex-direction: row; }
.gap-1 { gap: 0.5rem; }  .gap-2 { gap: 1rem; }  .gap-3 { gap: 1.5rem; }

/* ── Stat display (large number + label pattern) ────────────────────────────── */
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: hsl(var(--foreground));
}

.stat-value-primary { color: hsl(var(--primary)); }
.stat-value-success { color: hsl(var(--success)); }
.stat-value-lg      { font-size: 3.5rem; }
.stat-value-xl      { font-size: var(--text-4xl, 3.5rem); }

/* ── Status text helpers ────────────────────────────────────────────────────── */
.text-success { color: hsl(var(--success)); }
.text-primary { color: hsl(var(--primary)); }
.text-danger  { color: hsl(var(--destructive)); }

/* ── Layout helpers ─────────────────────────────────────────────────────────── */
.w-full  { width: 100%; }
.flex-1  { flex: 1; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ── Auth layout ─────────────────────────────────────────────────────────────── */
.auth-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

/* ── Pulsing live indicator ──────────────────────────────────────────────────── */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--success)); display: inline-block; animation: live-pulse calc(var(--duration-slow, 0.3s) * 6) infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ── Feature icon block ──────────────────────────────────────────────────────── */
.feature-icon { width: 2.5rem; height: 2.5rem; border-radius: var(--radius); background: hsl(var(--primary) / 0.1); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; margin-bottom: 0.75rem; }

/* ── Card accent variants ────────────────────────────────────────────────────── */
.card-accent { border-left: var(--border-width, 3px) solid hsl(var(--primary)); }
.card-accent-success { border-left: var(--border-width, 3px) solid hsl(var(--success)); }


/* ── Hero section ────────────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: var(--hero-padding-top, 6rem) 2rem var(--hero-padding-bottom, 4rem);
    position: relative;
    border-bottom: var(--border-width, 1px) solid hsl(var(--border));
    background:
        radial-gradient(ellipse at 50% 0%, var(--gradient-from, hsl(var(--brand, var(--primary)) / 0.06)) 0%, var(--gradient-to, transparent) 70%);
}

.hero h1 {
    font-size: 3.75rem;
    font-weight: var(--font-bold, 900);
    line-height: var(--hero-line-height, 1.05);
    letter-spacing: var(--letter-spacing, -0.03em);
    margin-bottom: 1.5rem;
    color: hsl(var(--foreground));
    max-width: var(--hero-max-width, 56rem);
    margin-left: auto;
    margin-right: auto;
}

.hero h1 .hero-accent {
    color: hsl(var(--brand, var(--primary)));
}

.hero-subtitle {
    font-size: 1.2rem;
    line-height: 1.6;
    color: hsl(var(--muted-foreground));
    max-width: var(--prose-max-width, 540px);
    margin: 0 auto 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .hero { padding: 3rem 1rem 2rem; }
    .hero h1 { font-size: 2.25rem; }
}

/* ── Flash Messages (djust LiveView) ───────────────────────────────────────── */

.dj-flash-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99997;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dj-flash {
    padding: 10px 20px;
    font-family: var(--font-sans, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    animation: dj-flash-slide-in var(--duration-slow, 0.3s) ease-out;
}

.dj-flash-info {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.dj-flash-success {
    background: hsl(var(--success, 142 71% 45%));
    color: hsl(var(--success-foreground, 0 0% 100%));
}

.dj-flash-warning {
    background: hsl(var(--warning, 38 92% 50%));
    color: hsl(var(--warning-foreground, 24 10% 10%));
}

.dj-flash-error {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.dj-flash-removing {
    animation: dj-flash-slide-out var(--duration-slow, 0.3s) ease-in forwards;
}

@keyframes dj-flash-slide-in {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

@keyframes dj-flash-slide-out {
    from { transform: translateY(0);     opacity: 1; }
    to   { transform: translateY(-100%); opacity: 0; }
}

/* ── Layout system (CSS-only switching via data-layout attribute) ───────────── */
.layout-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.layout-sidebar-nav {
    display: none;
}

.layout-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
}

/* Sidebar layout */
.layout-shell[data-layout="sidebar"],
.layout-shell[data-layout="sidebar-topbar"] {
    flex-direction: row;
}

.layout-shell[data-layout="sidebar"] .layout-sidebar-nav,
.layout-shell[data-layout="sidebar-topbar"] .layout-sidebar-nav {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width, 240px);
    background: hsl(var(--surface-2, var(--card)));
    border-right: var(--border-width, 1px) solid hsl(var(--border));
    padding: var(--space-4, 1rem) 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.layout-shell[data-layout="sidebar"] .navbar,
.layout-shell[data-layout="sidebar-topbar"] .layout-sidebar-nav ~ .layout-main .navbar .navbar-brand {
    display: none;
}

.sidebar-brand {
    padding: 0 var(--space-5, 1.25rem);
    margin-bottom: var(--space-6, 1.5rem);
}

.sidebar-brand .navbar-logo {
    font-size: 1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1, 0.25rem);
    padding: 0 var(--space-3, 0.75rem);
    flex: 1;
}

.sidebar-footer {
    padding: var(--space-3, 0.75rem);
    border-top: var(--border-width, 1px) solid hsl(var(--border));
    margin-top: auto;
    position: relative;
}

/* Theme panel pops UP from sidebar footer */
.sidebar-footer .theme-panel-menu {
    bottom: 100%;
    top: auto;
    left: 0;
    right: auto;
    width: var(--sidebar-width, 240px);
    max-height: 70vh;
    overflow-y: auto;
}

/* ── Shared nav links (work in both navbar and sidebar) ────────────────────── */
/* In navbar context: horizontal, inherit navbar styling */
.navbar-menu .nav-link {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--duration-normal, 0.2s);
}

.navbar-menu .nav-link:hover {
    color: hsl(var(--foreground));
    text-decoration: none;
}

.navbar-menu .nav-link.active {
    color: hsl(var(--foreground));
}

/* In sidebar context: vertical blocks with active background */
.sidebar-nav .nav-link {
    display: block;
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    border-radius: var(--radius-md, 6px);
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: var(--text-sm, 0.875rem);
    font-weight: 500;
    transition: all var(--duration-fast, 0.15s) var(--ease-out, ease-out);
}

.sidebar-nav .nav-link:hover {
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
    text-decoration: none;
}

.sidebar-nav .nav-link.active {
    background: hsl(var(--brand, var(--primary)) / 0.1);
    color: hsl(var(--brand, var(--primary)));
    font-weight: 600;
}

/* ── Dashboard grid layout — wide, dense, data-focused ─────────────────────── */
.layout-shell[data-layout="dashboard"] .main-content .container {
    max-width: 100%;
    padding: 0 var(--space-4, 1rem);
}

.layout-shell[data-layout="dashboard"] .hero {
    padding-top: var(--space-6, 1.5rem);
    padding-bottom: var(--space-4, 1rem);
    border-bottom: none;
}

.layout-shell[data-layout="dashboard"] .hero h1 {
    font-size: 2rem;
}

.layout-shell[data-layout="dashboard"] .hero-subtitle {
    display: none;
}

.layout-shell[data-layout="dashboard"] .hero-actions {
    display: none;
}

.layout-shell[data-layout="dashboard"] .grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3, 0.75rem);
}

.layout-shell[data-layout="dashboard"] .grid-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3, 0.75rem);
}

/* ── Centered layout — narrow, reading-focused ─────────────────────────────── */
.layout-shell[data-layout="centered"] .main-content .container {
    max-width: var(--prose-max-width, 40rem);
}

.layout-shell[data-layout="centered"] .hero {
    padding-top: var(--space-8, 2rem);
    padding-bottom: var(--space-6, 1.5rem);
}

.layout-shell[data-layout="centered"] .hero h1 {
    font-size: 2.5rem;
}

.layout-shell[data-layout="centered"] .grid-3,
.layout-shell[data-layout="centered"] .grid-4 {
    grid-template-columns: 1fr;
}

/* ── Topbar layout — compact navbar, no hero, utility feel ─────────────────── */
.layout-shell[data-layout="topbar"] .navbar {
    border-bottom: var(--border-width, 2px) solid hsl(var(--brand, var(--primary)));
}

.layout-shell[data-layout="topbar"] .hero {
    display: none;
}

.layout-shell[data-layout="topbar"] .main-content {
    padding-top: var(--section-spacing, 2rem);
}

/* ── Sidebar+Topbar — sidebar nav + compact topbar header ──────────────────── */
.layout-shell[data-layout="sidebar-topbar"] .navbar {
    padding: 0.5rem 0;
    border-bottom: var(--border-width, 1px) solid hsl(var(--border));
}

.layout-shell[data-layout="sidebar-topbar"] .navbar .navbar-brand {
    display: none;
}

.layout-shell[data-layout="sidebar-topbar"] .hero {
    padding-top: var(--space-8, 2rem);
    padding-bottom: var(--space-6, 1.5rem);
}

/* Responsive: collapse sidebar on mobile */
@media (max-width: 768px) {
    .layout-shell[data-layout="sidebar"],
    .layout-shell[data-layout="sidebar-topbar"] {
        flex-direction: column;
    }
    .layout-shell[data-layout="sidebar"] .layout-sidebar-nav,
    .layout-shell[data-layout="sidebar-topbar"] .layout-sidebar-nav {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: var(--border-width, 1px) solid hsl(var(--border));
    }
    .layout-shell[data-layout="sidebar"] .navbar {
        display: flex;
    }
}

/* ── Noise texture overlay (theme-controlled via --noise-opacity) ──────────── */
/* Uses foreground color so it works on both light (dark dots) and dark (light dots) backgrounds */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--noise-opacity, 0);
    background-image:
        repeating-conic-gradient(hsl(var(--foreground)) 0% 25%, transparent 0% 50%) ,
        repeating-conic-gradient(hsl(var(--foreground)) 0% 25%, transparent 0% 50%) ;
    background-size: 3px 3px, 7px 7px;
    background-position: 0 0, 2px 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NYC Claims — Project-specific styles
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Intake Wizard ──────────────────────────────────────────────────────────── */

.wizard-container {
    max-width: 780px;
    margin: 0 auto;
}

/* Step progress indicator */
.wizard-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    overflow-x: auto;
}

.wizard-step-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.wizard-step-wrap:last-child {
    flex: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    cursor: default;
}

.wizard-step.completed {
    cursor: pointer;
}

.step-number {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid hsl(var(--border));
    background: hsl(var(--background));
    color: hsl(var(--muted-foreground));
    transition: all 0.15s;
    flex-shrink: 0;
}

.wizard-step.active .step-number {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.wizard-step.completed .step-number {
    border-color: hsl(var(--success));
    background: hsl(var(--success));
    color: #fff;
}

.step-title {
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
    max-width: 5rem;
    line-height: 1.2;
    display: none;
}

@media (min-width: 600px) {
    .step-title { display: block; }
}

.wizard-step.active .step-title {
    color: hsl(var(--foreground));
    font-weight: 600;
}

.wizard-step.completed .step-title {
    color: hsl(var(--success));
}

.wizard-connector {
    flex: 1;
    height: 2px;
    background: hsl(var(--border));
    margin: 0 0.25rem;
    margin-bottom: 1.25rem;
    min-width: 1rem;
    transition: background 0.15s;
}

.wizard-connector.completed {
    background: hsl(var(--success));
}

/* Wizard form content */
.wizard-content {
    margin-bottom: 1.5rem;
}

/* Form field errors */
.field-error {
    font-size: 0.8125rem;
    color: hsl(var(--destructive));
    margin-top: 0.25rem;
    display: block;
}

/* Wizard nav buttons */
.wizard-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.wizard-nav .btn-back {
    margin-right: auto;
}

/* ── Form grid utilities ────────────────────────────────────────────────────── */

.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
}

.row.g-3 { gap: 1rem; }
.row.g-2 { gap: 0.75rem; }

.col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-8 {
    grid-column: span 12;
}

@media (min-width: 640px) {
    .col-md-3  { grid-column: span 3; }
    .col-md-4  { grid-column: span 4; }
    .col-md-5  { grid-column: span 5; }
    .col-md-6  { grid-column: span 6; }
    .col-md-8  { grid-column: span 8; }
}

.form-input,
.form-select {
    width: 100%;
}
