/* ========================================
   ENTERPRISE BENCHMARKING TOOL
   Professional Design System v2.0
   ======================================== */

/* Google Fonts - IBM Plex Sans for enterprise readability */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ========================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */
:root {
    /* Primary Palette - Deep Navy Authority */
    --primary-900: #0a1628;
    --primary-800: #0f2744;
    --primary-700: #163a5f;
    --primary-600: #1e4d7b;
    --primary-500: #2563a8;
    --primary-400: #4b89c8;
    --primary-300: #7aabe0;
    --primary-200: #a9cdf0;
    --primary-100: #daeaf9;
    --primary-50: #f0f7fc;

    /* Accent - Refined Gold */
    --accent-600: #b8860b;
    --accent-500: #d4a012;
    --accent-400: #e6b422;
    --accent-300: #f0c84a;
    --accent-200: #f8dc7f;
    --accent-100: #fcf0c0;

    /* Success - Emerald */
    --success-700: #047857;
    --success-600: #059669;
    --success-500: #10b981;
    --success-400: #34d399;
    --success-100: #d1fae5;
    --success-50: #ecfdf5;

    /* Warning - Amber */
    --warning-600: #d97706;
    --warning-500: #f59e0b;
    --warning-100: #fef3c7;

    /* Error - Rose */
    --error-600: #dc2626;
    --error-500: #ef4444;
    --error-100: #fee2e2;

    /* Neutral - Cool Gray */
    --neutral-950: #0b0f19;
    --neutral-900: #111827;
    --neutral-800: #1f2937;
    --neutral-700: #374151;
    --neutral-600: #4b5563;
    --neutral-500: #6b7280;
    --neutral-400: #9ca3af;
    --neutral-300: #d1d5db;
    --neutral-200: #e5e7eb;
    --neutral-100: #f3f4f6;
    --neutral-50: #f9fafb;
    --white: #ffffff;

    /* Typography */
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

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

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --sidebar-width: 220px;
    --sidebar-collapsed: 72px;
    --header-height: 80px;
    --content-max-width: 1400px;
}

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

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

body {
    font-family: var(--font-sans);
    background: var(--neutral-50);
    color: var(--neutral-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   LOGO & HEADER
   ======================================== */
.logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: var(--header-height);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    border-right: 1px solid var(--neutral-200);
    border-bottom: 1px solid var(--neutral-200);
}

.site-logo {
    height: 48px;
    width: auto;
    display: block;
    transition: transform var(--transition-base);
}

.logo-container:hover .site-logo {
    transform: scale(1.02);
}

/* ========================================
   LEFT NAVIGATION SIDEBAR
   ======================================== */
.left-navigation {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--neutral-200);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--header-height) + var(--space-4));
}

.nav-btn {
    position: relative;
    width: 100%;
    padding: var(--space-4) var(--space-6);
    background: transparent;
    border: none;
    color: var(--neutral-600);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all var(--transition-base);
    border-left: 3px solid transparent;
}

.nav-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-500);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.nav-btn:hover {
    background: var(--neutral-50);
    color: var(--primary-700);
}

.nav-btn:hover::before {
    transform: scaleY(1);
}

.nav-btn.active {
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: 600;
    border-left-color: var(--primary-500);
}

.nav-btn.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    font-size: 14px;
    letter-spacing: 0.01em;
}

/* ========================================
   VIEW CONTAINERS & LAYOUT
   ======================================== */
.view-container {
    min-height: 100vh;
    padding-left: var(--sidebar-width);
    padding-top: var(--space-6);
    background: var(--neutral-50);
    animation: fadeIn var(--transition-slow) ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-8);
}

/* ========================================
   PANEL SYSTEM
   ======================================== */
.panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    border: 1px solid var(--neutral-200);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

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

/* Panel Header - Collapsible */
.panel-header-thin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-700) 100%);
    color: var(--white);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-base);
}

.panel-header-thin:hover {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-600) 100%);
}

.panel-header-thin * {
    pointer-events: none;
}

.panel-header-thin h2 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0;
    flex: 1;
}

.result-count {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    margin-right: var(--space-2);
}

