/**
 * FactExtract Main Stylesheet
 *
 * Complete CSS framework for the application.
 *
 * @see architecture.md Section 6 - CSS Framework
 * @see Job 2.2: CSS Framework
 */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
    /* Colors */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #3b82f6;
    --color-secondary: #64748b;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Neutrals */
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-dark: #f1f5f9;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-dark: #cbd5e1;

    /* 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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Borders */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-tooltip: 400;
}

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

html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

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

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    font-weight: 600;
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
    margin-bottom: var(--space-md);
}

p:last-child {
    margin-bottom: 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--color-bg-alt);
    padding: 0.125em 0.375em;
    border-radius: var(--radius-sm);
}

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

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

.container-md {
    max-width: 768px;
}

.container-lg {
    max-width: 1024px;
}

main.container {
    flex: 1;
    padding-top: var(--space-xl);
    padding-bottom: var(--space-3xl);
}

/* 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;
    }
}

/* Flex */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.main-nav {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

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

.logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.logo:hover {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition-base);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
    align-items: center;
}

.nav-links a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-xs) 0;
    transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-primary);
}

.nav-balance {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-success);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .nav-links.active {
        display: flex;
    }

    .main-nav {
        position: relative;
    }
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    /* Note: background and color are NOT set here to allow Tailwind utilities to work */
    /* Use .btn-primary, .btn-secondary, etc. for main.css styled buttons */
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-border-dark);
}

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: white;
}

.btn-danger {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--color-primary);
    padding-left: 0;
    padding-right: 0;
}

.btn-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Button Groups */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group .btn + .btn {
    margin-left: -1px;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0;
}

.card-description {
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
}

.card-body {
    flex: 1;
}

.card-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

/* Auth Card (for login/register) */
.auth-card {
    max-width: 400px;
    margin: var(--space-xl) auto;
}

.auth-card .card-header {
    text-align: center;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.form-label.required::after {
    content: ' *';
    color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-light);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--color-error);
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.form-error {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin-top: 0.25rem;
    accent-color: var(--color-primary);
}

