/* Custom CSS for Parts Intelligence */
/* Precision Industrial Theme */

/* ==========================================
   Design Tokens - Precision Industrial
   ========================================== */

:root {
    /* Brand Colors - Precision Industrial */
    --brand-primary: #0F172A;         /* Deep Slate - reliability, precision */
    --brand-primary-hover: #1E293B;   /* Slate 800 */
    --brand-primary-soft: #F1F5F9;    /* Slate 100 - soft background */
    --brand-accent: #0EA5E9;          /* Sky 500 - technology, innovation */
    --brand-accent-hover: #0284C7;    /* Sky 600 */
    --brand-accent-soft: #E0F2FE;     /* Sky 100 */

    /* Industrial Gray Palette */
    --industrial-50: #F8FAFC;
    --industrial-100: #F1F5F9;
    --industrial-200: #E2E8F0;
    --industrial-300: #CBD5E1;
    --industrial-400: #94A3B8;
    --industrial-500: #64748B;
    --industrial-600: #475569;
    --industrial-700: #334155;
    --industrial-800: #1E293B;
    --industrial-900: #0F172A;

    /* Text Colors - High contrast for industrial environments */
    --text-primary: #0F172A;          /* Deep slate for headings */
    --text-secondary: #334155;        /* Slate 700 for body */
    --text-muted: #64748B;            /* Slate 500 for captions */
    --text-inverse: #FFFFFF;

    /* Surface Colors - Industrial clean */
    --surface-base: #FFFFFF;
    --surface-raised: #FFFFFF;
    --surface-sunken: #F8FAFC;        /* Industrial 50 */
    --surface-default: #FFFFFF;
    --surface-overlay: rgba(15, 23, 42, 0.8);

    /* Border Colors */
    --border-default: #E2E8F0;
    --border-strong: #CBD5E1;
    --border-accent: #0EA5E9;

    /* Status Colors - Clear visibility */
    --status-success: #059669;        /* Emerald 600 */
    --status-success-soft: #D1FAE5;
    --status-warning: #D97706;        /* Amber 600 */
    --status-warning-soft: #FEF3C7;
    --status-error: #DC2626;          /* Red 600 */
    --status-error-soft: #FEE2E2;
    --status-info: #0284C7;           /* Sky 600 */
    --status-info-soft: #E0F2FE;

    /* Radius - Precision, minimal curves */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Shadows - Subtle depth */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 16px 48px rgba(15, 23, 42, 0.16);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Typography - Font Families */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-base: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

    /* Typography - Heading sizes */
    --text-h1: 1.75rem;     /* 28px - Page titles */
    --text-h2: 1.375rem;    /* 22px - Section headers */
    --text-h3: 1.125rem;    /* 18px - Card titles */
    --text-h4: 1rem;        /* 16px - Subsection headers */
    --text-h5: 0.875rem;    /* 14px - Minor headers */

    /* Typography - Body text sizes */
    --text-body: 0.9375rem; /* 15px - Primary body (optimal for data) */
    --text-sm: 0.8125rem;   /* 13px - Secondary text */
    --text-xs: 0.75rem;     /* 12px - Captions, labels */

    /* Typography - Line heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Theme aliases */
    --precision-navy: #0F172A;
    --precision-cyan: #0EA5E9;
    --precision-steel: #64748B;
}

/* ==========================================
   Dark Mode Token Overrides
   ========================================== */

html[data-theme="dark"] {
    /* Brand Colors */
    --brand-primary: #E2E8F0;
    --brand-primary-hover: #F1F5F9;
    --brand-primary-soft: #1E293B;
    --brand-accent: #38BDF8;
    --brand-accent-hover: #7DD3FC;
    --brand-accent-soft: #0C4A6E;

    /* Industrial Gray Palette (inverted) */
    --industrial-50: #0F172A;
    --industrial-100: #1E293B;
    --industrial-200: #334155;
    --industrial-300: #475569;
    --industrial-400: #64748B;
    --industrial-500: #94A3B8;
    --industrial-600: #CBD5E1;
    --industrial-700: #E2E8F0;
    --industrial-800: #F1F5F9;
    --industrial-900: #F8FAFC;

    /* Text Colors */
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --text-inverse: #0F172A;

    /* Surface Colors */
    --surface-base: #0F172A;
    --surface-raised: #1E293B;
    --surface-sunken: #0B1120;
    --surface-default: #1E293B;
    --surface-overlay: rgba(241, 245, 249, 0.08);

    /* Border Colors */
    --border-default: #334155;
    --border-strong: #475569;
    --border-accent: #38BDF8;

    /* Status Colors (brighter for dark bg) */
    --status-success: #34D399;
    --status-success-soft: #064E3B;
    --status-warning: #FBBF24;
    --status-warning-soft: #78350F;
    --status-error: #F87171;
    --status-error-soft: #7F1D1D;
    --status-info: #38BDF8;
    --status-info-soft: #0C4A6E;

    /* Shadows (stronger for dark mode) */
    --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 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);

    /* Theme aliases */
    --precision-navy: #F1F5F9;
    --precision-cyan: #38BDF8;
    --precision-steel: #94A3B8;
}