.collapse-icon {
    font-size: 12px;
    transition: transform var(--transition-base);
    opacity: 0.8;
}

/* Collapsed Panel State */
.panel.collapsed .panel-content {
    display: none !important;
}

.panel.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.panel.collapsed .panel-header-thin {
    background: linear-gradient(135deg, var(--neutral-600) 0%, var(--neutral-500) 100%);
}

/* Panel Content */
.panel-content {
    padding: var(--space-4);
    transition: all var(--transition-slow);
}

/* Panel Variants */
.panel-1 {
    border: 1px solid var(--neutral-200);
}

.panel-1 .panel-content {
    padding: var(--space-4);
}

.panel-2 .panel-header-thin,
.panel-3 .panel-header-thin,
.panel-5 .panel-header-thin {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-700) 100%);
}

/* AI Panel - Distinct Green */
.panel-4 .panel-header-thin {
    background: linear-gradient(135deg, var(--success-700) 0%, var(--success-600) 100%);
}

/* ========================================
   SEARCH SECTION
   ======================================== */
.search-section {
    margin-bottom: var(--space-5);
}

.search-box {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
}

#searchInput {
    flex: 1;
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-sans);
    font-size: 15px;
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    background: var(--white);
    color: var(--neutral-800);
    transition: all var(--transition-base);
}

#searchInput:hover {
    border-color: var(--primary-300);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(37, 99, 168, 0.12);
}

#searchInput::placeholder {
    color: var(--neutral-400);
}

#searchBtn {
    padding: var(--space-4) var(--space-8);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    min-width: 120px;
    letter-spacing: 0.02em;
}

#searchBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-400) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#searchBtn:active:not(:disabled) {
    transform: translateY(0);
}

#searchBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading {
    padding: var(--space-5);
    text-align: center;
}

.loading p {
    color: var(--neutral-500);
    font-size: 12px;
    margin-top: var(--space-2);
}

.spinner {
    border: 2px solid var(--neutral-200);
    border-top: 2px solid var(--primary-500);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.loading-spinner-svg {
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   PLACEHOLDER CONTENT
   ======================================== */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    color: var(--neutral-500);
    text-align: center;
    padding: var(--space-3);
}

.search-placeholder-box-small {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    max-width: 360px;
    border: 1px solid var(--neutral-200);
}

.search-placeholder-icon-small {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    opacity: 0.6;
}

.search-placeholder-text {
    text-align: left;
}

.search-placeholder-title-small {
    font-weight: 600;
    font-size: 12px;
    color: var(--neutral-600);
    margin: 0 0 2px 0;
}

.search-placeholder-desc-small {
    font-size: 11px;
    color: var(--neutral-400);
    line-height: 1.3;
    margin: 0;
}

/* ========================================
   RESULTS SECTION
   ======================================== */
.results-section {
    margin-top: var(--space-6);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--neutral-200);
}

.result-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-900);
}

