:root { --bs-body-font-family: system-ui, sans-serif; --bs-body-bg: #f5f6f8; --bs-body-color: #273044; }
.text-secondary { color: #626b74 !important; }
.page-link { color: #0a58ca; }
.site-header { background: #503b77; }
.navbar-brand { letter-spacing: -.8px; }
.card { --bs-card-bg: #fff; border-radius: 14px; }
.btn-primary { --bs-btn-bg: #503b77; --bs-btn-border-color: #503b77; --bs-btn-hover-bg: #3e2d5e; --bs-btn-hover-border-color: #3e2d5e; --bs-btn-active-bg: #3e2d5e; --bs-btn-active-border-color: #3e2d5e; }
.form-control:focus, .form-select:focus { border-color: #947bb8; box-shadow: 0 0 0 .25rem #503b7720; }
.empty-state { padding: clamp(32px, 7vw, 80px) 24px; }
.empty-state p { max-width: 440px; }
.empty-symbol { margin: auto; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: #efebf5; color: #503b77; font-size: 24px; }

/* Wider desktop layout with space on both sides. */
@media (min-width: 1600px) {
    .container-xl { max-width: 1400px; }
}
@media (min-width: 1760px) {
    .container-xl { max-width: 1440px; }
}

.price-row { padding-block: .42rem; }
.market-name { min-width: 0; }
.price-info { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; padding: 0; border: 1px solid #adb5bd; border-radius: 50%; background: transparent; color: #626b74; font: 700 .7rem/1 system-ui, sans-serif; cursor: help; }
.price-info:hover, .price-info:focus-visible { border-color: #503b77; color: #503b77; outline: none; }
.price-info.is-stale { border-color: #b58105; background: #fff3cd; color: #7a5900; }

.chart-wrap { position: relative; min-height: 340px; }
.empty-chart { min-height: 340px; display: grid; place-items: center; padding: 2rem; border-radius: .75rem; background: #f5f6f8; color: #626b74; text-align: center; }
@media (max-width: 575.98px) { .chart-wrap, .empty-chart { min-height: 280px; } }

.market-link { color: #0a58ca; text-decoration: none; }
.market-link:hover, .market-link:focus-visible { color: #0a58ca; text-decoration: none; }

.product-image-frame, .product-detail-image-frame { display: grid; place-items: center; overflow: hidden; background: #fff; border-bottom: 1px solid #eef0f3; }
.product-image-frame { height: 128px; border-radius: 14px 14px 0 0; }
.product-detail-image-frame { min-height: 220px; border-radius: 14px 14px 0 0; }
.product-image { width: 100%; height: 100%; object-fit: contain; padding: .75rem; }
.product-image.is-placeholder { width: 76px; height: 76px; padding: 0; opacity: .22; }

.search-field { position: relative; }
.search-suggestions { position: absolute; z-index: 1080; top: calc(100% + .4rem); right: 0; left: 0; max-height: 26rem; overflow-y: auto; border-radius: .75rem; box-shadow: 0 .75rem 2rem rgba(39, 48, 68, .16); }
.search-suggestion { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.search-suggestion .min-w-0 { min-width: 0; }
.search-suggestion.active .text-secondary { color: rgba(255,255,255,.8) !important; }
.search-suggestion.active .text-primary { color: #fff !important; }
.search-suggestion-more { color: #0d6efd; font-weight: 700; border-top: 2px solid #eef0f3; }
.search-suggestion-more:hover, .search-suggestion-more:focus, .search-suggestion-more.active { color: #fff; background-color: #0d6efd; }

.auth-page { min-height: calc(100vh - 145px); display: grid; align-items: center; }
.auth-card { width: 100%; max-width: 520px; }

.header-menu-button { --bs-btn-color: #2f2346; --bs-btn-bg: #fff; --bs-btn-border-color: rgba(255,255,255,.75); --bs-btn-hover-color: #2f2346; --bs-btn-hover-bg: #f5f1fa; --bs-btn-hover-border-color: #fff; --bs-btn-active-color: #2f2346; --bs-btn-active-bg: #eee7f6; --bs-btn-active-border-color: #fff; padding: .45rem .8rem .45rem .5rem; border-radius: 999px; font-weight: 650; box-shadow: 0 .25rem .8rem rgba(20,12,34,.16); }
.header-menu-icon { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: 50%; background: #503b77; color: #fff; font-size: .82rem; }
.header-menu { width: min(19rem, calc(100vw - 2rem)); padding: .55rem; border-radius: 1rem; margin-top: .45rem !important; }
.header-menu .dropdown-item { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; padding: .55rem .65rem; border-radius: .65rem; color: #273044; }
.header-menu .dropdown-item:hover, .header-menu .dropdown-item:focus { background: #f2eef7; color: #3e2d5e; }
.header-menu .dropdown-item.text-danger { color: #b02a37; }
.header-menu .dropdown-divider { margin: .45rem .25rem; }
.menu-item-icon { display: inline-grid; flex: 0 0 auto; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: #efebf5; color: #503b77; }
.header-user-email { max-width: 17rem; }

/* Το κεντρικό menu παραμένει ευδιάκριτο και ορατό σε κάθε πλάτος. */
.header-menu-button { --bs-btn-color: #2f2346; --bs-btn-bg: #ffc107; --bs-btn-border-color: #ffd24d; --bs-btn-hover-color: #241936; --bs-btn-hover-bg: #ffd044; --bs-btn-hover-border-color: #ffe08a; --bs-btn-active-color: #241936; --bs-btn-active-bg: #e9ae00; --bs-btn-active-border-color: #e9ae00; min-height: 46px; padding: .5rem 1rem .5rem .55rem; border-width: 2px; box-shadow: 0 .35rem 1rem rgba(20,12,34,.3); }
.header-menu-icon { width: 2rem; height: 2rem; background: #3e2d5e; font-size: .9rem; }
@media (max-width: 575.98px) { .site-header .container-xl { padding-inline: 1rem; } .navbar-brand { font-size: 1.55rem !important; } .header-menu-button { min-height: 42px; padding-block: .35rem; } }

/* Απλή τελική εμφάνιση του menu. */
.header-menu-button { --bs-btn-color: #fff; --bs-btn-bg: rgba(255,255,255,.12); --bs-btn-border-color: rgba(255,255,255,.65); --bs-btn-hover-color: #3e2d5e; --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-active-color: #3e2d5e; --bs-btn-active-bg: #f4f0f8; --bs-btn-active-border-color: #fff; min-height: 38px; padding: .35rem .7rem; border-width: 1px; border-radius: .5rem; box-shadow: none; font-weight: 600; }
.header-menu-icon { display: inline; width: auto; height: auto; border-radius: 0; background: transparent; color: inherit; font-size: .9rem; }
@media (max-width: 575.98px) { .header-menu-button { min-height: 38px; padding: .35rem .65rem; } }

.site-footer { background: #fff; border-top: 1px solid #e7e2ec; color: #273044; }
.footer-brand { color: #503b77; font-size: 1.35rem; font-weight: 750; letter-spacing: -.4px; text-decoration: none; }
.footer-brand:hover { color: #3e2d5e; }
.site-footer a:not(.footer-brand) { color: #4f3a75; text-decoration: none; }
.site-footer a:not(.footer-brand):hover, .site-footer a:not(.footer-brand):focus-visible { color: #0d6efd; text-decoration: underline; }
.footer-bottom { border-color: #ece8f0 !important; }

/* Εμφάνιση ολόκληρης της εικόνας προϊόντος χωρίς περικοπή. */
.product-image-frame { height: 180px; padding: .8rem; }
.product-detail-image-frame { min-height: 260px; height: 360px; padding: 1rem; }
.product-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center; padding: 0; }
.product-image.is-placeholder { width: 76px; height: 76px; max-width: 76px; max-height: 76px; }
@media (max-width: 575.98px) { .product-image-frame { height: 210px; } .product-detail-image-frame { height: 300px; } }

.cart-row:last-child { border-bottom: 0 !important; }
.cart-quantity { min-width: 2.35rem; opacity: 1 !important; color: #273044 !important; }
.product-card [data-add-to-cart] { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }

.cart-quantity-control { overflow: hidden; border: 1px solid #d8d1e2; border-radius: .65rem; background: #fff; }
.cart-quantity-button { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; color: #503b77; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.cart-quantity-button:hover, .cart-quantity-button:focus-visible { background: #eee8f4; color: #382753; outline: none; }
.cart-quantity { display: grid; place-items: center; min-width: 2rem; height: 2rem; padding-inline: .25rem; border-inline: 1px solid #e5e0ea; color: #273044; font-size: .875rem; font-weight: 700; }
.cart-remove-button { display: grid; place-items: center; flex: 0 0 auto; width: 2.15rem; height: 2.15rem; padding: 0; border: 0; border-radius: .6rem; background: #fff1f2; color: #b42333; }
.cart-remove-button:hover, .cart-remove-button:focus-visible { background: #dc3545; color: #fff; outline: none; }
@media (max-width: 575.98px) { .cart-row { align-items: flex-start !important; flex-wrap: wrap; } .cart-row .flex-grow-1 { flex-basis: calc(100% - 3rem); } .cart-quantity-control { margin-left: auto; } }

/* Πιο άνετο πλάτος για τα modal σε μεγάλες οθόνες. */
@media (min-width: 576px) {
    .modal-dialog { max-width: min(760px, calc(100vw - 3rem)); }
    #cartModal .modal-dialog { max-width: min(980px, calc(100vw - 3rem)); }
}


/* Σύγκριση ολόκληρου καλαθιού ανά supermarket. */
@media (min-width: 576px) {
    #compareModal .modal-dialog { max-width: min(1240px, calc(100vw - 2rem)); }
}
#compareModal .modal-content { min-height: min(680px, calc(100vh - 2rem)); }
.compare-table-wrap { max-height: min(62vh, 620px); }
.compare-table { min-width: 760px; font-size: .9rem; }
.compare-table th { position: sticky; top: 0; z-index: 2; background: #f4f1f7; color: #3e2d5e; white-space: nowrap; }
.compare-table th:first-child, .compare-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 175px; background: #fff; }
.compare-table th:first-child { z-index: 3; background: #f4f1f7; }
.compare-product-heading { min-width: 190px; max-width: 250px; white-space: normal !important; }
.compare-market-complete { border-left: 3px solid #198754; }
.compare-market-incomplete { border-left: 3px solid #dc3545; }
.compare-best-total td { background-color: #ecf8f1; }
.compare-best-total td:first-child { background-color: #ecf8f1; }
.compare-unavailable { color: #9a5960; font-size: .8rem; }


/* Γενική αναζήτηση στην κοινή μπάρα πλοήγησης. */
.site-header .container-xl { gap: .75rem; }
.header-search { flex: 1 1 420px; max-width: 760px; margin-inline: auto; }
.header-search .form-control { min-width: 0; border-color: rgba(255,255,255,.75); }
.header-search .form-control:focus { border-color: #ffc107; box-shadow: 0 0 0 .2rem rgba(255,193,7,.22); }
.header-search-button { --bs-btn-color: #332447; --bs-btn-bg: #ffc107; --bs-btn-border-color: #ffc107; --bs-btn-hover-color: #241936; --bs-btn-hover-bg: #ffd044; --bs-btn-hover-border-color: #ffd044; --bs-btn-active-bg: #e9ae00; --bs-btn-active-border-color: #e9ae00; font-weight: 650; }
.header-search .search-suggestions { text-align: left; }
@media (max-width: 767.98px) {
    .site-header .container-xl { flex-wrap: wrap; }
    .header-search { order: 3; flex-basis: 100%; max-width: none; margin: -.1rem 0 .75rem; }
    .header-search .search-suggestions { max-height: 19rem; }
}

@media (min-width: 992px) {
    .detail-summary-card { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; }
    .detail-summary-card .product-detail-image-frame { height: 100%; min-height: 360px; border-right: 1px solid #eef0f3; border-bottom: 0; border-radius: 14px 0 0 14px; }
    .detail-summary-card .card-body { align-self: center; }
}

.stat-price-date { display: block; margin-top: .15rem; color: #626b74; font-size: .72rem; font-weight: 400; line-height: 1.2; white-space: nowrap; }
.detail-stats-table .text-success { color: #146c43 !important; }
.detail-stats-table .text-danger { color: #b02a37 !important; }

.product-detail-link { color: inherit; text-decoration: none; }
.product-title-link { color: inherit; text-decoration: none; }
.product-title-link:hover, .product-title-link:focus-visible { color: #0d6efd; }
.product-detail-link:hover .product-image, .product-detail-link:focus-visible .product-image { transform: scale(1.025); }
.product-detail-link .product-image { transition: transform .18s ease; }


/* Mobile layout: compact spacing, comfortable touch targets and safe overflow. */
@media (max-width: 575.98px) {
    body { overflow-x: hidden; }
    .site-header .container-xl { gap: .5rem; align-items: center; }
    .navbar-brand { font-size: 1.45rem !important; }
    .header-action-menus { margin-left: auto; gap: .5rem !important; padding-block: .4rem !important; }
    .header-menu-button {
        width: 2.75rem;
        height: 2.75rem;
        min-height: 2.75rem;
        padding: 0;
        justify-content: center;
        border-color: rgba(255,255,255,.35);
        border-radius: .75rem;
        background: rgba(255,255,255,.12);
        color: #fff;
    }
    .header-menu-button::after { display: none; }
    .header-menu-button:hover, .header-menu-button:focus-visible {
        border-color: rgba(255,255,255,.7);
        background: rgba(255,255,255,.22);
        color: #fff;
    }
    .header-menu-button.show, .header-menu-button:active {
        border-color: #fff;
        background: #fff;
        color: #503b77;
    }
    .header-menu-icon { font-size: 1.05rem; }
    .header-menu { width: min(18rem, calc(100vw - 1.25rem)); }
    .header-menu .dropdown-item { min-height: 3rem; }

    .header-search { margin: 0 0 .65rem; }
    .header-search .form-control { min-height: 2.85rem; font-size: 1rem; }
    .header-search-button { width: 3rem; padding-inline: .75rem; }
    .header-search .search-suggestions { max-height: min(55vh, 24rem); right: -.25rem; left: -.25rem; }
    .search-suggestion { gap: .65rem; padding: .72rem .8rem; }

    main.container-xl { padding-top: 1rem !important; padding-bottom: 1.5rem !important; }
    .catalog-heading { align-items: flex-start !important; margin-bottom: .85rem !important; }
    .catalog-heading > div { gap: .35rem !important; }
    .catalog-heading h1 { width: 100%; font-size: 1.25rem; }
    .catalog-heading h2 { font-size: .9rem; }
    .catalog-heading > .small { padding-top: .1rem; }

    .product-card { border-radius: 12px; }
    .product-image-frame { height: 165px; padding: .65rem; }
    .product-card .card-body { padding: .9rem !important; }
    .product-card h3 { font-size: 1rem; }
    .price-row { min-height: 2.75rem; display: flex; align-items: center; }
    .price-row > div { width: 100%; }
    .price-info { width: 1.35rem; height: 1.35rem; }
    .product-card .btn { min-height: 2.75rem; }

    .product-detail-image-frame { height: 220px; min-height: 220px; padding: .75rem; }
    .detail-summary-card .card-body, main > .card .card-body { padding: 1.1rem !important; }
    .detail-summary-card h1 { font-size: 1.35rem; }
    .chart-wrap, .empty-chart { min-height: 245px; }
    main .card-body.p-4 { padding: 1rem !important; }
    #period { min-height: 2.75rem; }
    .table-responsive { margin-inline: -.25rem; padding-inline: .25rem; }
    .table-responsive table { min-width: 620px; }
    .detail-stats-table { min-width: 620px; margin: 0; }

    .modal-dialog { margin: 0; }
    .modal-content { border: 0; border-radius: 0; }
    .modal-header, .modal-body, .modal-footer { padding: 1rem; }
    .modal-footer { gap: .65rem; }
    #cartModal .modal-footer, #compareModal .modal-footer { align-items: stretch; }
    #cartModal .modal-footer > .d-flex, #compareModal .modal-footer > .d-flex { width: 100%; margin-left: 0 !important; }
    #cartModal .modal-footer .btn, #compareModal .modal-footer .btn { min-height: 2.75rem; }
    .compare-table-wrap { max-height: none; }
    .compare-table { font-size: .82rem; }
    .cart-row { gap: .65rem !important; }
    #cartModal { overflow-x: hidden; }
    #cartModal .modal-body { overflow-x: hidden; }
    #cartModal .cart-row { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: center !important; }
    #cartModal .cart-row .flex-grow-1 { grid-column: 1 / -1; min-width: 0; width: 100%; flex-basis: auto; }
    .cart-product-name { white-space: normal; overflow-wrap: anywhere; }
    #cartModal .cart-quantity-control { grid-column: 1; justify-self: start; margin-left: 0; }
    #cartModal .cart-remove-button { grid-column: 2; }
    #cartModal .modal-footer > .d-flex, #compareModal .modal-footer > .d-flex { flex-direction: column; align-items: stretch !important; }
    #cartModal .modal-footer > .d-flex > strong { text-align: center; }
    #cartModal .modal-footer .btn, #compareModal .modal-footer .btn { width: 100%; }
    #cartClear { width: 100%; text-align: center; }
    .cart-quantity-button, .cart-quantity { width: 2.5rem; height: 2.5rem; }
    .cart-remove-button { width: 2.5rem; height: 2.5rem; }

    .pagination { flex-wrap: wrap; justify-content: center; gap: .2rem; }
    .page-link { min-width: 2.65rem; min-height: 2.65rem; display: grid; place-items: center; }
    .site-footer { margin-top: 1.5rem !important; }
    .site-footer .container-xl { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .footer-bottom { text-align: center; }
}
.category-filter-bar {
    display: flex;
    align-items: center;
    padding: .8rem;
    border: 1px solid #e6e1ec;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 .2rem .75rem rgba(62, 45, 94, .06);
}
.category-filter-fields {
    display: grid;
    grid-template-columns: minmax(15rem, 1fr) minmax(15rem, 1fr) auto;
    flex: 1 1 auto;
    align-items: end;
    gap: .65rem;
    min-width: 0;
}
.category-picker { min-width: 0; }
.category-picker-toggle {
    min-height: 2.4rem;
    overflow: hidden;
    border-color: #dcd5e6;
    background-color: #f8f6fb;
    color: #35264f;
    font-size: .875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.category-picker-toggle:disabled { background-color: #f1f2f4; color: #7b8188; opacity: 1; }
.category-picker-menu {
    width: 100%;
    min-width: min(25rem, calc(100vw - 2rem));
    padding: .55rem;
    border-color: #ded7e8;
    border-radius: .75rem;
    box-shadow: 0 .75rem 2rem rgba(39, 48, 68, .16);
}
.category-picker-search-wrap { position: relative; margin-bottom: .45rem; }
.category-picker-search-wrap > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: .75rem;
    color: #776a88;
    transform: translateY(-50%);
    pointer-events: none;
}
.category-picker-search { min-height: 2.45rem; padding-left: 2.25rem; font-size: .875rem; }
.category-picker-options { max-height: 18rem; overflow-y: auto; }
.category-picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    min-height: 2.5rem;
    padding: .45rem .55rem;
    border-radius: .45rem;
    white-space: normal;
}
.category-picker-option > span { min-width: 0; }
.category-picker-option > small { flex: 0 0 auto; color: #776a88; font-weight: 700; }
.category-picker-option.active,
.category-picker-option:active { background: #503b77; color: #fff; }
.category-picker-option.active > small,
.category-picker-option:active > small { color: rgba(255,255,255,.78); }
.category-picker-empty { padding: .8rem .55rem; color: #626b74; font-size: .85rem; text-align: center; }
.category-filter-clear { min-height: 2.4rem; }
.category-filter-clear { display: grid; width: 2.4rem; padding: 0; place-items: center; }
.supermarket-filter-dialog { max-width: min(42rem, calc(100vw - 3rem)); }
.supermarket-choice {
    display: flex;
    min-height: 3rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem .8rem;
    border: 1px solid #e4dfeb;
    border-radius: .65rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.supermarket-choice:hover { border-color: #cfc5dc; background: #faf9fc; }
.supermarket-choice > span { display: flex; min-width: 0; align-items: center; gap: .65rem; }
.supermarket-choice .form-check-input { flex: 0 0 auto; margin: 0; }
.supermarket-choice-all { margin-bottom: .75rem; background: #f8f6fb; }
.supermarket-choice-all > small { color: #776a88; font-weight: 700; }
.supermarket-choice-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
@media (max-width: 991.98px) {
    .category-filter-bar { align-items: stretch; flex-direction: column; gap: .5rem; }
    .category-filter-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; width: 100%; }
}
@media (max-width: 575.98px) {
    .category-filter-bar { padding: .7rem; }
    .category-filter-fields { grid-template-columns: minmax(0, 1fr) auto; }
    .category-picker { grid-column: 1 / -1; }
    .category-filter-clear { grid-column: 1 / -1; width: 100%; }
    .category-picker-menu { min-width: calc(100vw - 2.8rem); }
    .supermarket-filter-dialog { max-width: none; }
    .supermarket-choice-list { grid-template-columns: 1fr; }
}

.ad-slot {
    display: grid;
    width: 100%;
    place-items: center;
}
.ad-slot-frame {
    position: relative;
    display: grid;
    width: 100%;
    min-height: 90px;
    overflow: hidden;
    border: 1px dashed #d9d3e1;
    border-radius: .65rem;
    background: #f4f2f7;
    place-items: center;
}
.ad-slot-label {
    color: #8a8294;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}
@media (max-width: 575.98px) {
    .ad-slot-frame { min-height: 64px; }
}
