:root {
    --green: #23C35F;
    --dark-green: #28663A;
    --blue: #1C4B6E;
    --cream: #F5F0E2;
    --light-blue: #A8B7BC;
    --white: #FFFFFF;
    --grey-text: #9AAEB8;

    /*
     * Height of the supermarket bar that remains
     * visible when the drawer is closed.
     */
    --store-bar-height: 104px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family: Arial, sans-serif;
    background: var(--cream);
    color: var(--blue);

    /*
     * Prevent the entire website from moving when
     * the store selector drawer opens.
     */
    overflow: hidden;
}


/* ================================================================
   HEADER
   ================================================================ */

header {
    height: 77px;

    background: var(--green);
    border-bottom: 6px solid var(--blue);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 8px 26px 8px 12px;

    position: relative;
    z-index: 20;
}

.logo {
    width: 125px;
    height: 55px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
}

.logo-placeholder {
    width: 125px;
    height: 45px;
}

.user-button {
    width: 112px;
    height: 39px;

    background: var(--cream);
    color: var(--blue);

    border: 2px solid var(--blue);
    border-radius: 22px;

    font-size: 16px;

    cursor: pointer;
}


/* ================================================================
   PAGE
   ================================================================ */

.page {
    height: calc(100vh - 77px);

    display: flex;
    flex-direction: column;

    /*
     * The larger bottom padding reserves room for
     * the closed supermarket bar.
     *
     * The two large panels therefore finish ABOVE
     * the supermarket selector instead of continuing
     * underneath it.
     */
    padding:
            28px
            9.5%
            calc(var(--store-bar-height) + 18px);

    position: relative;
}


/* ================================================================
   SEARCH
   ================================================================ */

.search-container {
    width: 100%;
    max-width: 760px;

    margin: 0 auto 18px;

    position: relative;
    z-index: 15;
}

.search-bar {
    height: 55px;

    display: flex;
    align-items: center;

    border-bottom: 2px solid #7E9EAD;
}

.search-icon {
    width: 32px;
    height: 32px;

    margin-right: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.search-icon img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

#search-input {
    width: 100%;
    height: 48px;

    border: none;
    outline: none;

    background: transparent;

    font-size: 25px;
    color: var(--blue);
}

#search-input::placeholder {
    color: #AABCC4;
}


/* ================================================================
   SEARCH RESULTS DROPDOWN
   ================================================================ */

.search-dropdown {
    position: absolute;

    top: 58px;
    left: 0;
    right: 0;

    background: var(--cream);

    border: 3px solid var(--blue);
    border-radius: 0 0 12px 12px;

    max-height: 330px;

    overflow-y: auto;

    box-shadow:
            0 8px 20px
            rgba(28, 75, 110, 0.18);

    display: none;
}

.search-dropdown.visible {
    display: block;
}

.search-result {
    min-height: 58px;

    padding: 10px 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid #B8C5C9;

    gap: 15px;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: #EEE8D8;
}

.search-result-info {
    min-width: 0;
}

.search-result-name {
    font-size: 16px;
    font-weight: bold;

    overflow-wrap: anywhere;
}

.search-result-details {
    font-size: 13px;
    color: #6F8793;

    overflow-wrap: anywhere;
}

.add-button {
    flex-shrink: 0;

    background: var(--green);
    color: var(--blue);

    border: 2px solid var(--blue);
    border-radius: 9px;

    padding: 7px 15px;

    cursor: pointer;

    font-weight: bold;
}

.add-button:hover {
    background: #1FAF55;
}


/* ================================================================
   MAIN PANELS
   ================================================================ */

.content-panels {
    flex: 1;

    min-height: 0;

    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 55px;
}


/*
 * These wrappers are required because the individual panels
 * are now loaded into component root elements.
 */

.panel-root {
    min-width: 0;
    min-height: 0;
}

.panel-root > .main-panel {
    width: 100%;
    height: 100%;
}


