/* FEST - Lantmannen inspired professional theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-primary: #1b5e20;
    --color-primary-dark: #154a19;
    --color-secondary: #2e7d32;
    --color-success: #2e7d32;
    --color-success-dark: #1f6a24;
    --color-warning: #c99700;
    --color-danger: #b23b2a;
    --color-danger-dark: #902f22;
    --color-info: #2f6f8f;

    --color-white: #ffffff;
    --color-gray-50: #fafaf8;
    --color-gray-100: #f7f7f5;
    --color-gray-200: #eeeee9;
    --color-gray-300: #e0e0da;
    --color-gray-400: #c9c9c2;
    --color-gray-500: #8d8d83;
    --color-gray-600: #63635d;
    --color-gray-700: #484844;
    --color-gray-800: #31312f;
    --color-gray-900: #1a1a1a;

    --color-border: #e0e0da;
    --color-text: #1a1a1a;
    --color-text-muted: #63635d;
    --color-surface: #ffffff;
    --color-surface-muted: #f7f7f5;

    --gradient-primary: none;
    --gradient-success: none;

    --font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2rem;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 4px 14px rgba(0, 0, 0, 0.08);
    --shadow-primary: 0 0 0 2px rgba(27, 94, 32, 0.16);
}

html,
body {
    font-family: var(--font-family);
    color: var(--color-text);
}

body {
    background: var(--color-gray-100);
    padding: 0;
    min-height: 100vh;
}

body > br {
    display: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 2.8vw, 2rem); font-weight: 600; }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

main.container,
.container,
.container-lg,
.container-xl,
.container-xxl {
    max-width: 1200px;
}

main.container {
    padding: 24px;
}

body.fest-theme-admin .dashboard.container {
    margin-top: 24px;
}

.skip-link:focus {
    left: 12px;
    top: 12px;
    z-index: 10001;
    background: #fff;
    color: var(--color-text);
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.app-topbar {
    width: 100%;
    background: #0f5a2c;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

body.fest-theme-index #fest-auth-bar,
body.fest-theme-admin #fest-auth-bar {
    display: none !important;
}

.app-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 62px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-logo {
    height: 38px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.brand-divider {
    width: 1px;
    height: 42px;
    background: rgba(255, 255, 255, 0.35);
}

.brand-product {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-product-name {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-product-sub {
    font-size: 0.8rem;
    opacity: 0.85;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-email {
    font-size: 0.86rem;
    opacity: 0.84;
    max-width: clamp(170px, 21vw, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-btn {
    border: 1px solid rgba(255, 255, 255, 0.34);
    background: transparent;
    color: #fff;
    border-radius: 10px;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.58);
}

.topbar-btn[data-auth-logout] {
    background: #fff;
    color: var(--color-primary-dark);
    border-color: #fff;
}

.topbar-btn[data-auth-logout]:hover {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.92);
}

.topbar-btn[data-auth-role="superuser"] {
    opacity: 0.9;
}

.page-header {
    display: none;
}

.toolbar {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: none;
    background: #fff;
    margin-bottom: 24px;
    padding: 16px 24px;
}

.main-content,
.card,
.welcome-section,
.analysis-chart-container,
.item-card,
.cheapest-card,
.product-table-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: none;
    border-radius: 8px;
}

.card {
    padding: 24px;
    margin-bottom: 24px;
}

.btn,
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: none;
    transform: none;
}

.login-btn {
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: none;
    transform: none;
}

.login-btn:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: none;
    box-shadow: none;
}

.btn:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

.btn-outline-primary:hover:not(:disabled) {
    background: var(--color-primary);
    color: #fff;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-box input,
.product-search-input {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text);
    min-height: 44px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-box input:focus,
.product-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-primary);
}

.form-group label {
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.tab,
.btn-back,
.btn-back-tabs,
.product-list-btn {
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
}

.tab.active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: #f3f8f4;
}

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

.header {
    border: 1px solid var(--color-border);
    box-shadow: none;
    border-radius: 8px;
    padding: 16px 24px;
}

.header h1,
.header-left h1 {
    font-size: 1.5rem;
    color: var(--color-text);
}

.header-nav {
    background: #f7f7f5;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.header-nav a {
    color: var(--color-text);
    border-radius: 6px;
}

.header-nav a.active {
    background: #eaf3eb;
    color: var(--color-primary);
}

.stat-card {
    background: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    box-shadow: none;
}

.stat-card h3,
.stat-card .label,
.stat-label {
    color: var(--color-text-muted);
}

.stat-card .value,
.stat-number {
    color: var(--color-primary);
}

/* ── Modal headers: all modals ── */
.product-modal-header {
    background: var(--color-primary) !important;
    border-bottom: 3px solid #0a4a22 !important;
}

