/* ============================================================================
   PANEL INSPECTION - "Technical Trust" Design System
   Dark-first, amber accents, electric aesthetic
   ============================================================================ */

/* --------------------------------------------------------------------------
   FONTS
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --------------------------------------------------------------------------
   CSS VARIABLES
   -------------------------------------------------------------------------- */
:root {
    /* Core palette - Dark theme */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --bg-hover: #27272a;

    /* Text colors - high contrast for readability */
    --text-primary: #ffffff;
    --text-secondary: #d4d4d8;
    --text-muted: #a1a1aa;
    --text-inverse: #09090b;

    /* Accent - Electric Amber */
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.4);
    --accent-subtle: rgba(245, 158, 11, 0.1);

    /* Semantic colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --success-glow: rgba(34, 197, 94, 0.3);

    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.12);
    --warning-glow: rgba(234, 179, 8, 0.3);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --danger-glow: rgba(239, 68, 68, 0.3);

    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    /* Borders & Lines */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* Shadows & Glows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px var(--accent-glow);

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 1000;
    --z-toast: 2000;
}

/* Light theme override */
[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #f4f4f5;
    --bg-tertiary: #e4e4e7;
    --bg-elevated: #ffffff;
    --bg-hover: #e4e4e7;

    --text-primary: #09090b;
    --text-secondary: #3f3f46;
    --text-muted: #52525b;
    --text-inverse: #fafafa;

    --accent: #ea580c;
    --accent-light: #f97316;
    --accent-dark: #c2410c;
    --accent-glow: rgba(234, 88, 12, 0.3);
    --accent-subtle: rgba(234, 88, 12, 0.12);

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.12);
    --border-strong: rgba(0, 0, 0, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);

    --success-bg: rgba(34, 197, 94, 0.12);
    --warning-bg: rgba(234, 179, 8, 0.12);
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info-bg: rgba(59, 130, 246, 0.12);
}

/* --------------------------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* Background pattern - circuit board aesthetic */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 25% 25%, var(--accent-subtle) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Grid pattern overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--accent-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    color: var(--text-secondary);
}

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   LAYOUT
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 860px; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

/* Gap */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Margin */
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* Grid */
.grid { display: grid; gap: var(--space-lg); }
.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; }
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Button variants */
.btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn.secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.btn.outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn.outline:hover {
    background: var(--accent-subtle);
}

.btn.contrast {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn.contrast:hover {
    background: #dc2626;
    box-shadow: 0 0 20px var(--danger-glow);
}

.btn.ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
}

.btn.ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: none;
}

/* Button sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
    border-radius: var(--radius-lg);
}

.btn[disabled], .btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   CARDS
   -------------------------------------------------------------------------- */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(12px);
    transition: all var(--duration-base) var(--ease-out);
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.card-elevated {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

/* Status cards */
.card-success { border-left: 3px solid var(--success); }
.card-warning { border-left: 3px solid var(--warning); }
.card-danger { border-left: 3px solid var(--danger); }
.card-info { border-left: 3px solid var(--info); }

/* --------------------------------------------------------------------------
   FORMS & INPUTS
   -------------------------------------------------------------------------- */
input, select, textarea {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all var(--duration-fast) var(--ease-out);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* Checkbox */
input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    content: '';
    width: 0.5rem;
    height: 0.25rem;
    border: 2px solid var(--text-inverse);
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) translateY(-1px);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   BADGES
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* --------------------------------------------------------------------------
   ALERTS
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 3px solid;
    margin-bottom: var(--space-md);
}

.alert-success { background: var(--success-bg); border-left-color: var(--success); }
.alert-warning { background: var(--warning-bg); border-left-color: var(--warning); }
.alert-error { background: var(--danger-bg); border-left-color: var(--danger); }
.alert-info { background: var(--info-bg); border-left-color: var(--info); }

.alert p { margin: 0; color: var(--text-primary); }

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    border-bottom: 1px solid var(--border-default);
}