html[data-theme="dark"] body {
    background: #0F172A;
    color: #E2E8F0;
}

html[data-theme="dark"] .glass {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .skeleton-loading {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* DaisyUI dark overrides */
html[data-theme="dark"] .bg-base-100,
html[data-theme="dark"] .bg-neutral {
    background-color: #1E293B !important;
}
html[data-theme="dark"] .text-neutral-content {
    color: #F1F5F9 !important;
}
html[data-theme="dark"] .table tr.hover:hover,
html[data-theme="dark"] .table-row-hover:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea {
    background-color: #0F172A;
    border-color: #334155;
    color: #F1F5F9;
}
html[data-theme="dark"] .btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .menu li > *:hover {
    background-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .dropdown-content {
    background-color: #1E293B !important;
    border: 1px solid #334155;
}
html[data-theme="dark"] .modal-box {
    background-color: #1E293B;
    color: #F1F5F9;
}

/* ==========================================
   Utility Classes
   ========================================== */

/* Glass effect - for navbar and floating panels */
.glass {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Hover lift effect - for interactive cards */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Skeleton loading animation */
.skeleton-loading {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton 2s ease-in-out infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================
   Responsive Mobile Table Cards
   ========================================== */

@media (max-width: 768px) {
    table.responsive-cards thead { display: none; }
    table.responsive-cards tbody { display: flex; flex-direction: column; gap: 0.75rem; }
    table.responsive-cards tr {
        display: block;
        border: 1px solid var(--border-default);
        border-radius: var(--radius-md);
        padding: 0.75rem;
        background: var(--surface-raised);
    }
    table.responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
        border: none !important;
    }
    table.responsive-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 1rem;
        white-space: nowrap;
        font-size: 0.8rem;
    }
    table.responsive-cards td:last-child {
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-default) !important;
    }
}

/* ==========================================
   Form Validation Styling
   ========================================== */

/* Input states */
.input-error,
.input.input-error {
    border-color: var(--status-error) !important;
    outline-color: var(--status-error);
}

.input-success,
.input.input-success {
    border-color: var(--status-success) !important;
    outline-color: var(--status-success);
}

.input-warning,
.input.input-warning {
    border-color: var(--status-warning) !important;
    outline-color: var(--status-warning);
}

/* Helper and error text */
.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.error-text {
    font-size: 0.75rem;
    color: var(--status-error);
    margin-top: var(--space-1);
}

.success-text {
    font-size: 0.75rem;
    color: var(--status-success);
    margin-top: var(--space-1);
}

/* Form field with error state */
.form-control.has-error .input,
.form-control.has-error .select,
.form-control.has-error .textarea {
    border-color: var(--status-error);
}

.form-control.has-error .label-text {
    color: var(--status-error);
}

/* Focus states */
.input:focus,
.select:focus,
.textarea:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-color: var(--brand-primary);
}

/* ==========================================
   Typography System - Precision Industrial
   ========================================== */

/* Base typography */
body {
    font-family: var(--font-base);
    font-size: var(--text-body);
    line-height: var(--leading-normal);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Heading styles - Space Grotesk for display, precision look */
h1, .text-h1 {
    font-family: var(--font-display);
    font-size: var(--text-h1);
    font-weight: 700;
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

h2, .text-h2 {
    font-family: var(--font-display);
    font-size: var(--text-h2);
    font-weight: 600;
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
}

h3, .text-h3 {
    font-family: var(--font-display);
    font-size: var(--text-h3);
    font-weight: 600;
    line-height: var(--leading-tight);
}

h4, .text-h4 {
    font-size: var(--text-h4);
    font-weight: 600;
    line-height: var(--leading-tight);
}

h5, .text-h5 {
    font-size: var(--text-h5);
    font-weight: 600;
    line-height: var(--leading-tight);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Default heading colors - precision industrial */
h1:not([class*="text-"]), h2:not([class*="text-"]), h3:not([class*="text-"]) {
    color: var(--text-primary);
}

h4:not([class*="text-"]), h5:not([class*="text-"]) {
    color: var(--text-secondary);
}

/* Text variants (prefixed to avoid DaisyUI conflicts) */
.typo-body {
    font-size: var(--text-body);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
}

.typo-secondary {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: var(--leading-normal);
}

.typo-subtle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: var(--leading-normal);
}

.typo-emphasized {
    font-weight: 600;
    color: var(--text-primary);
}

.typo-technical {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==========================================
   Component Library - Cards
   Precision Industrial Style
   ========================================== */

/* Standard Card - Clean, precise borders */
.card-primary {
    background: white;
    border: 1px solid var(--industrial-200);
    border-radius: var(--radius-lg);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-primary:hover {
    border-color: var(--industrial-300);
    box-shadow: var(--shadow-md);
}

/* Featured Card with Accent Border */
.card-featured {
    background: white;
    border-left: 3px solid var(--brand-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Stats Card Icon Container */
.stats-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: var(--industrial-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
}

/* Glass Morphism Card - Subtle for industrial */
.card-glass {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-lg);
    border: 1px solid var(--industrial-200);
    box-shadow: var(--shadow-md);
}

/* Technical Data Card */
.card-technical {
    background: white;
    border: 1px solid var(--industrial-200);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
}

/* ==========================================
   Component Library - Buttons
   ========================================== */

/* Accent/CTA Button (alternative to primary) */
.btn-accent-cta {
    background: var(--brand-accent-hover);
    color: var(--surface-default);
    border: none;
}

.btn-accent-cta:hover {
    background: var(--brand-accent);
}

/* ==========================================
   Component Library - Badges
   ========================================== */

/* Primary Badge */
.badge-primary {
    background: var(--text-primary);
    color: white;
}

/* Subtle Badge */
.badge-subtle {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--surface-sunken);
    color: var(--text-primary);
    font-weight: 500;
}

/* ==========================================
   Component Library - Alerts
   ========================================== */

/* Info Alert (styled) */
.alert-styled-info {
    background: var(--surface-sunken);
    border: 1px solid rgba(2, 54, 93, 0.2);
    color: var(--text-primary);
}

.alert-styled-info i {
    color: var(--text-primary);
}

/* Success Alert */
.alert-styled-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-styled-success i {
    color: #22c55e;
}

/* Error Alert */
.alert-styled-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-styled-error i {
    color: #ef4444;
}

/* Warning Alert */
.alert-styled-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-styled-warning i {
    color: #f59e0b;
}

/* ==========================================
   Component Library - Segmented Control (Section 9.3)
   Mode toggle for switching between app sections
   ========================================== */

.segmented-control {
    display: inline-flex;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 2px;
}

.segmented-control-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.segmented-control-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}

.segmented-control-item.active {
    background: white;
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.segmented-control-item.active i,
.segmented-control-item.active svg {
    color: var(--brand-primary);
}

/* Focus state for accessibility (Section 15) */
.segmented-control-item.focus-ring:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ==========================================
   Component Library - Navigation Links
   Precision Industrial Style
   ========================================== */

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--industrial-100);
    border-color: var(--industrial-200);
}

.nav-link.active {
    color: var(--brand-accent);
    background: var(--brand-accent-soft);
    border-color: var(--brand-accent);
}

.nav-link i,
.nav-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}


/* ==========================================
   Component Library - Tabs
   ========================================== */

.tabs-styled {
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.tabs-styled .tab {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.tabs-styled .tab:hover {
    color: var(--text-primary);
}

.tabs-styled .tab-active {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

/* ==========================================
   Component Library - Collapse/Accordion
   ========================================== */

.collapse-styled {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.collapse-styled .collapse-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.collapse-styled .collapse-title i {
    color: var(--text-primary);
}

.collapse-styled .collapse-content {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==========================================
   Component Library - Breadcrumbs
   ========================================== */

.breadcrumbs-styled {
    font-size: 0.875rem;
}

.breadcrumbs-styled a {
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.breadcrumbs-styled a:hover {
    color: var(--brand-accent);
}

.breadcrumbs-styled li:last-child span {
    color: var(--text-muted);
}

/* ==========================================
   Component Library - Loading States
   ========================================== */

/* Bruviti colored spinner */
.loading-styled {
    color: var(--text-primary);
}

/* Skeleton loading with brand tint */
.skeleton-styled {
    background: linear-gradient(90deg, var(--surface-sunken) 25%, #e2e8f0 50%, var(--surface-sunken) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================
   Component Library - Data Tables
   ========================================== */

.table-styled {
    border-collapse: separate;
    border-spacing: 0;
}

.table-styled thead tr {
    background: #f8fafc;
}

.table-styled thead th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid #e2e8f0;
}

.table-styled tbody tr {
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table-styled tbody tr:hover {
    background: rgba(243, 248, 249, 0.5);
}

.table-styled td {
    color: var(--text-secondary);
}

/* Monospace cell for IDs/codes */
.table-styled .cell-mono {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 500;
    color: var(--text-primary);
}

/* Action buttons in table */
.table-styled .table-actions {
    display: flex;
    gap: 0.25rem;
}

.table-styled .table-actions .btn-ghost {
    color: var(--text-muted);
}

.table-styled .table-actions .btn-ghost:hover {
    color: var(--text-primary);
    background: var(--surface-sunken);
}

/* ==========================================
   Component Library - Stats Grid
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.stat-card .stat-icon.icon-blue {
    background: var(--surface-sunken);
    color: var(--text-primary);
}

.stat-card .stat-icon.icon-green {
    background: #f0fdf4;
    color: #22c55e;
}

.stat-card .stat-icon.icon-amber {
    background: #fffbeb;
    color: #f59e0b;
}

.stat-card .stat-icon.icon-purple {
    background: #faf5ff;
    color: #a855f7;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-card .stat-value.value-green {
    color: #16a34a;
}

.stat-card .stat-value.value-amber {
    color: #d97706;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ==========================================
   Component Library - Key-Value Display
   ========================================== */

.mono {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.kv-row {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-default);
}

.kv-row:last-child {
    border-bottom: none;
}

.kv-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.kv-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .kv-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
        padding: 0.75rem;
    }
}

.kv-list {
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.kv-list .kv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.kv-list .kv-item:last-child {
    border-bottom: none;
}

.kv-list .kv-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.kv-list .kv-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.kv-list .kv-value.value-mono {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================
   Search Section Redesign
   ========================================== */

/* Main search container */
.search-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
}

/* Search input wrapper */
.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface-sunken);
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.search-input-wrapper:focus-within {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(253, 100, 1, 0.1);
    background: white;
}

.search-input-wrapper .search-icon {
    padding: 0 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon svg {
    width: 20px;
    height: 20px;
}

.search-input-wrapper input[type="text"] {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0.875rem 0;
    font-size: 1rem;
    outline: none !important;
    box-shadow: none !important;
    min-width: 0;
}

.search-input-wrapper input[type="text"]:focus {
    border: none !important;
    box-shadow: none !important;
}

.search-input-wrapper .search-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding-right: 0.5rem;
}

.search-input-wrapper .btn-icon {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.search-input-wrapper .btn-icon svg {
    width: 20px;
    height: 20px;
}

.search-input-wrapper .btn-icon.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary) !important;
}

.search-input-wrapper .btn-icon.btn-ghost:hover {
    background: var(--surface-sunken) !important;
    border-color: var(--text-muted);
    color: var(--text-primary) !important;
}

/* Image preview card */
.image-preview-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #FFF7ED;
    border: 1px solid #FDBA74;
    border-radius: 10px;
    animation: slideDown 0.2s ease-out;
}

.image-preview-card .preview-thumbnail {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.image-preview-card .preview-info {
    flex: 1;
    min-width: 0;
}

.image-preview-card .preview-filename {
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-card .refine-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #E2E8F0 !important;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    transition: all 0.2s ease;
}

.image-preview-card .refine-input:focus {
    border-color: var(--brand-accent) !important;
    box-shadow: 0 0 0 2px rgba(253, 100, 1, 0.1) !important;
    outline: none;
}

.image-preview-card .refine-hint {
    font-size: 0.75rem;
    color: #92400E;
    margin-top: 0.375rem;
}

.image-preview-card .btn-close-preview {
    width: 32px;
    height: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    font-size: 1rem;
}

.image-preview-card .btn-close-preview:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

/* Search toolbar */
.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #E2E8F0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: center;
    min-width: 200px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Compact sort dropdown */
.sort-select-compact {
    appearance: none;
    background: white;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 0.5rem 2.25rem 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2344546A'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
    min-width: 140px;
}

.sort-select-compact:hover {
    border-color: var(--text-muted);
}

.sort-select-compact:focus {
    border-color: var(--brand-accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(253, 100, 1, 0.1);
}

/* Clear search button */
.btn-clear-search {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-search:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

.btn-clear-search svg {
    width: 14px;
    height: 14px;
}

/* Score filter inline */
.score-filter-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--surface-sunken);
    border-radius: 8px;
    animation: fadeIn 0.2s ease-out;
}

.score-filter-inline label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.score-filter-inline .range {
    width: 120px;
    height: 6px;
}

.score-filter-inline .score-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 36px;
    text-align: right;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Export button compact */
.btn-export-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-compact:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

.btn-export-compact:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-export-compact svg {
    width: 18px;
    height: 18px;
}

/* Search mode chip */
.search-mode-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.875rem;
}

.search-mode-chip.text-mode {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1D4ED8;
}

.search-mode-chip.image-mode {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    color: #B45309;
}

.search-mode-chip.combined-mode {
    background: #F0FDF4;
    border: 1px solid #86EFAC;
    color: #166534;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-section {
        padding: 1rem;
    }

    .search-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        justify-content: center;
    }

    .toolbar-center {
        order: -1;
        width: 100%;
    }

    .score-filter-inline {
        width: 100%;
        justify-content: space-between;
    }

    .score-filter-inline .range {
        flex: 1;
        max-width: none;
    }

    .image-preview-card {
        flex-direction: column;
        align-items: stretch;
    }

    .image-preview-card .preview-thumbnail {
        width: 100%;
        height: 120px;
    }
}

/* Loading spinner animation */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Drag and drop zone styles */
.drag-over {
    border-color: var(--brand-accent) !important;  /* Primary orange */
    background-color: #FFF5F0 !important;
}

/* Custom scrollbar for desktop */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-sunken);  /* Light blue background */
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);  /* Secondary grey */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);  /* Slate gray on hover */
}