.main-panel {
    min-width: 0;
    min-height: 0;

    border: 6px solid var(--green);
    border-radius: 16px;

    background: var(--cream);

    padding: 24px;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.panel-title {
    flex-shrink: 0;

    margin: 0 0 18px;

    font-size: 22px;
    color: var(--blue);
}


/*
 * Allows panel content to scroll internally
 * instead of escaping through the green border.
 */

.panel-content {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding-right: 8px;
}

.panel-content::-webkit-scrollbar {
    width: 7px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #9AAEB8;
    border-radius: 10px;
}


/* ================================================================
   EMPTY PANEL
   ================================================================ */

.empty-panel {
    height: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    color: #A3B7C0;
}

.cart-icon {
    width: 75px;
    height: 75px;

    margin-bottom: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

.empty-panel-text {
    font-size: 18px;
    line-height: 1.35;

    max-width: 270px;
}


/* ================================================================
   SHOPPING LIST
   ================================================================ */

.shopping-item {
    border-bottom: 2px solid #B9C7CB;

    padding: 12px 5px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.shopping-item-info {
    min-width: 0;
}

.shopping-item-name {
    font-size: 17px;
    font-weight: bold;

    overflow-wrap: anywhere;
}

.shopping-item-size {
    font-size: 13px;
    color: #7D929D;

    margin-top: 3px;
}

.quantity-controls {
    flex-shrink: 0;

    display: flex;
    align-items: center;

    gap: 7px;
}

.quantity-button {
    width: 30px;
    height: 30px;

    border: 2px solid var(--blue);
    border-radius: 7px;

    background: var(--green);
    color: var(--blue);

    cursor: pointer;

    font-weight: bold;
    font-size: 17px;
}

.quantity {
    min-width: 22px;

    text-align: center;

    font-weight: bold;
}

.remove-button {
    background: transparent;

    border: none;

    color: #A64A4A;

    cursor: pointer;

    font-size: 12px;
}


/* ================================================================
   BEST OPTIONS
   ================================================================ */

.best-options-container {
    height: 100%;

    display: flex;
    flex-direction: column;
}

.compare-container {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding-top: 16px;
}
.compare-button {
    min-width: 250px;

    padding: 15px 25px;

    background: var(--green);
    color: var(--blue);

    border: 4px solid var(--blue);
    border-radius: 14px;

    font-size: 18px;
    font-weight: bold;

    cursor: pointer;

    transition:
            transform 0.15s ease,
            background 0.15s ease;
}

.compare-button:hover {
    transform: scale(1.03);

    background: #1FAF55;
}

.compare-button:active {
    transform: scale(0.98);
}

.option-card {
    border: 3px solid var(--blue);
    border-radius: 12px;

    padding: 16px;

    margin-bottom: 14px;

    background: #FAF6EA;

    overflow-wrap: anywhere;
}

.option-card h3 {
    margin: 0 0 7px;
}

.option-card p {
    margin: 5px 0;
}

.trip {
    margin-top: 12px;

    padding: 10px;

    border-left: 4px solid var(--green);

    background: #F0EBDC;

    overflow-wrap: anywhere;
}

.trip-title {
    font-weight: bold;
}

.trip-items {
    margin: 7px 0 0;

    padding-left: 20px;
}

.trip-items li {
    margin: 3px 0;

    overflow-wrap: anywhere;
}

/* ================================================================
   STORE SELECTOR BACKGROUND OVERLAY
   ================================================================ */

.store-overlay {
    position: fixed;

    /*
     * Start underneath the main Trollii header.
     */
    top: 77px;
    left: 0;
    right: 0;
    bottom: 0;

    background:
            rgba(28, 75, 110, 0.18);

    opacity: 0;

    pointer-events: none;

    transition:
            opacity 0.3s ease;

    /*
     * Above the normal application,
     * but underneath the store selector.
     */
    z-index: 90;
}


.store-overlay.visible {
    opacity: 1;

    pointer-events: auto;
}


/* ================================================================
   STORE SELECTION DRAWER
   ================================================================ */

.store-selector {
    position: fixed;

    left: 50%;
    bottom: 0;

    width: min(650px, 90vw);
    height: min(560px, 78vh);

    /*
     * Leave the entire supermarket logo/header bar
     * visible when closed.
     */
    transform:
            translateX(-50%)
            translateY(
                    calc(
                            100% - var(--store-bar-height)
                    )
            );

    transition:
            transform
            0.45s
            cubic-bezier(0.4, 0, 0.2, 1);

    z-index: 100;
}


.store-selector.open {
    transform:
            translateX(-50%)
            translateY(0);
}

.store-selector-inner {
    height: 100%;

    background: var(--cream);

    border: 6px solid var(--blue);
    border-bottom: none;

    border-radius: 18px 18px 0 0;

    overflow: hidden;

    box-shadow:
            0 -8px 30px
            rgba(28, 75, 110, 0.22);
}


/* ================================================================
   STORE TAB / ALWAYS-VISIBLE BAR
   ================================================================ */

.store-tab {
    height: var(--store-bar-height);

    background: var(--green);

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 8px 15px;

    cursor: pointer;

    user-select: none;
}


.store-tab-text {
    color: var(--blue);

    font-size: 11px;
    font-weight: normal;

    /*
     * Slightly faded so it behaves like helper text
     * instead of a heading.
     */
    opacity: 0.65;

    text-align: center;
}


/* ================================================================
   SUPERMARKET CHAIN BUTTONS
   ================================================================ */

.chain-buttons {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 12px;

    /*
     * No separate green strip anymore.
     * The store-tab itself supplies the background.
     */
    padding: 0;

    background: transparent;
}

.chain-button {
    width: 58px;
    height: 58px;

    /*
     * No padding allows the PNG to use the entire
     * button area.
     */
    padding: 0;

    background: var(--green);

    border: 3px solid var(--blue);
    border-radius: 8px;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    transition:
            transform 0.15s ease,
            box-shadow 0.15s ease;
}

.chain-button:hover {
    transform: translateY(-2px);
}

.chain-button.selected {
    /*
     * Keep the standard dark-blue border and add an
     * additional cream/dark-blue selection outline.
     */
    box-shadow:
            0 0 0 3px var(--cream),
            0 0 0 6px var(--blue);

    transform: translateY(-2px);
}

.chain-button img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;
}


/* ================================================================
   STORE SELECTOR CONTENT
   ================================================================ */

.store-selector-content {
    height:
            calc(
                    100% - var(--store-bar-height)
            );

    padding: 18px 28px;

    overflow: hidden;

    display: flex;
    flex-direction: column;
}

.store-search {
    height: 40px;

    display: flex;
    align-items: center;

    border-bottom: 2px solid #7E9EAD;

    flex-shrink: 0;
}

.store-search input {
    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    color: var(--blue);

    font-size: 15px;
}

.store-search input::placeholder {
    color: #AABCC4;
}

.selected-chain-text {
    font-size: 12px;

    color: var(--blue);

    margin: 7px 0 10px;

    flex-shrink: 0;
}

.store-list {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;
}

.store-list::-webkit-scrollbar {
    width: 7px;
}

.store-list::-webkit-scrollbar-thumb {
    background: #9AAEB8;

    border-radius: 10px;
}

.store-row {
    min-height: 40px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 5px 0;

    color: var(--blue);

    font-size: 14px;
}

.store-row input {
    width: 19px;
    height: 19px;

    flex-shrink: 0;

    accent-color: var(--green);
}

.store-row label {
    overflow-wrap: anywhere;
}


/* ================================================================
   MOBILE
   ================================================================ */

@media (max-width: 800px) {

    .page {
        padding: 20px 5%;
    }

    .content-panels {
        grid-template-columns: 1fr;

        gap: 18px;

        overflow-y: auto;
    }

    .panel-root {
        min-height: 350px;
    }

    .main-panel {
        min-height: 350px;
    }

    .search-container {
        margin-bottom: 12px;
    }

    #search-input {
        font-size: 20px;
    }

    .store-selector {
        width: 95vw;
    }

    .shopping-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .quantity-controls {
        width: 100%;

        justify-content: flex-end;
    }
    /* ================================================================
   CHEAPEST JOURNEYS EMPTY STATE ALIGNMENT
   ================================================================ */

    /*
     * The shopping-list content area is shorter because the
     * Find Cheapest Journey button occupies space underneath it.
     *
     * Move the Cheapest Journeys empty message upward slightly
     * so both trolley icons line up horizontally.
     */
    .best-options-empty {
        transform:
                translateY(-38px);
    }
}