th {
    text-align: left;
    padding: var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tbody tr {
    transition: background var(--duration-fast);
}

tbody tr:hover {
    background: var(--bg-hover);
}

.clickable-row {
    cursor: pointer;
}

figure:has(table) {
    margin: 0;
    overflow-x: auto;
}

/* --------------------------------------------------------------------------
   PAGINATION
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.pagination span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.pagination-prev, .pagination-next {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--duration-fast);
}

.pagination-prev:hover, .pagination-next:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-prev.disabled, .pagination-next.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   MODAL
   -------------------------------------------------------------------------- */
dialog.modal {
    position: fixed;
    inset: 0;
    margin: auto;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

dialog.modal[open] {
    animation: modal-in var(--duration-base) var(--ease-out);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
}

.modal-small { width: 400px; }
.modal-medium { width: 520px; }
.modal-large { width: 680px; }

dialog.modal > article {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    margin: 0;
    padding: 0;
}

dialog.modal > article > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

dialog.modal > article > header h3 {
    margin: 0;
    font-size: 1.125rem;
}

dialog.modal > article > header .modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

dialog.modal > article > header .modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

dialog.modal > article > main {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

dialog.modal > article > footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* --------------------------------------------------------------------------
   HTMX INDICATOR
   -------------------------------------------------------------------------- */
.htmx-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-indicator::before {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   THEME TOGGLE
   -------------------------------------------------------------------------- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--duration-fast);
}

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

.theme-toggle-icon {
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   JSON VIEWER
   -------------------------------------------------------------------------- */
.json-viewer {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow-x: auto;
}

.jv-key { color: #7dd3fc; }
.jv-string { color: #86efac; }
.jv-number { color: #fcd34d; }
.jv-boolean { color: #f472b6; }
.jv-null { color: var(--text-muted); font-style: italic; }
.jv-bracket, .jv-colon, .jv-comma { color: var(--text-muted); }

.jv-tree { list-style: none; margin: 0; padding: 0; }
.jv-tree .jv-tree { margin-left: 1.25rem; padding-left: var(--space-sm); border-left: 1px dashed var(--border-default); }
.jv-node > summary { cursor: pointer; list-style: none; }
.jv-node > summary::-webkit-details-marker { display: none; }
.jv-node > summary::before { content: '▼'; display: inline-block; width: 1em; font-size: 0.6rem; color: var(--text-muted); margin-right: 0.25rem; }
.jv-node:not([open]) > summary::before { transform: rotate(-90deg); }
.jv-ellipsis { display: none; }
.jv-node:not([open]) .jv-ellipsis { display: inline; }

/* --------------------------------------------------------------------------
   COLLAPSIBLE / EXPANDER
   -------------------------------------------------------------------------- */
details.collapsible {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

details.collapsible summary {
    padding: var(--space-md) var(--space-lg);
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: background var(--duration-fast);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

details.collapsible summary::-webkit-details-marker { display: none; }

details.collapsible summary::after {
    content: '▼';
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform var(--duration-fast);
}

details.collapsible[open] summary::after {
    transform: rotate(180deg);
}

details.collapsible summary:hover {
    background: var(--bg-hover);
}

details.collapsible > :not(summary) {
    padding: var(--space-lg);
}

/* ==========================================================================
   PANEL INSPECTION - LANDING PAGE
   ========================================================================== */

/* Hero Section */
.hero {
    padding: var(--space-3xl) 0 var(--space-xl);
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    animation: hero-in 0.8s var(--ease-out) both;
}

@keyframes hero-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto;
    animation: hero-in 0.8s var(--ease-out) 0.1s both;
}

/* Process Steps */
.process-section {
    padding: var(--space-xl) 0;
}

.process-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.process-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-lg);
    min-width: 140px;
    animation: step-in 0.6s var(--ease-out) both;
}

.process-step:nth-child(1) { animation-delay: 0.2s; }
.process-step:nth-child(3) { animation-delay: 0.3s; }
.process-step:nth-child(5) { animation-delay: 0.4s; }

@keyframes step-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
}

.step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 100%);
    border: 1px solid var(--accent);
    color: var(--accent);
    margin-bottom: var(--space-md);
    transition: all var(--duration-base) var(--ease-out);
    box-shadow: 0 0 20px var(--accent-glow);
}

.process-step:hover .step-icon {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.step-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.step-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.step-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    opacity: 0.4;
}

@media (max-width: 640px) {
    .step-arrow { display: none; }
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl) 0 var(--space-2xl);
    animation: upload-in 0.6s var(--ease-out) 0.5s both;
}

@keyframes upload-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

.upload-section:has(.result-layout) {
    display: block;
}

.upload-form {
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-2xl) var(--space-xl);
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border: 2px solid var(--accent);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(245, 158, 11, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.upload-label::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: var(--radius-xl);
    opacity: 0;
    z-index: -1;
    transition: opacity var(--duration-base);
}

.upload-label::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.2) 0%, transparent 60%);
    pointer-events: none;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 50px rgba(245, 158, 11, 0.25),
        0 0 60px rgba(245, 158, 11, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: var(--accent-light);
}