.form-check-label {
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-input {
    flex: 1;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .btn {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-left: -1px;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alerts {
    margin-bottom: var(--space-lg);
}

.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
}

.alert:last-child {
    margin-bottom: 0;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.error-list {
    margin: 0;
    padding-left: var(--space-lg);
}

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

.error-list li:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.badge-primary {
    background: var(--color-primary);
    color: white;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: var(--font-size-xs);
}

.table tbody tr:hover {
    background: var(--color-bg-alt);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */
.progress {
    height: 8px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow) ease;
}

.progress-bar.success {
    background: var(--color-success);
}

.progress-bar.warning {
    background: var(--color-warning);
}

.progress-bar.error {
    background: var(--color-error);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.site-footer {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl) 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-content p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: var(--font-size-sm);
}

.footer-links {
    display: flex;
    gap: var(--space-lg);
}

.footer-links a {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.footer-links a:hover {
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */
.loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

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

/* Page Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

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

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

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.empty-state-description {
    margin-bottom: var(--space-lg);
}

/* ============================================================================
   JOB CARDS
   ============================================================================ */
.job-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.job-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: box-shadow var(--transition-fast);
}

.job-card:hover {
    box-shadow: var(--shadow-md);
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.job-card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

.job-card-meta {
    display: flex;
    gap: var(--space-lg);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.job-card-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
/* Display */
/* Note: Don't use !important on .hidden - it breaks Tailwind responsive classes like sm:flex */
.hide { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Spacing */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-lg); }
.mt-3 { margin-top: var(--space-xl); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-lg); }
.mb-3 { margin-bottom: var(--space-xl); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-md); }
.p-2 { padding: var(--space-lg); }
.p-3 { padding: var(--space-xl); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Borders */
.border { border: 1px solid var(--color-border); }
.border-top { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

/* Visibility */
.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;
}

/* ============================================================================
   PAGE-SPECIFIC STYLES
   ============================================================================ */

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

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.hero-description {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Pricing Cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.pricing-card {
    text-align: center;
}

.pricing-card.featured {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
}

.pricing-card .card-header {
    border-bottom: none;
    padding-bottom: 0;
}

.pricing-amount {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-primary);
}

.pricing-period {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: var(--space-lg) 0;
    text-align: left;
}

.pricing-features li {
    padding: var(--space-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.pricing-features li::before {
    content: '✓';
    color: var(--color-success);
    font-weight: bold;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
}

/* File Upload */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl);
    text-align: center;
    background: var(--color-bg-alt);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-zone-icon {
    font-size: 3rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.upload-zone-text {
    color: var(--color-text-muted);
}

.upload-zone-text strong {
    color: var(--color-primary);
}

/* File List */
.file-list {
    margin-top: var(--space-lg);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.file-item-icon {
    color: var(--color-error);
    font-size: var(--font-size-xl);
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.file-item-remove {
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-xs);
}

.file-item-remove:hover {
    color: var(--color-error);
}

/* ============================================================================
   LANDING PAGE - HERO
   ============================================================================ */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0;
    background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
    margin: calc(-1 * var(--space-xl)) calc(-1 * var(--space-md)) var(--space-2xl);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-md);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .hero {
        padding: var(--space-3xl) var(--space-2xl);
    }

    .hero-title {
        font-size: 3rem;
    }
}

/* ============================================================================
   LANDING PAGE - FEATURES
   ============================================================================ */
.features-section {
    padding: var(--space-2xl) 0;
}

.section-title {
    font-size: var(--font-size-2xl);
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--color-text);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.feature-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: box-shadow var(--transition-base);
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
}

.feature-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.feature-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.feature-description {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* ============================================================================
   LANDING PAGE - HOW IT WORKS
   ============================================================================ */
.how-it-works {
    padding: var(--space-2xl) 0;
    background: var(--color-bg-alt);
    margin: var(--space-2xl) calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-xl);
    max-width: 900px;
    margin: 0 auto;
}

.step {
    text-align: center;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0 auto var(--space-md);
}

.step-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.step-description {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ============================================================================
   LANDING PAGE - USE CASES
   ============================================================================ */
.use-cases {
    padding: var(--space-2xl) 0;
}

.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.use-case {
    padding: var(--space-lg);
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg-alt);
}

.use-case h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.use-case p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ============================================================================
   LANDING PAGE - CTA SECTION
   ============================================================================ */
.cta-section {
    padding: var(--space-3xl) var(--space-lg);
    background: var(--color-primary);
    color: white;
    text-align: center;
    margin: var(--space-2xl) calc(-1 * var(--space-md)) 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cta-content h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
}

.cta-content p {
    opacity: 0.9;
    margin-bottom: var(--space-lg);
}

.cta-section .btn-primary {
    background: white;
    color: var(--color-primary);
}

.cta-section .btn-primary:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

/* ============================================================================
   PRICING PAGE
   ============================================================================ */
.page-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.page-header h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: var(--font-size-lg);
}

.pricing-calculator {
    max-width: 500px;
    margin: 0 auto var(--space-2xl);
}

.calculator-form {
    padding: var(--space-lg);
}

.calculator-result {
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-top: var(--space-lg);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
}

.result-row.total {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-sm);
    padding-top: var(--space-md);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.credit-packs {
    margin-bottom: var(--space-2xl);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    max-width: 900px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    position: relative;
    transition: box-shadow var(--transition-base);
}

.pricing-card:hover {
    box-shadow: var(--shadow-md);
}

.pricing-card.featured {
    border-color: var(--color-primary);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.pricing-header h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
}

.pricing-amount {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-primary);
}

.pricing-features {
    list-style: none;
    text-align: left;
    margin: var(--space-lg) 0;
}

.pricing-features li {
    padding: var(--space-sm) 0;
    padding-left: var(--space-lg);
    position: relative;
}

.pricing-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.pricing-features li.highlight {
    color: var(--color-primary);
    font-weight: 500;
}

.pay-per-job {
    max-width: 600px;
    margin: 0 auto var(--space-2xl);
}

.whats-included {
    margin-bottom: var(--space-2xl);
}

.included-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.included-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
}

.included-icon {
    color: var(--color-success);
    flex-shrink: 0;
}

.included-item strong {
    display: block;
    margin-bottom: var(--space-xs);
}

.included-item p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin: 0;
}

.faq-section {
    margin-bottom: var(--space-2xl);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.faq-item h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-sm);
}

.faq-item p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* ============================================================================
   ABOUT PAGE
   ============================================================================ */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
}

@media (min-width: 768px) {
    .content-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.content-main {
    min-width: 0;
}

.content-section {
    margin-bottom: var(--space-xl);
}

.content-section h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.content-section p {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.numbered-list {
    margin-left: var(--space-lg);
    color: var(--color-text-muted);
}

.numbered-list li {
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.feature-list {
    list-style: none;
}

.feature-list li {
    padding: var(--space-sm) 0;
    padding-left: var(--space-lg);
    position: relative;
    color: var(--color-text-muted);
}

.feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
}

.content-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.sidebar-card {
    padding: var(--space-lg);
}

.sidebar-card h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
}

.sidebar-card p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    padding: var(--space-xs) 0;
}