.result-meta {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* Badges */
.badge {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-database {
    background: var(--success-100);
    color: var(--success-700);
}

.badge-cache {
    background: var(--warning-100);
    color: var(--warning-600);
}

.badge-ai_processor {
    background: var(--primary-100);
    color: var(--primary-700);
}

.processing-time {
    font-size: 13px;
    color: var(--neutral-500);
    font-family: var(--font-mono);
}

/* Error Message */
.error-message {
    background: var(--error-100);
    color: var(--error-600);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border-left: 4px solid var(--error-500);
    font-size: 14px;
}

/* Ambiguous Item Warning (amber instead of red) */
.error-message.ambiguous-warning {
    background: var(--warning-100);
    border: none;
    border-left: 4px solid var(--warning-500);
    padding: 0;
    display: block;
    color: #451a03;
}

.ambiguous-warning .ambiguous-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 8px;
}

.ambiguous-warning .ambiguous-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--warning-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ambiguous-warning .ambiguous-icon svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.ambiguous-warning .ambiguous-titles {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ambiguous-warning .ambiguous-title {
    font-weight: 600;
    font-size: 14px;
    color: #78350f;
    line-height: 1.3;
}

.ambiguous-warning .ambiguous-subtitle {
    font-size: 13px;
    color: #92400e;
    line-height: 1.3;
}

.ambiguous-warning .ambiguous-detail {
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
    padding: 0 16px 12px;
}

/* ========================================
   INFO ROW (Basic Info Display)
   ======================================== */
.info-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--neutral-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    border-left: 4px solid var(--primary-500);
}

.info-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.info-inline label {
    font-weight: 600;
    color: var(--neutral-500);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-inline span {
    font-size: 14px;
    color: var(--neutral-800);
    font-weight: 500;
}

/* ========================================
   TABLES - Enterprise Style
   ======================================== */
.attributes-compact {
    margin-top: var(--space-4);
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    display: flex;
    background: var(--white);
}

.attributes-table {
    width: 50%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--white);
    font-family: var(--font-sans);
}

.attributes-table tr {
    border-bottom: 1px solid var(--neutral-100);
}

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

.attributes-table tr:hover {
    background: var(--primary-50);
}

.attributes-table td {
    padding: var(--space-3) var(--space-4);
}

.attr-name {
    font-weight: 600;
    color: var(--primary-700);
    width: 45%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.attr-value {
    color: var(--neutral-700);
    width: 55%;
}

.no-attributes {
    color: var(--neutral-500);
    font-style: italic;
    text-align: center;
    padding: var(--space-8);
}

/* Purchase History Table */
.purchase-history-table-container {
    margin-top: var(--space-4);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.purchase-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: var(--font-sans);
}

.purchase-history-table thead {
    background: var(--neutral-50);
}

.purchase-history-table th {
    padding: var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--neutral-600);
    border-bottom: 2px solid var(--neutral-200);
}

.purchase-history-table tbody tr {
    border-bottom: 1px solid var(--neutral-100);
    transition: background var(--transition-fast);
}

.purchase-history-table tbody tr:hover {
    background: var(--primary-50);
}

.purchase-history-table tbody tr.clickable {
    cursor: pointer;
}

.purchase-history-table tbody tr.clickable:hover {
    background: var(--primary-100);
}

.purchase-history-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--neutral-700);
}

/* Match Types */
.match-type {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
}

.match-sap_id { color: var(--success-600); }
.match-p-n { color: var(--warning-600); }
.match-specs { color: var(--primary-500); }

/* Price Styling */
.price {
    font-weight: 600;
    color: var(--neutral-800);
    font-family: var(--font-mono);
}

.web-price {
    font-weight: 600;
    color: var(--success-600);
    font-family: var(--font-mono);
}

/* Links */
.rs-link {
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.rs-link:hover {
    color: var(--primary-600);
    background: var(--primary-50);
    text-decoration: underline;
}

.rs-text {
    color: var(--neutral-400);
    font-size: 13px;
}

.date { color: var(--neutral-500); font-size: 13px; }
.vendor { color: var(--neutral-700); }

.sap-id {
    font-family: var(--font-mono);
    color: var(--primary-600);
    font-weight: 600;
    font-size: 13px;
}

.match-summary {
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 13px;
    color: var(--neutral-600);
    font-weight: 500;
}

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* ========================================
   MODAL SYSTEM
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    animation: modalFadeIn var(--transition-base) ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    margin: 4% auto;
    width: 90%;
    max-width: 1000px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--transition-slow) ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-700) 100%);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.modal-close {
    color: var(--white);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

/* Modal Description */
.modal-description {
    margin-bottom: var(--space-6);
    padding: var(--space-5);
    background: linear-gradient(135deg, var(--neutral-50) 0%, var(--primary-50) 100%);
    border-left: 4px solid var(--primary-500);
    border-radius: var(--radius-md);
}

.description-text {
    font-size: 15px;
    color: var(--neutral-700);
    line-height: 1.7;
    font-weight: 500;
}

/* Info Grid in Modal */
.info-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.info-item {
    display: table-row;
    transition: background var(--transition-fast);
}

.info-item:hover {
    background: var(--primary-50);
}

.info-label {
    font-weight: 600;
    color: var(--primary-700);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    display: table-cell;
    width: 30%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--neutral-50);
}

.info-value {
    color: var(--neutral-700);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    display: table-cell;
    width: 70%;
}