.upload-label:hover .upload-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 12px var(--accent));
}

.upload-label:hover .upload-text {
    color: var(--accent-light);
}

.upload-label input[type="file"] {
    display: none;
}

.upload-icon {
    color: var(--accent);
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent);
    position: relative;
    z-index: 1;
    transition: color var(--duration-fast);
}

.upload-hint {
    margin-top: var(--space-md);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Subtle pulse animation for upload area */
@keyframes upload-pulse {
    0%, 100% {
        box-shadow:
            0 0 40px rgba(245, 158, 11, 0.15),
            0 0 80px rgba(245, 158, 11, 0),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    50% {
        box-shadow:
            0 0 50px rgba(245, 158, 11, 0.25),
            0 0 80px rgba(245, 158, 11, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

.upload-label {
    animation: upload-pulse 3s ease-in-out infinite;
}

.upload-label:hover {
    animation: none;
}

/* Result Layout */
.result-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: start;
}

@media (max-width: 768px) {
    .result-layout {
        grid-template-columns: 1fr;
    }
}

.upload-preview {
    margin: 0;
}

.upload-preview img {
    width: 100%;
    max-height: 420px;
    border-radius: var(--radius-lg);
    object-fit: contain;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
}

.result-content {
    min-height: 200px;
}

.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    min-height: 200px;
    gap: var(--space-lg);
    position: relative;
}

/* Hide native progress, use custom loader */
.analysis-loading progress {
    display: none;
}

/* Scanner box */
.analysis-loading::before {
    content: '';
    width: 64px;
    height: 64px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    animation: loader-glow 2s ease-in-out infinite;
}

/* Scanning line effect */
.analysis-loading::after {
    content: '';
    position: absolute;
    top: var(--space-2xl);
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: var(--radius-full);
    box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(245, 158, 11, 0.4);
    animation: loader-scan 1.5s ease-in-out infinite;
}

@keyframes loader-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
        border-color: var(--accent);
    }
    50% {
        box-shadow: 0 0 35px rgba(245, 158, 11, 0.4);
        border-color: var(--accent-light);
    }
}

@keyframes loader-scan {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(56px);
        opacity: 0;
    }
}

.analysis-loading p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    animation: text-fade 2s ease-in-out infinite;
    margin: 0;
}

@keyframes text-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Trust Section */
.trust-section {
    padding: var(--space-xl) 0 var(--space-2xl);
}

.trust-section .grid {
    gap: var(--space-lg);
}

.trust-item {
    text-align: center;
    padding: var(--space-lg);
}

.trust-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--accent-subtle);
    color: var(--accent);
    margin-bottom: var(--space-md);
}

.trust-item h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.trust-item p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ==========================================================================
   PANEL INSPECTION - RESULT CARD
   ========================================================================== */
.result-card {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-default);
    overflow: hidden;
    background: var(--bg-elevated);
    animation: result-in 0.5s var(--ease-out);
}

@keyframes result-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
}

.result-card header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.result-card header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.result-card footer {
    padding: var(--space-lg);
    background: var(--bg-tertiary);
}

/* Risk level colors */
.result-green {
    border-color: var(--success);
    box-shadow: 0 0 30px var(--success-glow);
}
.result-green header {
    background: var(--success-bg);
}

.result-yellow {
    border-color: var(--warning);
    box-shadow: 0 0 30px var(--warning-glow);
}
.result-yellow header {
    background: var(--warning-bg);
}