.sidebar-links a {
    color: var(--color-primary);
    text-decoration: none;
}

.sidebar-links a:hover {
    text-decoration: underline;
}

/* ============================================================================
   LEGAL PAGES
   ============================================================================ */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
}

.legal-content {
    padding: var(--space-xl);
}

.legal-section {
    margin-bottom: var(--space-xl);
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-size: var(--font-size-lg);
    color: var(--color-text);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.legal-section h3 {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin: var(--space-lg) 0 var(--space-sm);
}

.legal-section p {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.legal-section ul {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
    color: var(--color-text-muted);
}

.legal-section li {
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}

/* ============================================================================
   DASHBOARD PAGE
   ============================================================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.dashboard-title h1 {
    margin-bottom: var(--space-xs);
}

.dashboard-section {
    margin-bottom: var(--space-2xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.section-header h2 {
    margin: 0;
}

/* Job Cards */
.jobs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.job-card {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--space-lg);
    align-items: center;
    padding: var(--space-lg);
}

@media (max-width: 768px) {
    .job-card {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .job-card-status,
    .job-card-actions {
        justify-self: start;
    }
}

.job-card-main {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    min-width: 0;
}

.job-card-icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.job-card-info {
    min-width: 0;
}

.job-card-title {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-card-title:hover {
    color: var(--color-primary);
}

.job-card-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.job-card-meta .separator {
    margin: 0 var(--space-xs);
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.quick-action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.quick-action-card h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-xs);
}

.quick-action-card p {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
}

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

.empty-state-icon {
    color: var(--color-text-light);
    margin-bottom: var(--space-lg);
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* ============================================================================
   UPLOAD PAGE
   ============================================================================ */
.upload-page {
    max-width: 800px;
    margin: 0 auto;
}

.upload-step {
    margin-bottom: var(--space-lg);
}

.upload-step .card-header {
    margin-bottom: var(--space-lg);
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl);
    text-align: center;
    background: var(--color-bg-alt);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-zone-icon {
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.upload-zone-text {
    color: var(--color-text-muted);
}

.upload-zone-text strong {
    color: var(--color-primary);
}

/* File List */
.file-list {
    margin-top: var(--space-lg);
}

.file-list-title {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-md);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.file-item-icon {
    color: #ef4444;
    flex-shrink: 0;
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.file-item-remove:hover {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.checkbox-label {
    display: flex;
    gap: var(--space-md);
    cursor: pointer;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.checkbox-label:hover {
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
}

.checkbox-text strong {
    margin-bottom: var(--space-xs);
}

.checkbox-text .text-muted {
    font-size: var(--font-size-sm);
}

/* Cost Summary */
.cost-summary {
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.cost-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
}

.cost-row.total {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-sm);
    padding-top: var(--space-md);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.cost-row.balance {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* Form Actions */
.form-actions {
    text-align: center;
}

/* Upload Progress */
.upload-progress {
    padding: var(--space-lg);
}

.upload-progress .progress {
    height: 12px;
    margin-bottom: var(--space-md);
}

/* ============================================================================
   JOB STATUS PAGE
   ============================================================================ */
.job-page {
    max-width: 900px;
    margin: 0 auto;
}

.job-page .page-header {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.page-header-main {
    flex: 1;
}

.page-header-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
}

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

.job-page h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
}

.job-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    flex-wrap: wrap;
}

.job-meta .separator {
    color: var(--color-border);
}

/* Processing Stages */
.processing-stages {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.stage {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
    transition: all var(--transition-base);
}

.stage.active {
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
}

.stage.completed {
    opacity: 0.7;
}

.stage-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.stage.active .stage-icon {
    background: var(--color-primary);
    color: white;
}

.stage.completed .stage-icon {
    background: var(--color-success);
    color: white;
}

.stage-number {
    font-size: var(--font-size-lg);
}

.stage-info {
    flex: 1;
}

.stage-info h4 {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.stage-info p {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
}

.stage-progress-text {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.stage.active .stage-progress-text {
    color: var(--color-primary);
}

.stage .progress {
    height: 6px;
}

/* Processing Status */
.processing-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Stats Grid Small */
.stats-grid-sm {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: var(--space-lg);
}

.stats-grid-sm .stat-card {
    padding: var(--space-md);
}

.stats-grid-sm .stat-value {
    font-size: var(--font-size-xl);
}

@media (max-width: 640px) {
    .stats-grid-sm {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Files Table */
.files-table-wrapper {
    overflow-x: auto;
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.file-name-cell svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* Chunks List */
.chunks-list {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.chunk-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.chunk-item.completed {
    opacity: 0.8;
}

.chunk-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.chunk-item.completed .chunk-number {
    background: var(--color-success);
    color: white;
}

.chunk-info {
    flex: 1;
    min-width: 0;
}

.chunk-title {
    font-weight: 500;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chunk-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.chunk-meta .separator {
    color: var(--color-border);
}

.chunk-status {
    flex-shrink: 0;
}

/* Download Options */
.download-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.download-option {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
}

.download-option:hover {
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.download-option-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    flex-shrink: 0;
}

.download-option-info {
    flex: 1;
}

.download-option-info h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.download-option-info p {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin: 0;
}

.download-option-action {
    flex-shrink: 0;
}

.download-expiry {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: center;
    padding: var(--space-md);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--color-border);
}

/* Job Details Card */
.job-details-card summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.job-details-card .details-chevron {
    transition: transform var(--transition-base);
}

.job-details-card[open] .details-chevron {
    transform: rotate(180deg);
}

.job-details-content {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.detail-value {
    font-weight: 500;
}

.token-usage {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.token-usage h4 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-md);
}

/* Alert Actions */
.alert-actions {
    margin-top: var(--space-md);
}

@media (max-width: 768px) {
    .job-page .page-header {
        flex-direction: column;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        flex: 1;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .download-option {
        flex-direction: column;
        text-align: center;
    }

    .download-option-action {
        width: 100%;
    }

    .download-option-action .btn {
        width: 100%;
    }
}

/* ============================================================================
   STRUCTURE EXPLORER MODAL
   ============================================================================ */
.structure-selector-row {
    display: flex;
    align-items: stretch;
}

.structure-explorer-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.structure-explorer-modal.hidden {
    display: none;
}

.structure-explorer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.structure-explorer-container {
    position: relative;
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.structure-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.structure-explorer-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0;
}

.structure-explorer-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.structure-explorer-close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.structure-explorer-search {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.structure-explorer-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--font-size-base);
    color: var(--color-text);
    outline: none;
}

.structure-explorer-search-input::placeholder {
    color: var(--color-text-light);
}

.structure-explorer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.structure-section {
    margin-bottom: var(--space-xl);
}

.structure-section:last-child {
    margin-bottom: 0;
}

.structure-section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--color-border);
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}

.structure-create-new {
    margin-top: var(--space-md);
    text-align: center;
}

.structure-no-results {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
}

/* Structure Card */
.structure-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
}

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

.structure-card.expanded {
    grid-column: 1 / -1;
    cursor: default;
}

.structure-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.structure-card-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    line-height: 1.3;
    word-break: break-word;
}

.structure-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-xs);
    font-size: var(--font-size-xs);
    font-weight: 500;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    margin-left: var(--space-sm);
    flex-shrink: 0;
}

.structure-card-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.structure-card.expanded .structure-card-description {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.structure-card-fields-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--space-sm);
}

.structure-card-fields-preview .field-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.structure-card-fields-preview .more {
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 2px 4px;
}

/* Field type colors */
.field-chip.type-string { background: #dbeafe; color: #1e40af; }
.field-chip.type-text { background: #dbeafe; color: #1e40af; }
.field-chip.type-number { background: #dcfce7; color: #166534; }
.field-chip.type-integer { background: #dcfce7; color: #166534; }
.field-chip.type-boolean { background: #f3e8ff; color: #7c3aed; }
.field-chip.type-date { background: #fef3c7; color: #92400e; }
.field-chip.type-time { background: #fef3c7; color: #92400e; }
.field-chip.type-datetime { background: #fef3c7; color: #92400e; }
.field-chip.type-array { background: #ffedd5; color: #c2410c; }
.field-chip.type-records_array { background: #fee2e2; color: #991b1b; }

/* Expanded card styles */
.structure-card-collapse-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    margin-left: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.structure-card-collapse-btn:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.structure-card-field-list {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.structure-card-field-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    font-size: var(--font-size-sm);
}

.structure-card-field-item:first-child {
    padding-top: 0;
}

.structure-card-field-name {
    font-weight: 500;
    color: var(--color-text);
    min-width: 120px;
}

.structure-card-field-type {
    font-size: var(--font-size-xs);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.structure-card-field-required {
    font-size: var(--font-size-xs);
    color: var(--color-error);
    font-weight: 500;
}

.structure-card-field-description {
    flex: 1;
    color: var(--color-text-muted);
}

.structure-card-select-btn {
    margin-top: var(--space-md);
    width: 100%;
}

.structure-explorer-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    background: var(--color-bg-alt);
}

/* Responsive */
@media (max-width: 640px) {
    .structure-explorer-container {
        max-height: 100vh;
        border-radius: 0;
    }

    .structure-grid {
        grid-template-columns: 1fr;
    }

    .structure-card.expanded {
        grid-column: 1;
    }

    .structure-selector-row {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .structure-selector-row .btn {
        margin-left: 0 !important;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .structure-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   HERO CAROUSEL
   ============================================================================ */

.hero-carousel {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.hero-carousel-viewport {
    overflow: hidden;
    border-radius: 1rem;
}

.hero-carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.hero-carousel-card {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
}

.carousel-card-inner {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    min-height: 340px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.carousel-card-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: center;
}

.carousel-card-caption {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    text-align: center;
    margin-top: auto;
    padding-top: 0.75rem;
}

/* Arrow buttons */
.hero-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

.hero-carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hero-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.hero-carousel-prev {
    left: -18px;
}

.hero-carousel-next {
    right: -18px;
}

@media (max-width: 640px) {
    .hero-carousel-prev { left: 4px; }
    .hero-carousel-next { right: 4px; }
    .hero-carousel-arrow {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* Dot indicators */
.hero-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.hero-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.hero-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.hero-carousel-dot.active {
    background: white;
    transform: scale(1.2);
}

/* Pause/play button */
.hero-carousel-pause {
    width: 10px;
    height: 10px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    margin-right: 4px;
}

.hero-carousel-pause:hover {
    color: rgba(255, 255, 255, 0.8);
}

.hero-carousel-pause-icon,
.hero-carousel-play-icon {
    width: 10px;
    height: 10px;
}

/* Placeholder screenshot frame */
.carousel-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.carousel-placeholder-frame {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.carousel-placeholder-titlebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
}

.carousel-placeholder-dot-red,
.carousel-placeholder-dot-yellow,
.carousel-placeholder-dot-green {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.carousel-placeholder-dot-red { background: #ff5f57; }
.carousel-placeholder-dot-yellow { background: #febc2e; }
.carousel-placeholder-dot-green { background: #28c840; }

.carousel-placeholder-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.6875rem;
    margin-left: auto;
}

.carousel-placeholder-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 1.5rem;
    flex: 1;
}

.carousel-screenshot {
    width: 100%;
    border-radius: 0.5rem;
    display: block;
}

/* Workflow diagram (Card 1) — CSS Grid */
.workflow-diagram {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    grid-template-rows: auto 0.75rem auto;
    gap: 0.25rem 0.375rem;
    align-items: center;
    justify-items: center;
    padding: 0.25rem 0;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0.625rem 0.375rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    min-width: 80px;
    text-align: center;
    width: 100%;
}

.workflow-step span {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.3;
}

.workflow-step.highlight {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.workflow-step .workflow-icon {
    width: 24px;
    height: 24px;
    color: white;
}

.workflow-step .workflow-icon svg {
    width: 100%;
    height: 100%;
}

.workflow-arrow {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.workflow-arrow-down {
    grid-column: 5;
    grid-row: 2;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    line-height: 1;
}

.workflow-cycle-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.6875rem;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.workflow-cycle-arrow svg {
    width: 14px;
    height: 14px;
}

/* ================================================================
   Upload Mode Tabs (PDF / Database)
   ================================================================ */
.upload-mode-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.upload-mode-tab:hover {
    color: var(--color-text);
}

.upload-mode-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.db-mode-option {
    transition: border-color 0.15s, background-color 0.15s;
}

.db-mode-option.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary-light, #eff6ff);
}

/* ===== Stepper Progress ===== */
.stepper-line {
    width: 2px;
    background: var(--color-border);
    transition: background 0.3s ease;
}

.stepper-step[data-state="complete"] .stepper-line {
    background: var(--color-success);
}

.stepper-step[data-state="active"] .stepper-line {
    background: linear-gradient(to bottom, var(--color-primary) 50%, var(--color-border) 50%);
}

.stepper-step[data-state="active"] .stepper-icon {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    transition: box-shadow 0.3s ease;
}

.stepper-step[data-state="complete"] .stepper-icon {
    transition: background-color 0.3s ease;
}

/* Indeterminate progress bar animation (output phase) */
@keyframes indeterminate-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

.progress-bar-indeterminate {
    width: 40% !important;
    animation: indeterminate-slide 1.5s ease-in-out infinite;
}