/* Table hover effects */
.table tr.hover:hover {
    cursor: pointer;
    background-color: var(--surface-sunken);  /* Light blue background */
}

/* Chat message styles */
.chat-message {
    animation: slideIn 0.3s ease-out;
}

/* Comparison Table Styles */
.comparison-table {
    border-collapse: separate;
    border-spacing: 0;
}

.comparison-table thead th {
    position: sticky;
    top: 0;
    background: #F9FAFB;
    z-index: 5;
    border-bottom: 2px solid #E5E7EB;
}

.comparison-table tbody td.sticky {
    position: sticky;
    left: 0;
    border-right: 1px solid #E5E7EB;
}

.comparison-table tbody tr:hover {
    background-color: rgba(253, 100, 1, 0.02) !important;
}

.comparison-table tbody tr:hover td {
    background-color: inherit !important;
}

/* Comparison Results Container */
.comparison-results {
    max-width: 100%;
    overflow: hidden;
}

.comparison-results .card {
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.comparison-results .card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Difference Highlighting */
.difference-unique {
    background-color: rgba(253, 100, 1, 0.1) !important;
    font-weight: 600;
}

.difference-partial {
    background-color: rgba(4, 73, 89, 0.05) !important;
    font-weight: 500;
}

.difference-missing {
    color: #9CA3AF;
    font-style: italic;
}

/* Category Badges */
.badge-blue {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-green {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-purple {
    background-color: rgba(168, 85, 247, 0.1);
    color: #A855F7;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.badge-yellow {
    background-color: rgba(250, 204, 21, 0.1);
    color: #F59E0B;
    border: 1px solid rgba(250, 204, 21, 0.2);
}

.badge-red {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Responsive Design for Comparison */
@media (max-width: 768px) {
    .comparison-table {
        font-size: 0.75rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .comparison-results .stat {
        padding: 0.5rem;
    }
}

/* Print Styles for Comparison */
@media print {
    .comparison-results .card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000;
    }
    
    .comparison-table {
        font-size: 10pt;
    }
    
    .badge {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Formatted chat content styles */
.chat-formatted strong {
    font-weight: 600;
    color: var(--text-primary);  /* Primary blue for emphasis */
}

.chat-formatted ol, 
.chat-formatted ul {
    margin-left: 0.5rem;
}

.chat-formatted li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

.chat-formatted p {
    line-height: 1.6;
}

.chat-formatted p:last-child {
    margin-bottom: 0;
}

/* Drawing preview container */
.drawing-preview {
    max-height: 600px;
    overflow: auto;
}

/* Thumbnail styling in tables */
.avatar img {
    object-fit: contain;
    background-color: var(--surface-sunken);  /* Light blue background */
}

/* Text truncation for table cells */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-w-xs {
    max-width: 20rem; /* 320px */
}

/* Modal styling */
.modal-box {
    max-height: 90vh;
    overflow-y: auto;
}

/* Dropzone image preview styling */
#dropzone.drag-over {
    border-color: var(--brand-accent);
    background-color: rgba(253, 100, 1, 0.05);
}

/* Removed conflicting imagePreview rules - now handled by Tailwind classes */

/* Table in modal */
.modal-box .table td:first-child {
    width: 40%;
    font-weight: 500;
    color: var(--text-secondary); /* Secondary blue */
}

/* Status badges */
.badge-processing {
    background-color: var(--brand-accent);  /* Primary orange */
    color: white;
}

.badge-completed {
    background-color: var(--text-primary);  /* Primary blue for success */
    color: white;
}

.badge-error {
    background-color: var(--text-secondary);  /* Secondary blue for errors */
    color: white;
}

/* Override DaisyUI progress bar colors */
.progress-primary::-webkit-progress-value {
    background-color: var(--brand-accent);  /* Primary orange */
}

.progress-primary::-moz-progress-bar {
    background-color: var(--brand-accent);  /* Primary orange */
}

.progress-primary {
    background-color: var(--border-default);  /* Secondary grey for track */
}

/* Override DaisyUI alert colors */
.alert-success {
    background-color: var(--text-primary) !important;  /* Primary blue */
    color: white !important;
    border: none !important;
}

.alert-success svg {
    stroke: white !important;
}

.alert-success span {
    color: white !important;
}

.alert-info {
    background-color: var(--surface-sunken);  /* Light blue background */
    color: var(--text-secondary);  /* Secondary blue text */
    border: 1px solid var(--border-default);  /* Secondary grey border */
}

.alert-info svg {
    stroke: var(--text-secondary);  /* Secondary blue */
}

/* Override DaisyUI alert colors for errors */
.alert-error {
    background-color: var(--text-secondary) !important;  /* Secondary blue for errors */
    color: white !important;
    border: none !important;
}

.alert-error svg {
    stroke: white !important;
}

.alert-error span {
    color: white !important;
}

.alert-warning {
    background-color: var(--brand-accent-hover) !important;  /* Accent orange for warnings */
    color: white !important;
    border: none !important;
}

.alert-warning svg {
    stroke: white !important;
}

/* ==========================================
   Button System - Precision Industrial
   ========================================== */

/* Primary Button - Accent Cyan */
.btn-primary {
    background-color: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    color: white !important;
    font-weight: 500;
    border-radius: var(--radius-sm) !important;
}

.btn-primary:hover {
    background-color: var(--brand-accent-hover) !important;
    border-color: var(--brand-accent-hover) !important;
}

/* Secondary Button - Dark Slate */
.btn-secondary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: white !important;
    font-weight: 500;
    border-radius: var(--radius-sm) !important;
}

.btn-secondary:hover {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
}

/* Ghost Button - Minimal */
.btn-ghost {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
}

.btn-ghost:hover {
    background-color: var(--industrial-100) !important;
    color: var(--text-primary) !important;
}

/* Outline Button - Clean Border */
.btn-outline {
    border-color: var(--border-strong) !important;
    color: var(--text-secondary) !important;
    background-color: transparent !important;
    border-radius: var(--radius-sm) !important;
}

.btn-outline:hover {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: white !important;
}

/* Override DaisyUI loading spinner colors */
.loading-spinner.text-primary {
    color: var(--brand-accent);  /* Primary orange */
}

/* Toast container specific error styling */
#toast-container .alert-error {
    background-color: var(--text-secondary) !important;  /* Secondary blue for errors */
    color: white !important;
    border: none !important;
}

#toast-container .alert-error svg {
    stroke: white !important;
}

/* File upload progress */
.upload-progress {
    transition: width 0.3s ease;
}

/* Toast animations and styling */
.toast {
    animation: toastSlideIn 0.3s ease-out;
}

#toast-container .alert-success {
    background-color: var(--text-primary) !important;  /* Primary blue */
    color: white !important;
    border: none !important;
}

#toast-container .alert-success svg {
    stroke: white !important;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Form input styling - Precision Industrial */
.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--brand-accent) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