.result-red {
    border-color: var(--danger);
    box-shadow: 0 0 30px var(--danger-glow);
}
.result-red header {
    background: var(--danger-bg);
}

.result-error {
    border-color: var(--danger);
}
.result-error header {
    background: var(--danger-bg);
}

.status-emoji {
    font-size: 1.75rem;
    line-height: 1;
}

/* Result Preview */
.result-preview {
    padding: var(--space-md) var(--space-lg);
}

.preview-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.preview-list {
    margin: 0 0 var(--space-sm) var(--space-lg);
    padding: 0;
    color: var(--text-secondary);
}

.preview-list li {
    margin-bottom: var(--space-xs);
}

.preview-more {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Upsell Block */
.upsell-block {
    text-align: center;
}

.upsell-text {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

/* ==========================================================================
   PANEL INSPECTION - REPORT PAGE
   ========================================================================== */
.report-header {
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-xl);
}

.report-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-xs);
}

/* Risk Summary */
.risk-summary {
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid;
    position: relative;
    overflow: hidden;
}

.risk-summary::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
}

.risk-summary.risk-green {
    border-color: var(--success);
    background: var(--success-bg);
}
.risk-summary.risk-green::before { background: var(--success); }

.risk-summary.risk-yellow {
    border-color: var(--warning);
    background: var(--warning-bg);
}
.risk-summary.risk-yellow::before { background: var(--warning); }

.risk-summary.risk-red {
    border-color: var(--danger);
    background: var(--danger-bg);
}
.risk-summary.risk-red::before { background: var(--danger); }

.risk-summary-content {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
    position: relative;
}

.risk-emoji {
    font-size: 3.5rem;
    line-height: 1;
}

.risk-info { flex: 1; }

.risk-title-large {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1.5rem;
}

.risk-score-display {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

.risk-summary-text {
    margin: 0;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    position: relative;
}

/* Issues Section */
.issues-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
}

.issue-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.issue-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.issue-item:last-child {
    border-bottom: none;
}

.issue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.issue-critical { background: var(--danger); color: white; }
.issue-high { background: #f97316; color: white; }
.issue-medium { background: var(--warning); color: #1a1a1a; }
.issue-low { background: var(--info); color: white; }

.issue-content { flex: 1; }

.issue-description {
    margin: 0;
    color: var(--text-primary);
}

.issue-location {
    margin: var(--space-xs) 0 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Recommendations */
.recommendations-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
}

.recommendations-list {
    margin: 0;
    padding-left: var(--space-lg);
    color: var(--text-secondary);
}

.recommendations-list li {
    margin-bottom: var(--space-sm);
}

/* Checklist */
.checklist-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.checklist-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.checklist-group {
    margin-bottom: var(--space-lg);
}

.checklist-group:last-child {
    margin-bottom: 0;
}

.checklist-group h4 {
    font-size: 0.9375rem;
    margin: 0 0 var(--space-md) 0;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    cursor: pointer;
    transition: color var(--duration-fast);
}

.checklist-item:hover {
    color: var(--text-primary);
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.checklist-item span {
    flex: 1;
    color: var(--text-secondary);
}

/* Report Footer */
.report-footer {
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-xl);
}

/* ==========================================================================
   PANEL INSPECTION - PAYMENT MODAL
   ========================================================================== */
.payment-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: var(--space-sm) 0 0 0;
}

.payment-features-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.payment-features-list li {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    color: var(--text-secondary);
}

.payment-features-list li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

/* ==========================================================================
   PANEL PAGE LAYOUT
   ========================================================================== */
.panel-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.panel-page main {
    flex: 1;
}

.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
}

.panel-footer small {
    color: var(--text-muted);
}

/* ==========================================================================
   ADMIN PAGE LAYOUT
   ========================================================================== */
.admin-page {
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-xl) 0 var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.page-header hgroup {
    margin: 0;
}

.page-header h1 {
    margin: 0 0 var(--space-xs) 0;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.filter-bar > * {
    margin-bottom: 0;
}

.filter-bar select,
.filter-bar input {
    min-width: 160px;
}

/* Definition List */
.definition-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-sm) var(--space-lg);
    margin: 0;
}

.definition-list dt {
    font-weight: 500;
    color: var(--text-muted);
}