/* Standard modals (print, compare, add-to-list) */
.modal-content {
    border-radius: 8px !important;
    padding: 0 !important;
    overflow: hidden;
}

.modal-content h3 {
    background: var(--color-primary);
    color: #fff;
    margin: 0 !important;
    padding: 20px 28px !important;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-bottom: 3px solid #0a4a22;
}

.modal-content .form-group,
.modal-content p,
.modal-content .error,
.modal-content .comparison-rows,
.modal-content .comparison-search-results,
.modal-content .checkbox-label {
    padding-left: 28px !important;
    padding-right: 28px !important;
}

.modal-content .form-group:first-of-type,
.modal-content > p:first-of-type,
.modal-content > .error:first-of-type {
    margin-top: 20px;
}

.modal-content .modal-buttons {
    padding: 0 28px 24px !important;
    margin-top: 20px !important;
}

/* Profile modal */
.fest-profile-header {
    background: var(--color-primary) !important;
}

.fest-profile-role-badge {
    background: #2e7d32 !important;
}

.fest-profile-field input:focus,
.fest-profile-field select:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15) !important;
}

.fest-profile-save {
    background: var(--color-primary) !important;
}

.fest-profile-save:hover {
    background: #154d1b !important;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.35) !important;
    transform: none !important;
}

.fest-profile-readonly {
    background: #f4f7f4 !important;
    border: 1px solid #d8e8d8 !important;
    border-radius: 6px !important;
}

/* Profile modal */
.fest-profile-header {
    background: var(--color-primary) !important;
}

.fest-profile-role-badge {
    background: #2e7d32 !important;
}

.fest-profile-field input:focus,
.fest-profile-field select:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15) !important;
}

.fest-profile-save {
    background: var(--color-primary) !important;
}

.fest-profile-save:hover {
    background: #154d1b !important;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.35) !important;
    transform: none !important;
}

.fest-profile-readonly {
    background: #f4f7f4 !important;
    border: 1px solid #d8e8d8 !important;
    border-radius: 6px !important;
}

/* Page toolbar (action buttons below topbar on admin sub-pages) */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 8px;
    border-bottom: 1px solid #d8e8d8;
    margin-bottom: 16px;
}

/* Slim admin cards */
body.fest-theme-admin .admin-card {
    padding: 18px;
    border-radius: 8px;
}

body.fest-theme-admin .admin-grid {
    gap: 12px;
}

/* Slim main content for admin */
body.fest-theme-admin .main-content {
    padding: 18px 20px;
}

/* Slim section headers for admin */
body.fest-theme-admin .section-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
}

/* Slim buttons for admin */
body.fest-theme-admin .btn,
body.fest-theme-admin .btn-primary,
body.fest-theme-admin .btn-secondary {
    padding: 7px 14px;
    font-size: 0.875rem;
}

/* Admin card icon — emoji style */
.admin-card-icon {
    font-size: 1.6rem !important;
    font-weight: normal !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    width: 44px !important;
    height: 44px !important;
    background: #eaf3eb !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 12px !important;
}

/* Admin home v2 — handled by .ah-* namespace in admin.css, no overrides needed here */

/* Admin card top bar — replace gradient with solid primary */
.admin-card::before {
    background: var(--color-primary) !important;
}

/* Admin card badge — replace gradient with solid */
.admin-card-badge {
    background: var(--color-primary) !important;
}

.solution-card {
    border-left: 3px solid var(--color-primary);
    background: #fdfdfc;
    box-shadow: none;
}

.medal-gold,
.medal-silver,
.medal-bronze {
    background: #fdfdfc;
    box-shadow: none;
}

.medal-gold {
    border-left-color: #b08a1a;
}

.medal-silver {
    border-left-color: #808080;
}

.medal-bronze {
    border-left-color: #92633c;
}

.solution-rank,
.medal-gold .solution-rank,
.medal-silver .solution-rank,
.medal-bronze .solution-rank {
    background: var(--color-primary);
    color: #fff;
    box-shadow: none;
}