.input-bordered {
    border-color: var(--border-default) !important;
    border-radius: var(--radius-sm) !important;
}

/* Input fields in industrial context */
.input,
.select,
.textarea {
    background-color: var(--surface-base) !important;
    border-radius: var(--radius-sm) !important;
}

/* Checkbox and radio button styling - Precision Industrial */
.checkbox:checked,
.radio:checked {
    background-color: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
}

/* Link styling - Clean accent */
a {
    color: var(--brand-accent);
    text-decoration: none;
}

a:hover {
    color: var(--brand-accent-hover);
    text-decoration: underline;
}

/* Links in prose/content areas */
.prose a,
.content a {
    color: var(--brand-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover,
.content a:hover {
    color: var(--brand-accent-hover);
}

/* Animated loading dots */
.loading-dots::after{
    content:'...';
    display:inline-block;
    width:0;
    overflow:hidden;
    animation:ellipsis 1.2s steps(4,end) infinite;
}
  
@keyframes ellipsis{
    to{width:1.5em;}
}

/* Compact Match Column Styles */
.match-content {
    padding: 0.25rem;
}

.match-content .radial-progress {
    --size: 2rem !important;
    font-size: 0.625rem;
}

.block-scores-compact {
    background: var(--surface-sunken);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #E2E8F0;
    margin-top: 0.5rem;
}

.block-scores-compact .btn-xs {
    padding: 0.125rem 0.5rem;
    height: 1.5rem;
    min-height: 1.5rem;
}

/* Floating Block Score Details Panel */
.block-scores-detail {
    position: absolute;
    z-index: 50;
    background: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    max-width: 400px;
    width: 350px;
    right: 0;
    margin-top: 0.5rem;
}

.block-scores-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #E2E8F0;
}

.block-scores-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.block-score-row {
    padding: 0.5rem;
    background: #F8FAFC;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.block-score-row.best-match {
    background-color: #FFF5F0;
    border: 1px solid var(--brand-accent);
}

.block-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.block-icon {
    font-size: 1.25rem;
    margin-right: 8px;
}

.block-name {
    font-weight: 500;
    color: var(--text-primary);  /* Primary blue */
    text-transform: capitalize;
}

.score-bar-container {
    position: relative;
    height: 20px;
    background-color: var(--surface-sunken);  /* Light blue background */
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.score-bar {
    height: 100%;
    background: linear-gradient(to right, var(--text-secondary), var(--text-primary));  /* Blue gradient */
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.score-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* Additional styles for block icons and matched text */
.block-icon {
    font-size: 1rem;
    display: inline-block;
    width: 1.5rem;
}

.matched-text-preview {
    font-size: 0.75rem;
    color: #64748B;
    line-height: 1.2;
    margin-top: 0.25rem;
}

/* Make the match column responsive */
@media (max-width: 1280px) {
    .match-content {
        font-size: 0.875rem;
    }
    
    .block-scores-detail {
        width: 300px;
    }
}

.matched-text-preview {
    font-size: 0.875rem;
    color: var(--text-muted);  /* Slate gray */
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide/show animation for block scores */
.hidden {
    display: none;
}

.block-scores-toggle {
    transition: transform 0.2s ease;
}

.block-scores-toggle.expanded {
    transform: rotate(180deg);
}

/* Match Column Redesign */
.match-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-score-badge {
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.match-score-badge .score-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.match-score-badge .score-type {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.125rem;
}

/* Block Summary for Match Column */
.block-summary {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    background: #F8FAFC;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
}

.block-summary .best-block {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
}

.block-summary .best-block .icon {
    font-size: 1rem;
}

.block-summary .best-block .name {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

.block-summary .best-block .score {
    color: var(--text-primary);
    font-weight: 600;
}

.block-summary .expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: white;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.block-summary .expand-btn:hover {
    background: var(--text-primary);
    color: white;
    border-color: var(--text-primary);
}

.block-summary .expand-btn .icon {
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

/* Inline Expandable Block Scores */
.block-scores-expanded {
    background-color: #F8FAFC;
}

.block-scores-expanded td {
    padding: 0 !important;
}

.block-scores-container {
    padding: 1.5rem;
    background: #F8FAFC;
    border-top: 2px solid #E2E8F0;
}

.block-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.block-card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.block-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.block-card.highlight {
    background: #FFF5F0;
    border-color: var(--brand-accent);
}

.block-card .block-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.block-card .block-header .icon {
    font-size: 1.25rem;
}

.block-card .block-header .name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.block-card .score-visual {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.score-ring {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        var(--text-primary) calc(var(--score) * 1%),
        #E2E8F0 calc(var(--score) * 1%)
    );
    mask: radial-gradient(circle at center, transparent 65%, black 65%);
    -webkit-mask: radial-gradient(circle at center, transparent 65%, black 65%);
}

.score-ring span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.block-card .matched-snippet {
    background: #F8FAFC;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    margin-top: 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .block-scores-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

/* Metadata Analysis Styles */
.metadata-summary {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #F0F9FF;
    border: 1px solid #BFDBFE;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.metadata-summary .summary-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.metadata-summary .icon {
    font-size: 1rem;
}

.metadata-summary .text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.metadata-summary .expand-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.metadata-summary .expand-btn:hover {
    background: #1e3a8a;
}

.metadata-analysis-expanded {
    background-color: #F8FAFC;
}

.metadata-analysis-container {
    padding: 2rem;
}

.metadata-analysis-container .analysis-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.comparison-block {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #E2E8F0;
}

.compared-with {
    font-weight: 500;
    color: var(--text-primary);
}

.metadata-similarity {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: #F0F9FF;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
}

.differences-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.difference-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    padding: 0.75rem;
    background: #F8FAFC;
    border-radius: 0.375rem;
}

.field-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.field-values {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.value-current,
.value-compared {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.value-current .label,
.value-compared .label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 40px;
}

.value-current .value {
    color: var(--text-primary);
}

.value-compared .value {
    color: var(--text-muted);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .toast,
    .block-scores-expanded,
    .metadata-analysis-expanded {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

/* Floating Comparison Button */
#floatingCompareBtn {
    transition: all 0.3s ease;
}

#floatingCompareBtn:hover .absolute {
    opacity: 1;
    visibility: visible;
}

#floatingCompareBtn .absolute {
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

/* Ensure both floating buttons don't overlap */
@media (min-width: 640px) {
    /* When both buttons are shown, position them side by side */
    #selectionToolbar:not(.hidden) ~ #floatingCompareBtn {
        bottom: 2rem;
        right: 22rem; /* Move comparison button to the left of chat toolbar */
    }
}

/* Comparison Modal */
#comparisonModal {
    backdrop-filter: blur(4px);
}

.comparison-results {
    max-height: 70vh;
    overflow-y: auto;
}

.source-comparison-results {
    max-height: 70vh;
    overflow-y: auto;
}

.comparison-results table {
    font-size: 0.875rem;
}

.comparison-results td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comparison-results td:hover {
    white-space: normal;
    word-wrap: break-word;
}

/* ==========================================
   Clean Professional Score Display
   ========================================== */

/* Combined search clean display */
.score-display-clean {
    padding: 8px 0;
}

.primary-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
}

.score-main {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.score-components {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.component-score {
    font-size: 0.8125rem;
    padding: 3px 8px;
    background: #f9fafb;
    border-radius: 4px;
    color: #4b5563;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.component-score:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.component-score.image {
    border-left: 3px solid #3b82f6;
}

.component-score.text {
    border-left: 3px solid #10b981;
}

/* Simplified Block Match Indicator */
.block-match-indicator {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.best-match-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.best-match-text {
    color: #374151;
    font-weight: 500;
}

.match-percent {
    color: #059669;
    font-weight: 700;
    margin-left: 6px;
}

.btn-text-link {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-text-link:hover {
    background: #f0f1ff;
    color: #4f46e5;
}

/* Expandable Block Details Animation */
.block-scores-expanded .block-scores-container {
    animation: expandDown 0.3s ease-out;
}

@keyframes expandDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

/* Responsive adjustments for score display */
@media (max-width: 768px) {
    .score-component {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .score-bar {
        width: 100%;
    }
    
    .block-scores-mini {
        font-size: 0.75rem;
    }
}

/* ==========================================
   Source-Based Comparison Styling
   ========================================== */

/* Source Drawing Indicators */
.source-drawing {
    position: relative;
    border-left: 4px solid var(--brand-accent); /* Bruviti orange */
    background-color: rgba(253, 100, 1, 0.05);
}

.source-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: var(--brand-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Comparison Dropdown Styling */
#comparisonDropdown .dropdown-content li:hover {
    background-color: var(--surface-sunken);
}

#comparisonDropdown .dropdown-content li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

#comparisonDropdown .dropdown-content li a:hover {
    background-color: var(--surface-sunken);
    color: var(--text-primary);
}

/* Source-based comparison results styling */
.source-comparison-results .source-header {
    background-color: var(--surface-sunken);
    border: 1px solid var(--brand-accent);
    border-radius: 0.5rem;
}

.source-comparison-results .comparison-card {
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.source-comparison-results .comparison-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.source-comparison-results .differences-list {
    margin-top: 0.75rem;
}

.source-comparison-results .difference-item {
    padding: 0.5rem;
    background-color: #F8FAFC;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #E5E7EB;
}

.source-comparison-results .difference-item.value-mismatch {
    border-left-color: var(--brand-accent);
}

.source-comparison-results .difference-item.missing-in-comparison {
    border-left-color: #EF4444;
}

.source-comparison-results .difference-item.extra-in-comparison {
    border-left-color: #10B981;
}

/* Mobile responsiveness for source indicators */
@media (max-width: 768px) {
    .source-badge {
        font-size: 0.625rem;
        padding: 0.125rem 0.5rem;
        top: 0.25rem;
        left: 0.25rem;
    }
    
    .source-drawing {
        border-left-width: 3px;
    }
}

/* Enhanced Source Comparison Table Styling */
.source-comparison-results .comparison-table th.bg-orange-50 {
    border: 2px solid var(--brand-accent);
    border-bottom: 3px solid var(--brand-accent);
    position: relative;
}

.source-comparison-results .comparison-table th.bg-orange-50::before {
    content: '★';
    position: absolute;
    top: 2px;
    right: 4px;
    color: var(--brand-accent);
    font-size: 0.75rem;
}

/* Source value cells highlighting */
.source-comparison-results .comparison-table td[style*="rgba(253, 100, 1, 0.08)"] {
    border-left: 3px solid var(--brand-accent);
    font-weight: 700;
}

/* Different comparison value highlighting */
.source-comparison-results .comparison-table td[style*="rgba(239, 68, 68, 0.08)"] {
    border-left: 3px solid #EF4444;
}

.source-comparison-results .comparison-table td[style*="rgba(34, 197, 94, 0.08)"] {
    border-left: 3px solid #22C55E;
}

.source-comparison-results .comparison-table td[style*="rgba(59, 130, 246, 0.08)"] {
    border-left: 3px solid #3B82F6;
}

.source-comparison-results .comparison-table td[style*="rgba(251, 191, 36, 0.08)"] {
    border-left: 3px solid #FBBF24;
}

/* Checkmark styling */
.source-comparison-results .text-green-600 {
    font-size: 1.125rem;
}

/* Center-align checkmarks and special text */
.source-comparison-results .text-center {
    text-align: center;
}

/* Similarity score badges */
.similarity-score-high {
    background-color: #10B981;
    color: white;
}

.similarity-score-medium {
    background-color: #F59E0B;
    color: white;
}

.similarity-score-low {
    background-color: #EF4444;
    color: white;
}

/* Enhanced source header */
.source-header {
    position: relative;
    overflow: hidden;
}

.source-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-accent-hover), var(--brand-accent));
    animation: sourceGlow 3s ease-in-out infinite;
}

@keyframes sourceGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Component Scores Styling */
.component-scores-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.score-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.score-icon {
    font-size: 14px;
}

.drawing-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.parts-score {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.text-score {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.overall-score {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Legacy scores fallback styling */
.legacy-scores {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 14px;
}

.visual-match {
    color: #667eea;
    font-weight: 500;
}

.metadata-similarity {
    color: #4facfe;
    font-weight: 500;
}

/* Comparison header improvements */
.comparison-header {
    padding: 12px;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 8px;
    margin-bottom: 12px;
}

.compared-with {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .component-scores-container {
        gap: 6px;
    }
    
    .score-badge {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .score-icon {
        font-size: 12px;
    }
}
