/* ===== Design Tokens (CSS Custom Properties) ===== */
:root {
    /* Spacing scale - use these for consistent layout */
    --spacing-xs: 0.25rem;   /* 4px - tight spacing */
    --spacing-sm: 0.5rem;    /* 8px - small gaps */
    --spacing-md: 1rem;      /* 16px - standard spacing */
    --spacing-lg: 1.5rem;    /* 24px - section spacing */
    --spacing-xl: 2rem;      /* 32px - large spacing */
    --spacing-2xl: 2.5rem;   /* 40px - extra large */

    /* Container padding */
    --container-padding: 20px;
    --card-padding: 30px;

    /* Color palette - semantic tokens */
    --primary-color: #0d6efd;
    --primary-dark: #2980b9;      /* Darker primary for hover states */
    --color-primary: #0d6efd;  /* Alias for consistency */
    --color-primary-dark: #0a58ca;  /* Darker shade for hover states */
    --color-success: #27ae60;
    --color-error: #e74c3c;  /* Error/danger state color */
    --accent-color: #0d6efd;  /* Accent color for focus states */
    --success: #27ae60;
    --success-light: #d4edda;     /* Light success background */
    --success-dark: #155724;      /* Dark success text */
    --link-color: #0066cc;
    --border-color: #ddd;         /* Default border color */

    /* Text colors */
    --text-color: #2c3e50;        /* Default text color */
    --text-secondary: #6c757d;

    /* Font sizes */
    --font-size-sm: 0.875rem;  /* 14px */

    /* Border radius */
    --border-radius-sm: 0.25rem;  /* 4px */
    --border-radius: 0.375rem;    /* 6px - default border radius */

    /* Background colors */
    --bg-light: #f8f9fa;
    --background-secondary: #f5f5f5;
    --background-tertiary: #e0e0e0;

    /* Gray scale */
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;

    /* Dynamic properties (set via JavaScript for CSP compliance) */
    --progress-width: 0%;
    --progress-color: var(--color-success);
}

/* ========================================================================== */
/* Display Utility Classes (CSP-compliant alternatives to inline styles)      */
/* ========================================================================== */
/* Use these classes with JavaScript classList.add/remove/toggle instead of   */
/* directly manipulating element.style.display                                */

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

.d-inline-flex { display: inline-flex !important; }

/* Visibility utilities (alternative to display toggling) */
.visible { visibility: visible !important; }

/* Show/hide pattern - element starts hidden, JS adds 'show' class
 * Usage in HTML: class="hidden-until-shown"
 * Usage in JS: element.classList.add('show') / element.classList.remove('show') */
.hidden-until-shown { display: none; }
.hidden-until-shown.show { display: block; }

.hidden-until-shown.show-flex { display: flex; }

.hidden-until-shown.show-inline { display: inline-block; }

/* Common flex layouts used throughout templates */
.flex-between {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }

/* Margin utilities */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-md { margin-bottom: var(--spacing-md) !important; }
.mb-lg { margin-bottom: var(--spacing-lg) !important; }
.mt-md { margin-top: var(--spacing-md) !important; }
.mt-lg { margin-top: var(--spacing-lg) !important; }
.cursor-pointer { cursor: pointer; }

/* Padding utilities */
.p-lg { padding: var(--spacing-lg) !important; }

/* Width utilities */
.w-100 { width: 100% !important; }

/* Text utilities */
.text-sm { font-size: 0.9em; }
.text-center { text-align: center; }
.text-primary { color: #1976D2; }
.text-link { color: #3498db; }
.link-inline { color: inherit; text-decoration: underline; }
.font-bold { font-weight: bold; }

/* History page utilities */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-md);
}
.empty-state {
    text-align: center;
    color: #95a5a6;
    padding: 2rem;
}
.scrollable-table {
    max-height: 400px;
    overflow-y: auto;
}
.sticky-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}
.col-status { width: 90px; text-align: center; }
.col-price { width: 80px; }

/* Flex alignment utilities */
.align-center { align-items: center; }

/* Table column width utilities */
.col-narrow { width: 40px; }
.col-actions { width: 110px; }

/* Progress phase header (active page) */
.progress-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.progress-phase-title {
    margin: 0;
    font-size: 1rem;
}

/* Cart review styling */
.cart-review-header {
    color: #007bff;
    margin-bottom: var(--spacing-sm);
}

.cart-review-description {
    margin-bottom: var(--spacing-lg);
}

.add-item-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.add-item-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
}

.add-item-btn {
    white-space: nowrap;
}