.benchmark-bar-optimal,
.benchmark-bar-bench,
.comparison-nutrient-actual-fill,
.comparison-nutrient-rich-row.is-good .comparison-nutrient-actual-fill,
.comparison-nutrient-rich-row.is-warn .comparison-nutrient-actual-fill,
.comparison-nutrient-rich-row.is-bad .comparison-nutrient-actual-fill {
    background: #4f8a57;
}

.comparison-foldout,
.comparison-summary,
.comparison-nutrient-target-fill,
.comparison-nutrient-overflow-fill,
.comparison-nutrient-rich-overlay,
.kpi-gradient-primary,
.kpi-gradient-teal,
.kpi-gradient-green,
.kpi-gradient-success,
.kpi-gradient-orange,
.top-list-rank.rank-1,
.top-list-rank.rank-2,
.top-list-rank.rank-3 {
    background-image: none !important;
}

.kpi-gradient-primary,
.kpi-gradient-teal,
.kpi-gradient-green,
.kpi-gradient-success,
.kpi-gradient-orange {
    background-color: var(--color-primary) !important;
}

.nutrient-helper {
    margin-bottom: 16px;
    color: #5f6d57;
    font-size: 0.95rem;
}

.section-title {
    margin-bottom: 16px;
}

.card form .btn[type="submit"],
.tab-content form .btn[type="submit"] {
    width: 100%;
    margin-top: 24px;
    min-height: 44px;
}

/* ── Slim index page so the full form fits on one screen ── */
body.fest-theme-index main.container {
    padding: 12px 24px;
}

body.fest-theme-index .toolbar {
    padding: 10px 20px;
    margin-bottom: 10px;
}

body.fest-theme-index .card {
    padding: 16px 22px 20px;
    margin-bottom: 0;
}

body.fest-theme-index .form-grid {
    gap: 12px;
    margin-bottom: 10px;
}

body.fest-theme-index .form-group label {
    margin-bottom: 4px;
    font-size: 0.9rem;
}

body.fest-theme-index .form-group input,
body.fest-theme-index .form-group select {
    min-height: 40px;
    padding: 8px 12px;
}

/* Override inline margin-top: 32px on section h3 titles */
body.fest-theme-index .section-title {
    margin-top: 12px !important;
    margin-bottom: 6px !important;
}

body.fest-theme-index .nutrient-helper {
    margin-bottom: 6px;
}

body.fest-theme-index .card form .btn[type="submit"],
body.fest-theme-index .tab-content form .btn[type="submit"] {
    margin-top: 14px;
    min-height: 42px;
}

.loading p {
    color: var(--color-text-muted);
}

.footer {
    color: #5d5d57;
}

/* Product table header — gradient-primary is none, use solid */
.product-table thead {
    background: var(--color-primary);
}

.product-table th {
    color: #fff;
}

/* Toast — gradient-success is none, use solid */
.toast {
    background: var(--color-success);
    box-shadow: var(--shadow-lg);
}

/* Feedback trigger button */
.fest-feedback-trigger {
    background: var(--color-primary) !important;
    box-shadow: 0 8px 20px rgba(27, 94, 32, 0.3) !important;
}

.fest-feedback-trigger:hover,
.fest-feedback-trigger:focus-visible {
    box-shadow: 0 12px 26px rgba(27, 94, 32, 0.38) !important;
}

/* Feedback success icon */
.fest-feedback-success-icon {
    background: var(--color-primary) !important;
    box-shadow: 0 8px 20px rgba(27, 94, 32, 0.24) !important;
}

@media (max-width: 1024px) {
    .app-topbar-inner,
    main.container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .brand-wordmark {
        font-size: 1.4rem;
    }

    .brand-product-name {
        font-size: 1.6rem;
    }

    .brand-product-sub {
        display: none;
    }

}

@media (max-width: 768px) {
    .app-topbar-inner {
        min-height: 72px;
        padding-top: 12px;
        padding-bottom: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }
    .topbar-actions .fest-account-menu {
        order: 1;
        max-width: calc(100% - 64px);
    }

    .topbar-actions .fest-lang-switcher {
        order: 2;
        margin-left: auto;
    }

    .toolbar {
        grid-template-columns: 1fr;
        gap: 12px;
        justify-items: stretch;
    }

    .toolbar-zone,
    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        justify-self: stretch;
        justify-content: space-between;
    }

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