.definition-list dd {
    margin: 0;
    color: var(--text-primary);
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color var(--duration-fast);
}

.back-link:hover {
    color: var(--accent);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* Status colors */
.status-completed, .status-active { color: var(--success); }
.status-processing, .status-pending { color: var(--warning); }
.status-failed, .status-error { color: var(--danger); }
.status-archived { color: var(--text-muted); }

/* Required field */
.required { color: var(--danger); }

/* Immediate Actions */
.immediate-actions h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
    color: var(--danger);
}

/* Scrollable */
.scrollable-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Error page */
.error-page {
    max-width: 500px;
    margin: var(--space-3xl) auto;
    text-align: center;
}

.error-page header h1 {
    font-size: 6rem;
    margin: 0;
    color: var(--text-muted);
}

.error-page header p {
    font-size: 1.5rem;
    margin: 0 0 var(--space-md) 0;
}

/* Alpine.js */
[x-cloak] { display: none !important; }

/* ==========================================================================
   QUEUE STATUS - Consistent with result-card design
   ========================================================================== */

/* Pending state for queue */
.result-pending {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    animation: none; /* Disable result-in animation for polling cards */
}

.result-pending header {
    background: var(--accent-subtle);
}

/* Queue indicator (position number circle) */
.queue-indicator {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-glow);
    animation: queue-pulse 2s ease-in-out infinite;
}

.queue-position-num {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-inverse);
}

@keyframes queue-pulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 30px var(--accent-glow), 0 0 50px rgba(245, 158, 11, 0.2);
    }
}

/* Queue header text */
.queue-header-text {
    flex: 1;
}

.queue-header-text h3 {
    margin: 0;
}

.queue-position-label {
    margin: var(--space-xs) 0 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Progress bar container */
.queue-progress-container {
    padding: 0 var(--space-lg) var(--space-lg);
}

.queue-progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.queue-progress-pulse {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Queue hint */
.queue-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0 var(--space-lg) var(--space-lg);
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.queue-live-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: live-blink 2s ease-in-out infinite;
}

@keyframes live-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==========================================================================
   QUEUE READY STATE
   ========================================================================== */

.queue-ready {
    border-color: var(--success);
    box-shadow: 0 0 25px var(--success-glow);
}

.queue-ready header {
    background: var(--success-bg);
}

.queue-indicator-ready {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    box-shadow: 0 0 25px var(--success-glow);
    animation: ready-pulse 1.5s ease-in-out infinite;
}

.queue-indicator-ready svg {
    color: white;
}

@keyframes ready-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 25px var(--success-glow);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 35px var(--success-glow), 0 0 60px rgba(34, 197, 94, 0.3);
    }
}

/* Active progress bar for ready state */
.queue-progress-active {
    background: var(--bg-tertiary);
}

.queue-progress-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--success), transparent);
    animation: progress-pulse 1s ease-in-out infinite;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.section-header h2 {
    margin: 0;
}

/* ==========================================================================
   MOBILE STYLES
   ========================================================================== */
@media (max-width: 480px) {
    /* Modal - bottom sheet style on mobile */
    dialog.modal {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        max-height: 90vh;
        width: 100%;
        margin: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        animation: modal-slide-up var(--duration-base) var(--ease-out);
    }

    @keyframes modal-slide-up {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    dialog.modal > article {
        max-height: 90vh;
    }

    .modal-small,
    .modal-medium,
    .modal-large {
        width: 100%;
    }

    dialog.modal > article > main {
        padding: var(--space-md);
    }

    dialog.modal > article > header {
        padding: var(--space-md);
    }

    /* Buttons - prevent overflow */
    .btn {
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
    }

    .btn-lg {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }

    /* Upsell block */
    .upsell-block {
        padding: 0 var(--space-sm);
    }

    .upsell-block .btn {
        width: 100%;
        text-align: center;
    }

    /* Result card footer */
    .result-card footer {
        padding: var(--space-md);
    }

    /* Modal actions */
    .modal-actions {
        flex-direction: column-reverse;
        gap: var(--space-sm);
    }

    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Payment modal */
    .payment-price {
        font-size: 2rem;
    }

    .payment-features-list li {
        font-size: 0.875rem;
    }
}