/* Fuzzy match styling */
.fuzzy-match-notice {
    background-color: #e3f2fd;
    border: 2px solid #2196F3;
    border-radius: 8px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.fuzzy-match-title {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.05em;
    font-weight: 500;
    color: #1976D2;
}

.fuzzy-match-desc {
    margin: 0;
    font-size: 0.95em;
}

.similarity-badge {
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    /* CSP-compliant: use CSS custom property for dynamic color */
    background-color: var(--badge-color, #ffc107);
}
.similarity-badge.high-match { --badge-color: #28a745; }
.similarity-badge.medium-match { --badge-color: #ffc107; }

/* Alert/Message box styles (for standalone pages without Bootstrap) */
.alert-box {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-box-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-box a {
    color: inherit;
    font-weight: bold;
}

/* Text color utilities */
.text-muted { color: #6c757d; }
.text-success { color: #28a745; }
.text-error { color: #dc3545; }
.text-warning { color: #ffc107; }

.results-section {
    margin-top: var(--spacing-lg);
}

.run-item {
    margin-bottom: 0.75rem;
}

.run-item-error {
    color: #721c24;
    font-size: 0.85em;
    font-style: italic;
}

/* Status box styles (used in subscription page) */
.status-box {
    padding: 1rem;
    border-radius: 4px;
}

.status-box-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.status-box-neutral {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Progress bar */
.progress-bar {
    margin-top: 0.5rem;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    transition: width 0.3s;
    width: 0;
    background: linear-gradient(to right, #3498db, #2ecc71);
}

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

.progress-bar-inner.indeterminate {
    width: 30%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
    transition: none;
}

/* Progress bar width classes (CSP-compliant alternative to inline styles) */
.progress-bar-inner.progress-5 { width: 5%; }
.progress-bar-inner.progress-10 { width: 10%; }
.progress-bar-inner.progress-15 { width: 15%; }
.progress-bar-inner.progress-20 { width: 20%; }
.progress-bar-inner.progress-25 { width: 25%; }
.progress-bar-inner.progress-30 { width: 30%; }
.progress-bar-inner.progress-35 { width: 35%; }
.progress-bar-inner.progress-40 { width: 40%; }
.progress-bar-inner.progress-45 { width: 45%; }
.progress-bar-inner.progress-50 { width: 50%; }
.progress-bar-inner.progress-55 { width: 55%; }
.progress-bar-inner.progress-60 { width: 60%; }
.progress-bar-inner.progress-65 { width: 65%; }
.progress-bar-inner.progress-70 { width: 70%; }
.progress-bar-inner.progress-75 { width: 75%; }
.progress-bar-inner.progress-80 { width: 80%; }
.progress-bar-inner.progress-85 { width: 85%; }
.progress-bar-inner.progress-90 { width: 90%; }
.progress-bar-inner.progress-95 { width: 95%; }
.progress-bar-inner.progress-100 { width: 100%; }

/* Progress bar color modifiers */
.progress-bar-inner.progress-error { background-color: var(--color-error); }

/* Info box (used for waiting states) */
.info-box {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    padding: 1rem;
    border-radius: 4px;
}

/* Donation history row */
.donation-row {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.donation-status {
    font-weight: 500;
    font-size: 0.9em;
}

/* Form field helper text */
.form-help {
    color: #6c757d;
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875em;
}

/* Form label */
.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* Form input (generic) */
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

/* Donate form */
.donate-form {
    margin-top: 1.5rem;
}

.donate-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

/* Payment status container */
.payment-status {
    margin-top: 1.5rem;
}

/* Notice boxes (for legacy/in-progress states) */
.notice-box {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.notice-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.notice-warning .notice-text {
    color: #856404;
}

.notice-info {
    background: #cce5ff;
    border: 1px solid #007bff;
}

.notice-info .notice-text {
    color: #004085;
}

.notice-text {
    margin: 0.5rem 0 0 0;
}

/* Unit price comparison warning - inline layout with icon */
.unit-price-warning {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.unit-price-warning .notice-icon {
    font-size: 1.1em;
    color: #856404;
}

.unit-price-warning .notice-text {
    margin: 0;
}

/* Text alignment utilities */
.text-center { text-align: center; }

/* Usage limit modal */
.usage-limit-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Standalone page container styles */
.standalone-container {
    max-width: 500px;
    margin: 100px auto;
    padding: 20px;
}

.standalone-container.standalone-wide {
    max-width: 600px;
}

.standalone-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.standalone-card h1 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Form styles for standalone pages */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.form-group small {
    color: #666;
    font-size: 0.85em;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    color: white;
}

.btn-submit-primary {
    background-color: #007bff;
}

.btn-submit-success {
    background-color: #28a745;
}

.btn-submit:hover {
    opacity: 0.9;
}

/* Anchor buttons (links styled as buttons) */
a.btn-submit {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

/* Text color utilities */
.text-muted { color: #6c757d; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-center { text-align: center; }

/* OAuth Account Card (account-settings page) */
.oauth-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-unlink {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-unlink:hover {
    background-color: #c82333;
}

/* Data & Privacy section (account-settings page) */
.data-privacy-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border: 1px solid #ddd;
    border-radius: 4px;
}

.data-privacy-action p {
    font-size: 14px;
}

/* Google OAuth button styling */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 0;
}

.header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

nav {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    border-top: 1px solid #ecf0f1;
    padding-top: 15px;
    align-items: center;
}

.nav-scroll {
    display: flex;
    gap: 10px;
    align-items: center;
    /* Mobile responsiveness: allow horizontal scroll instead of cutting off */
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
}

nav a, nav button {
    flex-shrink: 0;  /* Prevent items from shrinking on mobile */
}

nav a {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    color: #7f8c8d;
    font-weight: 500;
    transition: all 0.2s;
}

nav a:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

nav a.active {
    background: #3498db;
    color: white;
}

/* Settings gear dropdown in nav */
.nav-settings-wrapper {
    position: relative;
    display: inline-block;
}

.nav-settings-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-size: 1.5em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.nav-settings-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.nav-settings-btn.active {
    background: #3498db;
    color: white;
}

.nav-settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--spacing-xs, 4px);
    z-index: 1000;
    background: white;
    border: 1px solid #ecf0f1;
    border-radius: var(--border-radius, 4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
}

.nav-settings-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #2c3e50;
    text-decoration: none;
    white-space: nowrap;
}

.nav-settings-dropdown a:hover {
    background: #ecf0f1;
}

/* Logout button in nav - matches tab size, aligns right */
nav #logoutBtn {
    padding: 8px 16px;
    font-size: inherit;
    font-weight: 500;
    line-height: inherit;
}

/* Language toggle in nav */
.lang-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: #ecf0f1;
    border-radius: 4px;
    padding: 2px;
}

.lang-toggle button {
    padding: 4px 6px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    opacity: 0.6;
}

.lang-toggle button:hover {
    opacity: 0.9;
}

.lang-toggle button.active {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    opacity: 1;
}

/* Cards */
.card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Forms */
.form-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.help-text {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

/* ===== Button System ===== */

/* Base button styles - applied to all button variants */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

/* Primary button (blue) */
.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.btn-primary:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

/* Secondary button (slate blue) */
.btn-secondary {
    background: #5a6c7d;
    color: white;
}

.btn-secondary:hover {
    background: #4a5a6a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(90, 108, 125, 0.3);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Danger button (red) */
.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Success button (green) */
.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Active state for all buttons */
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.btn-success:active {
    transform: translateY(0);
}

/* Specific button variants - extend base button styles */
/*noinspection CssUnusedSymbol*/
.btn-clear-all,
.btn-abort,
.btn-cancel,
.btn-merge,
.btn-dismiss,
.btn-quick-merge,
.btn-delete,
.btn-view-details,
.btn-skip,
.btn-skip-item,
.btn-custom-search,
.btn-unmerge {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

/* Specific button color overrides */
.btn-clear-all {
    background: #e74c3c;
    color: white;
}

.btn-clear-all:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.btn-abort {
    background: #e74c3c;
    color: white;
}

.btn-abort:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.btn-skip,
.btn-skip-item {
    background: #95a5a6;
    color: white;
}

.btn-skip:hover,
.btn-skip-item:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(149, 165, 166, 0.3);
}

.btn-custom-search {
    background: #3498db;
    color: white;
}

.btn-custom-search:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/*noinspection CssUnusedSymbol*/
.btn-unmerge {
    background: #95a5a6;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.8em;
}

/*noinspection CssUnusedSymbol*/
.btn-unmerge:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

/* Progress */
.progress-phase {
    margin-bottom: 1rem;
}

.progress-percentage {
    font-size: 0.95em;
    font-weight: 600;
    color: #2c3e50;
    min-width: 45px;
    text-align: right;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
}

.progress-text {
    font-size: 1.1em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.progress-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5em;
    vertical-align: middle;
}

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

/* Light variant for use on blue/dark backgrounds (e.g., buttons) */
.progress-spinner-light {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5em;
    vertical-align: middle;
}

/* Red variant for logout buttons */
.progress-spinner-red {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid #f5c6c6;
    border-top-color: #c0392b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5em;
    vertical-align: middle;
}

.progress-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
}

.progress-details:empty {
    display: none;
}

.progress-details p {
    margin: 5px 0;
    color: #555;
}

.planned-items-list h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1em;
}

.planned-items-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.planned-items-list li {
    padding: 8px 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #3498db;  /* Blue - queued/pending */
    color: #555;
    font-size: 0.95em;
}

.planned-items-list li.skipped-item {
    opacity: 0.6;
    border-left-color: #95a5a6;
    text-decoration: line-through;
}

.planned-items-list li.added-item {
    opacity: 0.8;
    border-left-color: #27ae60;  /* Green - successfully added */
    background: #e8f9f0;
}

.planned-items-list li.already-in-cart-item {
    opacity: 0.85;
    border-left-color: #f39c12;
    background: #fff8e1;
    color: #856404;
}

.planned-items-list li.cart-limited-item {
    opacity: 0.85;
    border-left-color: #f39c12;
    background: #fff8e1;
    color: #856404;
}

.planned-items-list li.failed-item {
    opacity: 0.9;
    border-left-color: #e74c3c;
    background: #f8d7da;
    color: #721c24;
}

.planned-items-list li.removed-item {
    opacity: 0.5;
    border-left-color: #95a5a6;
    background: #f5f5f5;
    color: #95a5a6;
}

.removed-content {
    text-decoration: line-through;
}

.removed-label {
    color: #95a5a6;
    font-size: 0.85em;
}

.planned-items-list li strong {
    color: #2c3e50;
    font-weight: 600;
}

.planned-items-list .quantity {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-left: 5px;
}

.planned-items-list .price {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.9em;
    margin-left: 8px;
}

.planned-items-list .product-link {
    color: #2980b9;
    text-decoration: none;
}

.planned-items-list .product-link:hover {
    text-decoration: underline;
}

/* Parallel Matching Item List */

.matching-item-list {
    margin-top: var(--spacing-md);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
}

.matching-item-list-header {
    padding: var(--spacing-sm) var(--spacing-md);
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
}

.matching-item-rows {
    max-height: 400px;
    overflow-y: auto;
}

.matching-item-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid #f0f0f0;
    gap: var(--spacing-sm);
    transition: background 0.2s;
}

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

.matching-item-icon {
    flex-shrink: 0;
    width: 1.5em;
    text-align: center;
    font-size: 1em;
}

.matching-item-name {
    flex: 1;
    font-size: 0.95em;
    min-width: 0;
    overflow: hidden;
}
.matching-item-name > span:first-child {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.matching-item-product {
    display: block;
    font-size: 0.85em;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.matching-item-product a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.matching-item-product a:hover {
    color: #1d4ed8;
}

.matching-item-status {
    flex-shrink: 0;
    font-size: 0.85em;
    color: #888;
}

/* Item status colors */
.matching-item-row.item-pending .matching-item-icon { color: #bbb; }
.matching-item-row.item-searching .matching-item-icon { color: #3498db; }
.matching-item-row.item-matched { background: #f0faf4; }
.matching-item-row.item-matched .matching-item-icon { color: #27ae60; }
.matching-item-row.item-matched .matching-item-status { color: #27ae60; }
.matching-item-row.item-needs-action { background: #fef9e7; }
.matching-item-row.item-needs-action .matching-item-icon { color: #f39c12; }
.matching-item-row.item-no-match { background: #fdf2f2; }
.matching-item-row.item-no-match .matching-item-icon { color: #e74c3c; }
.matching-item-row.item-no-match .matching-item-status { color: #e74c3c; }
.matching-item-row.item-error { background: #fdf2f2; }
.matching-item-row.item-error .matching-item-icon { color: #e74c3c; }

/* Spinner for searching items */
.matching-item-spinner {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    border: 2px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

/* Action button on item row */
.matching-item-action-btn {
    font-size: 0.8em;
    padding: 2px 8px;
    white-space: nowrap;
}

/* "Needs input" banner */
.matching-needs-input-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-top: var(--spacing-sm);
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9em;
    font-weight: 500;
    animation: attention-pulse 2s ease-in-out infinite;
}

.matching-needs-input-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    background: #ffc107;
    color: #856404;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9em;
    flex-shrink: 0;
}

@keyframes attention-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255, 193, 7, 0); }
}

/* Results */

.success h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.success p {
    margin: 10px 0;
}

.next-step a {
    color: var(--primary-color);
    text-decoration: underline;
}

.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 20px;
    border-radius: 4px;
    color: #721c24;
}

.error h3 {
    margin-bottom: 15px;
}

.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 20px;
    border-radius: 4px;
    color: #856404;
}

.warning h3 {
    margin-bottom: 15px;
}

.warning p {
    margin: 10px 0;
}

/* ========================================================================== */
/* Run Results Styles (replacing inline styles from run-results.js)           */
/* ========================================================================== */

/* Cookidoo error notice - warning style box */
.cookidoo-error-notice {
    margin: var(--spacing-md) 0;
    padding: 0.75rem;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.cookidoo-error-notice h4 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    color: #856404;
}

.cookidoo-error-notice p {
    margin: 0;
    font-size: 0.9em;
}

.cookidoo-error-notice .notice-continuation {
    margin: var(--spacing-sm) 0 0 0;
    font-size: 0.85em;
    color: #666;
}

/* Failed items section - error style box */
.failed-items-section {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.failed-items-section h4 {
    margin-top: 0;
    color: #721c24;
}

.failed-items-section .failed-items-intro {
    margin-bottom: var(--spacing-sm);
    font-size: 0.9em;
    color: #666;
}

.failed-items-section ul {
    margin: 0;
    padding-left: 20px;
}

.failed-items-section .failed-item {
    margin-bottom: 0.75rem;
}

.failed-items-section .failed-item .item-qty {
    color: #666;
    font-size: 0.9em;
}

.failed-items-section .failed-item .failure-reason {
    color: #721c24;
    font-size: 0.85em;
    font-style: italic;
}

/* Result action buttons container - consistent with modal-actions */
.result-actions {
    margin-top: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Mark owned section */
.mark-owned-section {
    margin-top: var(--spacing-lg);
}

/* Stats line styling */
.stats-line {
    color: #666;
    font-size: 0.9em;
}

/* Failed count text */
.text-error-dark {
    color: #721c24;
}

/* Help text styling */
.help-text-small {
    margin-top: var(--spacing-md);
    color: #666;
    font-size: 0.85em;
}

/* Button styled as link (for anchor elements) */
.btn-link {
    display: inline-block;
    text-decoration: none;
}

/* Cancel button */
.btn-cancel {
    background: #e74c3c;
    color: white;
}

.btn-cancel:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.btn-cancel:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

/* Control buttons container */
.control-buttons {
    display: flex;
    gap: 10px;
}

/* Matches toolbar */
.matches-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-md, 12px);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md, 12px);
}

.toolbar-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.toolbar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300, #dee2e6);
    border-radius: var(--border-radius-sm, 4px);
    font-size: 0.9em;
    box-sizing: border-box;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    margin-left: auto;
}

/* Uniform compact button sizing within toolbar */
.matches-toolbar button {
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 600;
    border-radius: var(--border-radius-sm, 4px);
    border: 1px solid transparent;
    line-height: 1.4;
    cursor: pointer;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.matches-table th,
.matches-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.matches-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

.matches-table tr:hover {
    background: #f8f9fa;
}

.matches-table a {
    color: #3498db;
    text-decoration: none;
}

.matches-table a:hover {
    text-decoration: underline;
}

/* Multi-provider table styles (Phase 3) */
.multi-provider-table {
    min-width: auto;
}

.provider-header {
    background: #3498db;
    color: white;
    text-align: center;
    font-weight: 600;
    border-left: 2px solid white;
}

.provider-header.coming-soon {
    background: #95a5a6;
}

.coming-soon-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    margin-left: 5px;
}

.provider-subheader {
    background: #ebf5fb;
    font-size: 0.9em;
    text-align: center;
    border-left: 1px solid #ddd;
}

.provider-subheader.coming-soon {
    background: #ecf0f1;
    color: #95a5a6;
}

.provider-cell {
    border-left: 1px solid #ecf0f1;
    text-align: center;
}

.provider-cell.coming-soon {
    background: #fafafa;
}

.criteria-select {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.criteria-select.updated {
    border-color: #2ecc71;
    background: #d4edda;
}

.criteria-info {
    display: block;
    font-size: 0.85em;
    color: #7f8c8d;
    font-style: italic;
}

/* Phase 4: Skip item styling */
.skipped-item-row {
    opacity: 0.6;
    background-color: #f9f9f9;
}

.skipped-item-row td {
    text-decoration: line-through;
    color: #95a5a6;
}

.skip-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.skip-checkbox.updated {
    outline: 2px solid #2ecc71;
    outline-offset: 2px;
}

/* Criteria info trigger - inline with header */
.criteria-info-trigger {
    cursor: help;
    margin-left: var(--spacing-xs);
    opacity: 0.7;
    font-size: 0.9em;
}

.criteria-info-trigger:hover {
    opacity: 1;
}

/* Criteria info wrapper - positioning context for popover */
.criteria-info-wrapper {
    position: relative;
    display: inline-block;
}

/* Criteria popover - positioned relative to wrapper (CSP-compliant) */
.criteria-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--spacing-xs, 4px);
    z-index: 1000;
    background: #fffde7;
    border: 1px solid #f0e68c;
    border-radius: var(--border-radius, 4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: var(--spacing-md, 16px);
    min-width: 320px;
    max-width: 400px;
}

.criteria-popover h4 {
    margin: 0 0 var(--spacing-sm);
    font-size: 0.95rem;
    color: #2c3e50;
}

.criteria-popover ul {
    margin: 0;
    padding-left: var(--spacing-md);
    font-size: 0.85rem;
    list-style-position: inside;
    color: #555;
}

.criteria-popover li {
    margin-bottom: var(--spacing-xs);
}

.criteria-popover li:last-child {
    margin-bottom: 0;
}

.empty-state {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 20px;
    font-size: 1.1em;
}

/* Search Box */
.search-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

#searchBox {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

#searchBox:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-clear {
    padding: 10px 14px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 6px;
    line-height: 1;
}

.btn-clear:hover {
    transform: scale(1.05);
}

.search-results {
    font-size: 0.9em;
    color: #7f8c8d;
    white-space: nowrap;
    min-width: 180px;
    text-align: right;
}

/* Clean Matches Button Section */
.clean-matches-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: 8px;
}

.clean-matches-section button {
    flex-shrink: 0;
    /* Override btn-secondary to use green for "Find Similar" action */
    background: #27ae60;
    color: white;
}

.clean-matches-section button:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.clean-matches-section button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.clean-matches-hint {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Suggested Merges */
.suggested-merges {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.suggested-merges.no-suggestions {
    background: #e8f5e9;
    border-color: #4caf50;
    text-align: center;
    color: #2e7d32;
}

.suggested-merges h3 {
    color: #1976d2;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.suggestion-description {
    color: #555;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.suggestion-group {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #bbdefb;
}

.suggestion-item {
    margin-bottom: 8px;
}

.suggestion-item strong {
    color: #2c3e50;
    font-size: 1.05em;
}

.merge-arrow {
    color: #2196f3;
    margin-right: 8px;
    font-weight: bold;
}

.suggestion-products {
    margin-left: 10px;
}

.product-chip {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    margin-left: 8px;
    border: 1px solid #90caf9;
}

.suggestion-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-quick-merge {
    flex: 1;
    background: #2196f3;
    color: white;
}

.btn-quick-merge:hover {
    background: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.btn-dismiss {
    flex: 1;
    background: #ff9800;
    color: white;
}

.btn-dismiss:hover {
    background: #f57c00;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

/* Merge UI */
.btn-merge {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    background: #27ae60;
    color: white;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
    z-index: 100;
}

.btn-merge:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.5);
}

.btn-merge #mergeCount {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

/* Modal width classes (CSP-compliant alternative to inline max-width) */
/* Important: !important needed to override base .modal-content max-width */
.modal-w-600 { max-width: 600px !important; }
.modal-w-800 { max-width: 800px !important; }
.modal-w-900 { max-width: 900px !important; }
.modal-w-90vw { max-width: 90vw !important; }

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.modal-description {
    color: #7f8c8d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.merge-option-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.merge-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.merge-option:hover {
    border-color: #4a90d9;
}

.merge-option:has(input:checked) {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.merge-option input[type="radio"] {
    margin-top: 4px;
    cursor: pointer;
}

.merge-option-content {
    flex: 1;
}

.merge-option-item {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.merge-option-products {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.merge-option-products .product-chip {
    margin-left: 0;
}

.merge-option-variations {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 4px;
}

.conflict-warnings {
    margin: 20px 0;
}

.warning {
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary,
.modal-actions .btn-success {
    flex: 1;
    margin: 0;
}

/* Fuzzy Match Actions (same styling as modal-actions) */

.fuzzy-match-actions .btn-primary,
.fuzzy-match-actions .btn-secondary {
    flex: 1;
    margin: 0;
    width: auto; /* Override the 100% width from base button styles */
}

/* Variations Display */
.variations-badge {
    margin-top: 8px;
}

.variations-count {
    display: inline-block;
    padding: 4px 10px;
    background: #9c27b0;
    color: white;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.variations-count:hover {
    background: #7b1fa2;
    transform: scale(1.05);
}

.variations-list {
    margin-top: 8px;
    padding: 10px;
    background: #f3e5f5;
    border-radius: 6px;
    border: 1px solid #e1bee7;
}

.variation-name {
    color: #555;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    .card {
        padding: 20px;
    }

    .matches-table {
        font-size: 0.9em;
    }

    .matches-table th,
    .matches-table td {
        padding: 8px;
    }

    .search-container {
        flex-wrap: wrap;
    }

    .search-results {
        width: 100%;
        text-align: left;
        margin-top: 8px;
    }
}

/* Product Selection Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    line-height: 1;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #ecf0f1;
    color: #e74c3c;
}

.selection-details {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.selection-details p {
    margin: 0.5rem 0;
    color: #555;
}

.selection-details strong {
    color: #2c3e50;
}

.product-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.product-option {
    border: 2px solid #ddd;
    padding: 1.25rem;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 100px 100px 80px;
    gap: 1rem;
    align-items: center;
    transition: all 0.2s ease;
    background: white;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}

/* Select button inside product card - size adjustments only */
.product-option .btn-select-product {
    padding: 8px 16px;
    min-width: 80px;
}

.product-option.high-confidence {
    border-color: #27ae60;
    background: #f0fdf4;
}

.product-option.medium-confidence {
    border-color: #f39c12;
    background: #fffbf0;
}

.product-option.low-confidence {
    border-color: #e74c3c;
    background: #fff5f5;
}

/* Selected product in multi-provider modal */
.product-option.selected-product {
    border-color: #2980b9;
    border-width: 3px;
    background: #ebf5fb;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.2);
}

.product-option.selected-product::after {
    content: '✓ SELECTED';
    position: absolute;
    top: -12px;
    right: 10px;
    background: #2980b9;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Make product-option relative for the selected badge */
.provider-column .product-option {
    position: relative;
}

.product-info {
    min-width: 0; /* Allow text truncation in grid */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Product price section - centered column */
.product-price-section {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.product-price-section .price {
    font-size: 1.2em;
    font-weight: bold;
    color: #27ae60;
    white-space: nowrap;
}

.product-price-section .unit-price {
    font-size: 0.85em;
    color: #7f8c8d;
    white-space: nowrap;
}


/* Product confidence section - centered column */
.product-confidence-section {
    text-align: center;
}

/* Confidence badge variants for product selection - clickable for explanation */
.product-confidence-section .confidence-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.product-confidence-section .confidence-badge:hover {
    filter: brightness(0.95);
}

.product-confidence-section .confidence-badge:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.product-confidence-section .confidence-badge.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.product-confidence-section .confidence-badge.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.product-confidence-section .confidence-badge.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* Legacy class names (without confidence- prefix) */
.product-confidence-section .confidence-badge.high {
    background-color: #d4edda;
    color: #155724;
}

.product-confidence-section .confidence-badge.medium {
    background-color: #fff3cd;
    color: #856404;
}

.product-confidence-section .confidence-badge.low {
    background-color: #f8d7da;
    color: #721c24;
}

/* Ensure Bootstrap popover appears above modals */
.popover {
    z-index: 10060 !important;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-width: 320px;
}

.popover .popover-arrow::before {
    border-top-color: rgba(0, 0, 0, 0.15);
}

.popover .popover-arrow::after {
    border-top-color: #fff;
}

/* Style the popover content */
.popover-header {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.375rem 0.375rem 0 0;
}

.popover-body {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    color: #495057;
    word-wrap: break-word;
}

.product-info h3 {
    color: #2c3e50;
    font-size: 1.1em;
    margin-bottom: 0.25rem;
    width: 100%;
}

/* Phase 3: Clickable product links */
.product-info h3 .product-link,
.compact-product-name .product-link {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-info h3 .product-link:hover,
.compact-product-name .product-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.product-info h3 .product-link:visited,
.compact-product-name .product-link:visited {
    color: #9b59b6;
}

/* Note: .product-info .price moved to .product-price-section */

.product-info .confidence-score {
    font-size: 0.95em;
    color: #7f8c8d;
    margin: 0.25rem 0;
}

.product-info .explanation {
    font-size: 0.85em;
    color: #95a5a6;
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

.product-info .product-metadata {
    font-size: 0.85em;
    color: #7f8c8d;
    margin: 0;
    width: 100%;
}

/* Product attribute badges (Bio, National, Frozen) - emoji icons */
.product-attribute-badges {
    display: flex;
    gap: var(--spacing-xs);
    height: 1.25rem;  /* Fixed height ensures alignment across columns */
    align-items: center;
}

.attribute-badge {
    font-size: 1.1rem;
    line-height: 1;
    cursor: default;
}

/* Reset background styling for emoji badges */
.attribute-badge.bio,
.attribute-badge.national,
.attribute-badge.frozen,
.attribute-badge.diet {
    background: transparent;
    border: none;
    padding: 0;
}

.product-option button {
    min-width: 80px;
    width: auto;
    justify-self: end;
}

.btn-skip {
    width: 100%;
    margin-top: 1rem;
}

/* Custom Search Section */
.custom-search-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #ecf0f1;
}

.custom-search-label {
    color: #7f8c8d;
    font-size: 0.95em;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.custom-search-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.custom-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.2s;
}

.custom-search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-custom-search {
    width: auto;
    white-space: nowrap;
}

.custom-search-status {
    font-size: 0.9em;
    min-height: 1.2em;
    margin-top: 0.5rem;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-height: 95vh;
    }

    .modal-header {
        position: relative;
        padding-right: 2.5rem; /* Space for close button */
    }

    .modal-header .modal-close {
        position: absolute;
        top: 0;
        right: 0;
    }

    .product-option {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.75rem;
    }

    .product-price-section {
        align-items: center;
        flex-direction: row;
        justify-content: center;
        gap: 0.75rem;
    }

    .product-confidence-section {
        text-align: center;
    }

    .btn-select-product {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    /* Provider columns - stack on mobile */
    .provider-product-grid {
        flex-direction: column;
    }

    .provider-column {
        flex: 0 0 auto;  /* Let it take natural height, full width */
        max-width: 100%;
        width: 100%;
    }

    /* Provider search section - stack inputs on mobile */
    .provider-search-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .provider-search-input {
        width: 100%;
    }

    .provider-search-btn {
        width: 100%;
    }

    .provider-no-match-btn {
        width: 100%;
    }

    /* Mobile: Collapse non-selected products when a selection is made */
    .provider-column.has-selection .product-option:not(.selected-product) {
        display: none;
    }

    /* Show "tap to change" hint below selected product in mobile */
    .provider-column.has-selection .provider-products::after {
        content: 'Tap Select to change';
        display: block;
        text-align: center;
        font-size: 0.75em;
        color: #888;
        padding: 0.5rem 0;
        border-top: 1px dashed #ddd;
        margin-top: 0.25rem;
    }

    /* Run details modal - responsive stats grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-box {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .stat-label {
        font-size: 0.6rem;
        white-space: normal; /* Allow wrapping on mobile */
        word-break: break-word;
    }

    .stat-value {
        font-size: 1rem;
    }

    /* Make tabs scrollable on mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    /* Make run details table scrollable */
    .scrollable-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .scrollable-table table {
        min-width: 100%;
        font-size: 0.85rem;
    }

    .scrollable-table th,
    .scrollable-table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

/* Phase 1: Zero/Low Results Styling */

.no-results-message h3,
.low-results-message h3 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 1rem;
}

.no-results-message p,
.low-results-message p {
    color: #856404;
    margin: 0.5rem 0;
}

/* ===== Re-search Feature (Phase 4) ===== */

/* Actions cell styling */
.actions-cell {
    text-align: center;
}

.actions-cell .btn-delete {
    display: block;
    width: 100%;
    min-width: 100px;
    margin: 0 auto;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    white-space: nowrap;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1em;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid #c62828;
    text-align: center;
}

.error-message p {
    margin: 0.5rem 0;
}

/* Cancel button */
.btn-cancel {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.75rem;
    font-size: 1em;
}

/* ===== History Page (history.html) ===== */

/* Status badges for runs */
.status-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}
.status-completed {
    background-color: #d4edda;
    color: #155724;
}
.status-aborted {
    background-color: #fff3cd;
    color: #856404;
}
.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}
.status-running {
    background-color: #cce5ff;
    color: #004085;
}

/* Item status badges (used in run details modal) */
.status-added {
    background-color: #d4edda;
    color: #155724;
}
.status-skipped {
    background-color: #fff3cd;
    color: #856404;
}
.status-skipped-owned {
    background-color: #fff3cd;
    color: #856404;
}
.status-user-removed {
    background-color: #e9ecef;
    color: #6c757d;
}
.status-pending {
    background-color: #e9ecef;
    color: #6c757d;
}

/* Stat boxes for run summary */
.stat-box {
    background: #f8f9fa;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    text-align: center;
    min-width: 0; /* Allow shrinking in grid */
}
.stat-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
    white-space: nowrap;
}
.stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Tabs for filtering items */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #dee2e6;
}
.tab-button {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-button:hover {
    color: #495057;
    background: #f8f9fa;
}
.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 500;
}

/* Item status badges */
.item-status {
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}
.item-added {
    background-color: #d4edda;
    color: #155724;
}
.item-failed {
    background-color: #f8d7da;
    color: #721c24;
}
.item-skipped {
    background-color: #fff3cd;
    color: #856404;
}
.item-removed {
    background-color: #f5f5f5;
    color: #95a5a6;
}

/* Failure reason text - dynamically inserted by filterItems() */

/* Source badges - dynamically inserted by filterItems() */
.source-cookidoo {
    background: #e7f3ff;
    color: #004085;
}
.source-manual {
    background: #fff3cd;
    color: #856404;
}

/* Product links in history table */
.product-link {
    color: #3498db;
    text-decoration: none;
}
.product-link:hover {
    text-decoration: underline;
}

/* View details button */
.btn-view-details {
    background: #3498db;
    color: white;
}

.btn-view-details:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/* ===== Session Status Indicators ===== */

/* Container for session active message */
.session-status {
    padding: 0.75rem 1rem;
    background-color: #d4edda;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #27ae60;
}

/* Badge text inside session status */
.session-badge {
    color: #155724;
    font-weight: 500;
    font-size: 0.95em;
}

/* ========================================================================== */
/* OTP (One-Time Password) Input Styling - For Pingo Doce Authentication     */
/* ========================================================================== */

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.otp-digit {
    width: 50px;
    height: 60px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-weight: bold;
    font-family: monospace;
}

.otp-digit:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.otp-digit:valid {
    border-color: #27ae60;
}

.help-text {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 15px;
    text-align: center;
}

/* ========================================================================== */
/* Multi-Provider Selection UI (Phase 5)                                     */
/* ========================================================================== */

.provider-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-checkbox:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.provider-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.provider-checkbox input[type="checkbox"]:checked + .provider-name {
    font-weight: bold;
    color: #2c3e50;
}

.provider-name {
    font-size: 16px;
    color: #555;
}

/* Provider Credentials Sections */
.provider-credentials {
    border-left: 4px solid #3498db;
    padding-left: 15px;
}

/* ========================================================================== */
/* Multi-Provider Interactive Selection Modal (Phase 5)                      */
/* ========================================================================== */

/* Selection modal - flexible width based on provider count */
#selectionModal .modal-content {
    width: fit-content;
    min-width: 400px;
    max-width: 95vw;
}

.provider-product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;  /* Center columns when fewer than fill width */
}

.provider-column {
    flex: 0 0 350px;  /* Fixed width: don't grow, don't shrink, 350px base */
    max-width: 350px;
    min-width: 0;  /* Allow content to shrink if needed */
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa;
}

/* Product cards inside provider columns - use flexbox layout (mobile-style) for all sizes */
.provider-column .product-option {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.5rem;
    padding: 0.75rem;
}

/* Break apart containers so children can be ordered */
.provider-column .product-info,
.provider-column .product-price-section {
    display: contents;
}

/* Row 1: Name (left), Price (right) */
.provider-column .product-info h3 {
    flex: 1 1 60%;
    font-size: 0.95em;
    line-height: 1.3;
    margin: 0;
    order: 1;
    text-align: left;
    word-break: normal;
    overflow-wrap: break-word;
}

.provider-column .product-price-section .price {
    font-size: 1.1em;
    font-weight: 600;
    text-align: right;
    order: 2;
}

/* Row 2: Quantity (left), Unit price (right) */
.provider-column .product-info .product-metadata {
    flex: 1 1 60%;
    font-size: 0.8em;
    color: #666;
    margin: 0;
    order: 3;
    text-align: left;
}

.provider-column .product-price-section .unit-price {
    font-size: 0.8em;
    color: #666;
    text-align: right;
    order: 4;
}

/* Force line break after row 2 using pseudo-element */
.provider-column .product-option::before {
    content: '';
    flex-basis: 100%;
    height: 0;
    order: 5;
}

/* Row 3: Confidence + Badges + Select button */
.provider-column .product-confidence-section {
    order: 6;
}

.provider-column .product-info .product-attribute-badges {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9em;
    order: 7;
    margin-left: 0.5rem;
}

.provider-column .product-confidence-section .confidence-badge {
    font-size: 0.8em;
    padding: 0.25rem 0.5rem;
}

.provider-column .btn-select-product {
    margin-left: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.85em;
    order: 8;
}

.provider-column-header {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

/* Confidence tier tabs for filtering products - Pill button style */
.confidence-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.confidence-tab-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.15s ease;
    color: #6c757d;
}

.confidence-tab-btn:hover:not(.empty-tier):not(.active) {
    background-color: #e9ecef;
    border-color: #ced4da;
}

/* High confidence tier (green) */
.confidence-tab-btn[data-tier="high"].active {
    background-color: #d4edda;
    border-color: #27ae60;
    color: #155724;
    font-weight: 600;
}

/* Medium confidence tier (yellow) */
.confidence-tab-btn[data-tier="medium"].active {
    background-color: #fff3cd;
    border-color: #f39c12;
    color: #856404;
    font-weight: 600;
}

/* Low confidence tier (red/pink) */
.confidence-tab-btn[data-tier="low"].active {
    background-color: #f8d7da;
    border-color: #e74c3c;
    color: #721c24;
    font-weight: 600;
}

/* Empty tier styling */
.confidence-tab-btn.empty-tier {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive: wrap tabs on narrow screens */
@media (max-width: 400px) {
    .confidence-tabs {
        flex-wrap: wrap;
    }

    .confidence-tab-btn {
        flex: 1;
        min-width: calc(50% - var(--spacing-xs));
        text-align: center;
    }
}

.provider-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px;  /* Prevent collapse when empty or few products */
}

/* Confidence badges for multi-provider modal */
.confidence-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.confidence-badge.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.confidence-badge.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.confidence-badge.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* Provider column CSP-compliant utility classes */
.provider-column-dimmed {
    opacity: 0.6;
    pointer-events: none;
}

.provider-empty-state {
    padding: 1rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.provider-empty-message {
    color: #95a5a6;
    font-size: 0.9em;
    font-style: italic;
}

.provider-search-section {
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.provider-search-label {
    margin-bottom: 0.5rem;
    color: #7f8c8d;
    font-size: 0.9em;
}

.provider-search-row {
    display: flex;
    gap: 0.5rem;
}

.provider-search-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

.provider-search-btn {
    padding: 8px 16px;
    white-space: nowrap;
}

.provider-search-results {
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    background: var(--success-light, #d4edda);
    color: var(--success-dark, #155724);
    border-radius: var(--border-radius-sm, 4px);
    font-size: 0.85em;
    text-align: center;
}

.provider-no-match-btn {
    width: 100%;
    margin-top: 0.75rem;
}

.provider-status {
    margin-left: 0.5rem;
    font-size: 0.9em;
}

.provider-status-selected {
    color: #27ae60;
}

.provider-status-skipped {
    color: #95a5a6;
}

.price-error {
    color: #dc3545;
}

/* ========================================================================== */
/* Cart Review Provider Cards (Phase 5)                                      */
/* ========================================================================== */

.cart-review .provider-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.cart-review .provider-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: var(--spacing-lg);
    background: linear-gradient(to bottom, #fafbfc, #ffffff);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    width: 300px;
    justify-self: start;
}

.cart-review .provider-card:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.15);
}

.cart-review .provider-card-header {
    width: 100%;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid #eee;
    margin-bottom: var(--spacing-md);
}

.cart-review .provider-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.cart-review .provider-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.cart-review .provider-stat.total-price {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cart-review .provider-stat.total-price .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.cart-review .provider-stat.total-price .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #27ae60;
}

.cart-review .provider-stat.items-count {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.8rem;
    color: #95a5a6;
}

.cart-review .provider-stat.items-count .stat-label {
    font-weight: 400;
    text-transform: lowercase;
}

.cart-review .provider-stat.items-count .stat-value {
    font-weight: 500;
    color: #7f8c8d;
}

.cart-review .provider-stat.missing-items {
    display: flex;
    gap: var(--spacing-xs);
    font-size: 0.85rem;
}

.cart-review .provider-stat.missing-items .stat-label {
    color: #e74c3c;
}

.cart-review .provider-stat.missing-items .stat-value {
    font-weight: 600;
    color: #e74c3c;
}

.cart-review .provider-card-footer {
    width: 100%;
    margin-top: auto;
    padding-top: var(--spacing-md);
}

.cart-review .btn-choose-provider {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    font-weight: 500;
}

.cart-review .provider-card-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
}

.cart-review .btn-print-list {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
}

.cart-review .inline-login-form + .btn-print-list {
    margin-top: var(--spacing-sm);
}

/* View-only provider cards (not logged in) */
.cart-review .provider-card.view-only {
    opacity: 0.85;
    border-color: #f39c12;
    background: #fffbf0;
}

.cart-review .provider-card.view-only:hover {
    border-color: #f39c12;
    transform: none;
    box-shadow: none;
    cursor: default;
}

.cart-review .provider-card-header .badge-warning {
    display: inline-block;
    margin-left: var(--spacing-sm);
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #856404;
    background: #fff3cd;
    border-radius: 4px;
}

/* Inline login form for view-only providers in cart review */
.inline-login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
}

.inline-login-form .login-title {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 0.875rem;
    color: #666;
    text-align: left;
}


.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    background-color: #3498db;
    color: white;
    padding: 12px;
    text-align: left;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.provider-product-cell .product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.provider-product-cell .product-package-info {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 4px;
    min-height: 1.2em;  /* Consistent height for alignment */
}

.provider-product-cell .product-price {
    font-size: 16px;
    font-weight: bold;
    color: #27ae60;
}

/* Quantity multiplier pricing display */
.provider-product-cell .product-price .price-calculation {
    font-size: 13px;
    font-weight: normal;
    color: #7f8c8d;
}

.provider-product-cell .product-price .price-total {
    display: block;
    font-size: 16px;
    font-weight: bold;
    color: #27ae60;
}

.provider-product-cell .product-unit-price {
    font-size: 12px;
    color: #7f8c8d;
    min-height: 1.2em;  /* Consistent height for alignment */
}

/* Swap and Search buttons in comparison table */
.provider-product-cell {
    vertical-align: top;  /* Align content from top for consistent row alignment */
}

.provider-product-cell .product-info {
    margin-bottom: 8px;
}

.provider-product-cell .product-name-link {
    color: #2980b9;
    text-decoration: none;
}

.provider-product-cell .product-name-link:hover {
    text-decoration: underline;
}

.swap-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #3498db;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.swap-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.search-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #3498db;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.no-match-cell {
    vertical-align: bottom;
}

.no-match-cell .no-match {
    display: block;
    color: #95a5a6;
    margin-bottom: 8px;
}

/* Expandable details */
.item-breakdown summary {
    cursor: pointer;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 600;
}

.item-breakdown summary:hover {
    background-color: #d5dbdb;
}

.item-breakdown[open] summary {
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

/* User-removed item styling (cart review) */
.removed-item {
    opacity: 0.5;
    background-color: #f5f5f5;
}

.removed-item td {
    text-decoration: line-through;
    color: #95a5a6;
}

.removed-item .swap-btn,
.removed-item .search-btn {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* Remove button styling */
.remove-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: #e74c3c;
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.remove-btn:hover {
    background: #c0392b;
}

/* Restore button styling */
.restore-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: #27ae60;
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.restore-btn:hover {
    background: #229954;
}

/* ===== Start Run Page - Redesigned Layout ===== */

.run-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid #ecf0f1;
}

.run-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.run-section h3 {
    margin-bottom: var(--spacing-xs);
    color: #2c3e50;
    font-size: 1.1em;
}

.section-help {
    color: #7f8c8d;
    font-size: 0.85em;
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.4;
}

/* Options & Items Side-by-Side Layout */
.options-items-row {
    display: flex;
    gap: var(--spacing-xl);
}

.options-column {
    flex: 0 0 280px;
    width: 280px;
}

.options-column h3,
.items-column h3 {
    margin-bottom: var(--spacing-md);
}

.items-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.items-column .items-textarea {
    flex: 1;
}

@media (max-width: 768px) {
    .options-items-row {
        flex-direction: column;
    }
}

/* Provider List (vertical stack) */
.provider-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.provider-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
    position: relative;
}

/* Hide the selection toggle checkbox (direct child only, not nested form checkboxes) */
.provider-card > input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.provider-card:hover:not(.disabled) {
    border-color: #3498db;
    background: #f0f7ff;
}

.provider-card.selected {
    border-color: #3498db;
    background: #e8f4fd;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.provider-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.provider-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-size: 1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none; /* Allow clicks to pass through to checkbox */
}

.provider-card.selected .provider-logo {
    background: linear-gradient(135deg, #27ae60, #229954);
}

/* Provider brand colors */
.provider-logo.continente {
    background: linear-gradient(135deg, #E2001A, #B80015);
}

.provider-logo.auchan {
    background: linear-gradient(135deg, #E2001A, #C00000);
}

.provider-logo.intermarche {
    background: linear-gradient(135deg, #E2001A, #B80015);
}

.provider-logo.pingo-doce {
    background: linear-gradient(135deg, #00843D, #006B2E);
}

/* Selected state overrides brand colors with success green */
.provider-card.selected .provider-logo.continente,
.provider-card.selected .provider-logo.auchan,
.provider-card.selected .provider-logo.intermarche,
.provider-card.selected .provider-logo.pingo-doce {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.provider-label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95em;
}

.coming-soon-badge {
    background: #95a5a6;
    color: white;
    font-size: 0.65em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: auto;
}

/* Provider Cards Grid - all providers side-by-side */
.provider-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

@media (max-width: 900px) {
    .provider-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .provider-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Provider Card Container - wraps card + login form */
.provider-card-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.provider-card-container.disabled {
    opacity: 0.6;
}

.provider-card-container.disabled .provider-logo {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

/* Session badge on provider card */
.session-badge {
    font-size: 0.65em;
    padding: 2px 8px;
    background: var(--success, #27ae60);
    color: white;
    border-radius: 4px;
    font-weight: 600;
    margin-left: auto;
}

/* Inline login form below card */
.provider-login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
    padding: var(--spacing-sm);
    background: #f0f4f8;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
}

.provider-login-form input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
    border: 1px solid #d0d4d8;
    border-radius: 4px;
}

.provider-login-form input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.provider-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.otp-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
}

/* Remember me checkbox */
.remember-me-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.remember-me-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}

.remember-me-checkbox span {
    user-select: none;
}

/* Cookidoo login actions (same layout as provider-actions) */
.cookidoo-login-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

/* Provider login button */
.btn-provider-login {
    flex: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-provider-login:hover {
    background: #2980b9;
}

.btn-provider-login:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Provider logout button styles */
.btn-provider-logout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: #fef7f7;
    border: 1px solid #f5c6c6;
    color: #c0392b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    padding: var(--spacing-xs) var(--spacing-sm);
}

.btn-provider-logout:hover {
    background: #fdeaea;
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-provider-logout:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Inline error message */
.provider-error {
    color: #e74c3c;
    font-size: 0.75rem;
    padding: var(--spacing-xs);
    background: #fdf2f2;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Retry button in error message */
.btn-retry-login {
    margin-left: auto;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.btn-retry-login:hover {
    background: var(--color-primary-dark);
}

/* Cookidoo section - simplified inline toggle */
.cookidoo-section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid #e9ecef;
}

.cookidoo-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.cookidoo-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    color: #2c3e50;
}

.cookidoo-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cookidoo-label {
    font-weight: 500;
}

.cookidoo-credentials {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.cookidoo-credentials input {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

.cookidoo-credentials input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Info icon with tooltip */
.info-icon {
    color: #7f8c8d;
    font-size: 0.9em;
    cursor: help;
    position: relative;
}

.info-icon:hover {
    color: #3498db;
}

/* Native tooltip styling via title attribute - enhanced with CSS */
.info-icon[title] {
    text-decoration: none;
}

.session-badge-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #27ae60;
    font-size: 0.85em;
    font-weight: 500;
}

.session-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
}

.btn-text {
    background: none;
    border: none;
    color: #3498db;
    font-size: 0.9em;
    cursor: pointer;
    padding: var(--spacing-xs) 0;
    text-decoration: underline;
}

.btn-text:hover {
    color: #2980b9;
}

/* Items Textarea */
.items-textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    min-height: 100px;
}

.items-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Setup step: item sources side-by-side (textarea left, Cookidoo right) */
.setup-item-sources {
    display: flex;
    gap: var(--spacing-lg);
}

.setup-item-sources > * {
    flex: 1;
}

@media (max-width: 900px) {
    .setup-item-sources {
        flex-direction: column;
    }
}

/* Collapsible advanced options */
.setup-advanced-options {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0;
    margin-top: var(--spacing-lg);
}

.setup-advanced-options > summary {
    cursor: pointer;
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    color: #495057;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.setup-advanced-options > summary::before {
    content: '\25B6';
    font-size: 0.7em;
    transition: transform 0.2s;
}

.setup-advanced-options[open] > summary::before {
    transform: rotate(90deg);
}

.setup-advanced-options > summary::-webkit-details-marker {
    display: none;
}

.setup-advanced-options[open] > summary {
    border-bottom: 1px solid #e9ecef;
}

.setup-advanced-options > .options-split-layout {
    padding: var(--spacing-lg);
}

.input-hint {
    color: #7f8c8d;
    font-size: 0.85em;
    margin-top: var(--spacing-sm);
}

.optional-badge {
    font-size: 0.75em;
    font-weight: normal;
    color: #95a5a6;
    background: #ecf0f1;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: var(--spacing-sm);
    vertical-align: middle;
}

/* Options Grid */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Split Options Layout: checkboxes left, complex controls right */
.options-split-layout {
    display: flex;
    gap: var(--spacing-lg);
}

.options-checkboxes {
    display: flex;
    flex-direction: column;
    padding-right: var(--spacing-lg);
    border-right: 1px solid #e9ecef;
}

.options-checkboxes .option-checkbox {
    padding: var(--spacing-xs) var(--spacing-sm);
}

.options-complex {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    align-items: start;
}

@media (max-width: 900px) {
    .options-split-layout {
        flex-direction: column;
    }

    .options-checkboxes {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding-right: 0;
        padding-bottom: var(--spacing-md);
        margin-bottom: var(--spacing-sm);
    }

    .options-complex {
        grid-template-columns: 1fr;
    }
}

/* Compact select option (fits in grid like checkboxes) */
.option-select-compact {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 6px;
}

.option-select-compact .option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-select-inline {
    padding: var(--spacing-xs);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    background: white;
    cursor: pointer;
    width: 100%;
}

.option-select-inline:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Option with inline credentials (e.g., Cookidoo) */
.option-with-credentials {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.option-credentials {
    flex-direction: column;
    gap: var(--spacing-xs);
    padding-left: 26px; /* Align with checkbox text */
}

.option-credentials input {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Login button and error inside credentials section */
.option-credentials .btn-provider-login {
    margin-top: var(--spacing-xs);
}

.option-credentials .provider-error {
    margin-top: var(--spacing-xs);
}

/* Logout button for Cookidoo (inside option-with-credentials) */
.option-with-credentials > .btn-provider-logout {
    margin-left: 26px; /* Align with checkbox text */
    width: auto;
    max-width: fit-content;
}

/* Section headers in Shop tab */
.run-section > h3 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    padding-top: var(--spacing-md);
    border-top: 1px solid #e9ecef;
}

.run-section > h3:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.items-source-section {
    margin-bottom: var(--spacing-md);
}

.manual-items-section {
    margin-top: var(--spacing-md);
}

.manual-items-section .manual-label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: var(--spacing-xs);
}

.manual-items-section .items-textarea {
    width: 100%;
    font-size: 0.9em;
}

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

.option-item label {
    font-weight: 500;
    color: #2c3e50;
}

.option-select {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    background: white;
}

.option-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: 6px;
    transition: background 0.2s;
}

.option-checkbox:hover {
    background: #f8f9fa;
}

.option-checkbox.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-checkbox input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

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

.option-title {
    font-weight: 500;
    color: #2c3e50;
}

.option-desc {
    font-size: 0.85em;
    color: #7f8c8d;
}

/* Search Mode Radio Group */
.search-mode-group {
    border: none;
    padding: 0;
    margin: 0 0 var(--spacing-sm) 0;
}

.search-mode-legend {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: var(--spacing-xs);
    font-size: 0.9em;
}

.option-radio {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 6px;
    transition: background 0.2s;
}

.option-radio:hover {
    background: #f8f9fa;
}

.option-radio input[type="radio"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Criteria Radio Group (same style as search-mode-group) */
.criteria-mode-group {
    border: none;
    padding: 0;
    margin: 0;
}

.criteria-mode-legend {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: var(--spacing-xs);
    font-size: 0.9em;
}

/* Disabled credentials (Cookidoo unchecked) */
.credentials-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Submit Button */
.run-submit {
    text-align: center;
    padding-top: var(--spacing-xs);
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-2xl);
    font-size: 1.1em;
}

/* Warning Banner */
.warning-banner {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background-color: #fff3cd;
    border-left: 4px solid #f39c12;
    border-radius: 8px;
}

.warning-banner strong {
    color: #856404;
    display: block;
    margin-bottom: var(--spacing-sm);
}

.warning-banner p {
    color: #856404;
    margin-bottom: var(--spacing-md);
}

/* ========================================================================== */
/* Auth Page Styles (extracted from auth.html)                                */
/* ========================================================================== */

.auth-container {
    max-width: 450px;
    margin: 40px auto;
}

.auth-card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-header-text {
    display: flex;
    flex-direction: column;
}

.auth-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.auth-container .nav-tabs .nav-link {
    color: #6c757d;
}

.auth-container .nav-tabs .nav-link.active {
    font-weight: bold;
}

/* Language toggle variant for auth page (light on dark header) */
.lang-toggle-auth {
    background: rgba(255, 255, 255, 0.2);
}

.lang-toggle-auth button {
    opacity: 0.7;
}

.lang-toggle-auth button:hover {
    opacity: 0.9;
}

.lang-toggle-auth button.active {
    background: white;
    opacity: 1;
}

/* ========================================================================== */
/* Legal Pages Styles (extracted from privacy.html and terms.html)            */
/* ========================================================================== */

.legal-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.legal-card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.legal-content h2 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--primary-color, #0d6efd);
}

.legal-content p,
.legal-content li {
    line-height: 1.8;
    color: var(--text-secondary, #6c757d);
}

.legal-content ul {
    margin-left: 20px;
}

.last-updated {
    color: var(--text-secondary, #6c757d);
    font-style: italic;
}

/* Terms page specific */
.important-note {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 0.25rem;
    padding: 1rem;
    margin: 1rem 0;
}

/* ========================================================================== */
/* Site Footer Styles                                                         */
/* ========================================================================== */

.site-footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
    border-top: 1px solid var(--background-tertiary, #e0e0e0);
    text-align: center;
}

.footer-links {
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: var(--text-secondary, #6c757d);
    text-decoration: none;
    font-size: var(--font-size-sm);
}

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

.footer-separator {
    color: var(--text-secondary, #6c757d);
    margin: 0 var(--spacing-sm);
}

.footer-copyright {
    color: var(--text-secondary, #6c757d);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* Auth page footer (below auth card) */
.auth-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
}

.auth-footer a {
    color: var(--text-secondary, #6c757d);
    text-decoration: none;
    font-size: var(--font-size-sm);
}

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

.auth-footer .footer-separator {
    color: var(--text-secondary, #6c757d);
    margin: 0 var(--spacing-sm);
}

/* ========================================================================== */
/* Cookie Notice Banner                                                        */
/* ========================================================================== */

.cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #333;
    color: #fff;
    padding: var(--spacing-md) var(--spacing-lg);
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.cookie-notice.d-flex {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.cookie-notice-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    max-width: 1200px;
    flex-wrap: wrap;
    justify-content: center;
}

.cookie-notice-content p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.cookie-notice-content a {
    color: #7cb9e8;
    text-decoration: underline;
}

.cookie-notice-content a:hover {
    color: #a8d4f0;
}

.cookie-notice-content button {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========================================================================== */
/* Matches Page Styles (extracted from matches.html)                          */
/* ========================================================================== */

.provider-toggles {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--background-secondary, #f5f5f5);
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.provider-toggles .toggle-label {
    font-weight: 500;
    color: var(--text-secondary, #666);
}

.provider-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.provider-toggle:hover {
    background: var(--background-tertiary, #e0e0e0);
}

.provider-toggle.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.provider-toggle.coming-soon input {
    cursor: not-allowed;
}

.coming-soon-label {
    font-size: 0.75em;
    color: #666;
}

.provider-toggle input[type="checkbox"] {
    cursor: pointer;
}

/* Matches table column widths */
.matches-table .item-cell,
.matches-table th:nth-child(2) {
    width: 120px !important;
    max-width: 120px !important;
}

.matches-table .product-cell {
    width: 60px !important;
    max-width: 60px !important;
}

.matches-table .price-cell {
    width: 50px !important;
    max-width: 50px !important;
}

.matches-table .actions-cell {
    width: 90px !important;
    max-width: 90px !important;
    text-align: center;
}

.product-name {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-name a {
    color: var(--link-color, #0066cc);
    text-decoration: none;
}

.product-name a:hover {
    text-decoration: underline;
}

.product-brand {
    font-size: 0.8em;
    color: var(--text-secondary, #666);
    font-style: italic;
}

.product-size {
    font-size: 0.8em;
    color: var(--text-secondary, #666);
}

/* Stacked price display with criteria */
.price-cell {
    white-space: nowrap;
    vertical-align: top;
}

.price-main {
    font-weight: 500;
}

.price-unit {
    font-size: 0.85em;
    color: var(--text-secondary, #666);
}

.price-cell .criteria-select {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75em;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Actions cell - stacked buttons */
.matches-table .actions-cell button {
    display: block;
    width: 100%;
    min-width: auto;
    padding: 0.3rem 0.5rem;
    margin: 0.2rem 0;
    font-size: 0.8em;
}

.matches-table .btn-skip {
    background: #95a5a6;
    color: white;
    border: none;
}

.matches-table .btn-skip:hover {
    background: #7f8c8d;
}

.matches-table .btn-skip.active {
    background: #f39c12;
}

.matches-table .btn-skip.active:hover {
    background: #e67e22;
}

/* Consistent table borders for matches */
.matches-table th,
.matches-table td {
    border: 1px solid #ddd;
}

.matches-table {
    border-collapse: collapse;
    table-layout: fixed;
}

/* =================================================================
   History Page - Mobile Card Layout
   Transforms table rows into cards on narrow screens
   ================================================================= */

@media (max-width: 600px) {
    /* Hide table header on mobile */
    .matches-table thead {
        display: none;
    }

    /* Make table and body block-level */
    .matches-table,
    .matches-table tbody {
        display: block;
        width: 100%;
    }

    /* Each row becomes a card */
    .matches-table .history-row {
        display: block;
        background: white;
        border: 1px solid #ddd;
        border-radius: var(--border-radius-sm);
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-md);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .matches-table .history-row:hover {
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }

    /* Each cell becomes a row within the card */
    .matches-table .history-row td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--spacing-xs) 0;
        border: none;
        border-bottom: 1px solid #ecf0f1;
    }

    .matches-table .history-row td:last-child {
        border-bottom: none;
        padding-top: var(--spacing-sm);
        margin-top: var(--spacing-xs);
    }

    /* Show data-label as pseudo-element */
    .matches-table .history-row td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.85em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    /* Actions cell - full width button */
    .matches-table .history-row .history-actions {
        display: block;
        text-align: center;
    }

    .matches-table .history-row .history-actions::before {
        display: none;
    }

    .matches-table .history-row .history-actions .btn-view-details {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
    }
}


/* ========================================================================== */
/* Wizard Stepper & Navigation                                                 */
/* ========================================================================== */

/* Main wizard container */
.wizard-container {
    max-width: 100%;
}

/* Stepper Bar — horizontal step indicators with connecting lines */
.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid #ecf0f1;
    overflow-x: auto;
}

/* Individual step indicator (circle + label) */
.wizard-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    flex-shrink: 0;
    min-width: 60px;
    position: relative;
}

.wizard-step-indicator.clickable {
    cursor: pointer;
}

.wizard-step-indicator.clickable:hover .step-circle {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

/* Step number circle */
.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid var(--gray-300);
    background: white;
    color: var(--text-secondary);
}

/* Active step */
.wizard-step-indicator.active .step-circle {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Completed step */
.wizard-step-indicator.completed .step-circle {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

/* Locked completed step (no revisit) */
.wizard-step-indicator.completed.locked .step-circle {
    opacity: 0.7;
}

/* Upcoming step */
.wizard-step-indicator.upcoming .step-circle {
    border-color: var(--gray-300);
    color: var(--text-secondary);
    background: var(--gray-100);
}

/* Step label */
.step-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
}

.wizard-step-indicator.active .step-label {
    color: var(--color-primary);
    font-weight: 600;
}

.wizard-step-indicator.completed .step-label {
    color: var(--color-success);
}

/* Connector line between steps */
.step-connector {
    flex: 1;
    height: 2px;
    background: var(--gray-300);
    min-width: 20px;
    max-width: 60px;
    margin: 0 var(--spacing-xs);
    margin-bottom: 22px; /* Align with circle center, accounting for label below */
    transition: background 0.3s ease;
}

.step-connector.completed {
    background: var(--color-success);
}

/* Validation Errors */
.wizard-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.wizard-error-message {
    color: var(--color-error);
    margin: var(--spacing-xs) 0;
    font-size: var(--font-size-sm);
}

.wizard-error-message:first-child {
    margin-top: 0;
}

.wizard-error-message:last-child {
    margin-bottom: 0;
}

/* Step Panels */
.wizard-panels {
    min-height: 200px;
}

.wizard-panel {
    animation: wizardFadeIn 0.25s ease-out;
}

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

/* Navigation Buttons */
.wizard-navigation {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 1px solid #ecf0f1;
}

.wizard-nav-spacer {
    flex: 1;
}

/* Summary step action buttons */
.summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

/* Mobile stepper adjustments */
@media (max-width: 768px) {
    .wizard-stepper {
        gap: 0;
        padding: var(--spacing-sm) 0;
    }

    .step-circle {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .step-label {
        font-size: 0.8rem;
    }

    .step-connector {
        min-width: 12px;
        max-width: 32px;
        margin-bottom: 18px;
    }

    .wizard-step-indicator {
        min-width: 48px;
    }
}