/* Attributes Grid in Modal */
.attributes-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-300), transparent);
    margin: var(--space-8) 0;
}

.attributes-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.attr-item {
    display: table-row;
    transition: background var(--transition-fast);
}

.attr-item:hover {
    background: var(--primary-50);
}

.attr-label {
    font-weight: 600;
    color: var(--primary-700);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    display: table-cell;
    width: 40%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--neutral-50);
}

.attr-val {
    color: var(--neutral-700);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    display: table-cell;
    width: 60%;
}

/* ========================================
   ONLINE PRODUCT DISPLAY
   ======================================== */
.online-product-header {
    text-align: center;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--neutral-50) 0%, var(--primary-50) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.online-product-header h3 {
    font-size: 20px;
    color: var(--primary-800);
    margin-bottom: var(--space-3);
    font-weight: 600;
}

.online-product-header .product-brand {
    font-size: 15px;
    color: var(--neutral-600);
    margin: var(--space-2) 0;
}

.online-product-header .product-part {
    font-size: 14px;
    color: var(--neutral-700);
    font-weight: 600;
    font-family: var(--font-mono);
}

.online-product-header .product-price {
    font-size: 24px;
    color: var(--success-600);
    font-weight: 700;
    margin-top: var(--space-3);
    font-family: var(--font-mono);
}

.online-product-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: var(--neutral-50);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--neutral-200);
}

.online-product-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.image-placeholder,
.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 250px;
    background: var(--neutral-100);
    color: var(--neutral-500);
    font-size: 15px;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--neutral-300);
}

.btn-view-product {
    display: inline-block;
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.btn-view-product:hover {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-400) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Clickable Rows */
.online-item-row.clickable {
    cursor: pointer;
}

.online-item-row.clickable:hover {
    background: var(--primary-100) !important;
}

.cell-content {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-link {
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.view-link:hover {
    background: var(--primary-50);
    text-decoration: underline;
}

/* ========================================
   CATEGORY LOOKUP MODE
   ======================================== */
.category-lookup-section {
    padding: var(--space-5) 0;
}

.category-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-weight: 600;
    color: var(--neutral-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input[type="text"] {
    padding: var(--space-4);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all var(--transition-base);
    background: var(--white);
}

.form-group input[type="text"]:hover {
    border-color: var(--primary-300);
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(37, 99, 168, 0.12);
}

.section-label {
    display: block;
    font-weight: 700;
    color: var(--primary-700);
    font-size: 14px;
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.attribute-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-5);
    padding: var(--space-5);
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    margin-top: var(--space-3);
    max-height: 320px;
    overflow-y: auto;
}

/* Category Results Table */
.table-scroll-container {
    overflow-x: auto;
    margin-top: var(--space-4);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
}

.results-count {
    font-weight: 600;
    color: var(--neutral-700);
    margin-bottom: var(--space-3);
    padding: var(--space-4);
    background: var(--neutral-50);
    border-bottom: 1px solid var(--neutral-200);
    font-size: 14px;
}

.category-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1200px;
}

.category-results-table thead {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-700) 100%);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.category-results-table th {
    padding: var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.category-results-table tbody tr {
    border-bottom: 1px solid var(--neutral-100);
    transition: background var(--transition-fast);
}

.category-results-table tbody tr:hover {
    background: var(--primary-50);
}

.category-results-table td {
    padding: var(--space-3) var(--space-4);
    border-right: 1px solid var(--neutral-100);
}

/* ========================================
   AI BENCHMARKING STYLES
   ======================================== */
.ai-reasoning {
    background: linear-gradient(135deg, var(--success-50) 0%, var(--success-100) 100%);
    border: 1px solid var(--success-400);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    font-size: 14px;
    line-height: 1.6;
    color: var(--success-700);
}

.ai-results-table-container {
    overflow-x: auto;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
}

.ai-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.ai-results-table thead {
    background: linear-gradient(135deg, var(--success-700) 0%, var(--success-600) 100%);
    color: var(--white);
}

.ai-results-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-results-table tbody tr {
    border-bottom: 1px solid var(--neutral-100);
    transition: background var(--transition-fast);
}

.ai-results-table tbody tr:hover {
    background: var(--success-50);
}

.ai-results-table td {
    padding: var(--space-3) var(--space-4);
    border-right: 1px solid var(--neutral-100);
    vertical-align: middle;
}

/* Column widths */
.ai-results-table .col-type { width: 120px; }
.ai-results-table .col-item { min-width: 200px; max-width: 300px; }
.ai-results-table .col-mfr { width: 120px; }
.ai-results-table .col-part { width: 100px; }
.ai-results-table .col-price { width: 90px; }
.ai-results-table .col-azn { width: 90px; }
.ai-results-table .col-country { width: 70px; }
.ai-results-table .col-source { width: 130px; }
.ai-results-table .col-incoterm { width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.ai-results-table .col-date { width: 100px; }
.ai-results-table .col-vendor { width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ai-results-table .col-reason { min-width: 150px; max-width: 250px; }

.reasoning-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
    display: block;
}

.ai-results-table .price-azn {
    font-weight: 600;
    color: var(--success-600);
    font-family: var(--font-mono);
}

/* Tier Cell - Vertical Stack */
.tier-cell {
    text-align: center;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

/* Tier Badges */
.match-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    min-width: 24px;
    height: 24px;
    letter-spacing: 0.02em;
}

.match-type-label {
    display: block;
    font-size: 9px;
    color: var(--neutral-400);
    font-weight: 500;
    margin-top: 2px;
    line-height: 1;
}

.match-type-a {
    background: var(--success-100);
    color: var(--success-700);
    border: 1px solid var(--success-400);
}

.match-type-b {
    background: var(--primary-100);
    color: var(--primary-700);
    border: 1px solid var(--primary-300);
}

.match-type-c {
    background: var(--warning-100);
    color: var(--warning-600);
    border: 1px solid var(--accent-300);
}

.match-type-d {
    background: var(--error-100);
    color: var(--error-600);
    border: 1px solid var(--error-500);
}

.source-link {
    color: var(--success-600);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-link:hover {
    color: var(--success-700);
    text-decoration: underline;
}

.ai-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--neutral-200);
    font-size: 12px;
    color: var(--neutral-500);
    text-align: center;
}

/* Tier C Toggle Switch */
.ai-reasoning-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.ai-reasoning-row .ai-reasoning {
    flex: 1;
    margin-bottom: 0;
}

.tier-toggle-container {
    display: flex;
    justify-content: flex-end;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.tier-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}

.tier-toggle-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--neutral-600);
}

.tier-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
}

.tier-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tier-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--neutral-300);
    transition: 0.3s;
    border-radius: 20px;
}

.tier-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.tier-toggle-switch input:checked + .tier-toggle-slider {
    background-color: var(--warning-500);
}

.tier-toggle-switch input:checked + .tier-toggle-slider:before {
    transform: translateX(16px);
}

/* Hidden Tier C rows */
.ai-results-table tr.tier-c-row.hidden {
    display: none;
}


.ai-no-results,
.ai-error {
    text-align: center;
    padding: var(--space-8);
}

.ai-error .error-message {
    color: var(--error-600);
    background: var(--error-100);
    border: 1px solid var(--error-500);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    .left-navigation {
        width: var(--sidebar-collapsed);
    }

    .logo-container {
        width: var(--sidebar-collapsed);
    }

    .nav-text {
        display: none;
    }

    .view-container {
        padding-left: var(--sidebar-collapsed);
    }

    .main-container {
        padding: var(--space-5);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 60px;
        --header-height: 64px;
    }

    .logo-container {
        padding: var(--space-2);
    }

    .site-logo {
        height: 36px;
    }

    .main-container {
        padding: var(--space-4);
    }

    .panel-content {
        padding: var(--space-4);
    }

    .search-box {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .modal-content {
        width: 95%;
        margin: 3% auto;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.clickable {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

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

.text-muted {
    color: var(--neutral-500);
}

.font-mono {
    font-family: var(--font-mono);
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .left-navigation,
    .logo-container,
    .nav-btn {
        display: none !important;
    }

    .view-container {
        padding-left: 0 !important;
        padding-top: 0 !important;
    }
}
