/* =========================================================
   MELFAM HOME ESSENTIALS
   VISUAL SHOPPING / LIST MAKER
   ========================================================= */


/* ---------------------------------------------------------
   HOME SCREEN
   --------------------------------------------------------- */

#homeScreen {
    position: relative;
}


/* ---------------------------------------------------------
   SECTION CARDS
   Large visual targets for easy selection
   --------------------------------------------------------- */

.section-card {
    cursor: pointer;
    user-select: none;
}

.section-card:nth-child(4n + 1) {
    background: #eef8f1;
}

.section-card:nth-child(4n + 2) {
    background: #eef6ff;
}

.section-card:nth-child(4n + 3) {
    background: #fff8e6;
}

.section-card:nth-child(4n + 4) {
    background: #f5f0ff;
}

.section-card:hover {
    background: #e8f5ed;
}


/* ---------------------------------------------------------
   PRODUCT CARD
   --------------------------------------------------------- */

.product-card {
    cursor: pointer;
    user-select: none;
}


/* Selected product */

.product-card.selected {
    border: 3px solid #16834f;
    background: #e8f5ed;
}


/* Large selected indicator */

.product-card.selected::after {
    content: "✓";

    position: absolute;

    top: 12px;
    right: 12px;

    width: 42px;
    height: 42px;

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

    border-radius: 50%;

    background: #16834f;
    color: white;

    font-size: 25px;
    font-weight: 800;

    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, 0.16);
}


/* ---------------------------------------------------------
   PRODUCT INFORMATION
   --------------------------------------------------------- */

.product-information {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.product-section-label {
    color: #637268;

    font-size: 13px;
    font-weight: 600;
}


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


/* IMPORTANT:
   Product names are intentionally NOT translated.
*/


.product-price {
    margin-top: 3px;
}


/* ---------------------------------------------------------
   PRODUCT VOICE BUTTON
   --------------------------------------------------------- */

.product-speak-button {
    position: absolute;

    left: 12px;
    top: 12px;

    width: 42px;
    height: 42px;

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

    border: none;
    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.94);

    box-shadow:
        0 3px 10px
        rgba(0, 0, 0, 0.12);

    font-size: 21px;

    z-index: 3;
}


.product-speak-button:hover {
    background: #e8f5ed;
}


.product-speak-button:active {
    transform: scale(0.94);
}


/* ---------------------------------------------------------
   SELECTED LABEL
   --------------------------------------------------------- */

.selected-label {
    display: none;

    margin-top: 8px;

    padding:
        7px
        9px;

    border-radius: 9px;

    background: #16834f;
    color: white;

    text-align: center;

    font-size: 13px;
    font-weight: 800;
}


.product-card.selected
.selected-label {
    display: block;
}


/* ---------------------------------------------------------
   PRODUCT QUANTITY
   Appears after selection
   --------------------------------------------------------- */

.product-card-quantity {
    display: none;

    margin-top: 10px;

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

    gap: 10px;
}


.product-card.selected
.product-card-quantity {
    display: flex;
}


.product-card-quantity button {
    width: 40px;
    height: 40px;

    border: none;
    border-radius: 11px;

    background: #16834f;
    color: white;

    font-size: 23px;
    font-weight: 800;
}


.product-card-quantity button:first-child {
    background: white;
    color: #10231a;

    border:
        1px solid
        #cad5ce;
}


.product-card-quantity strong {
    min-width: 32px;

    text-align: center;

    font-size: 20px;
}


/* ---------------------------------------------------------
   EMPTY LIST
   --------------------------------------------------------- */

.empty-shopping-list {
    padding:
        55px
        20px;

    text-align: center;

    color: #637268;
}


.empty-shopping-list-icon {
    margin-bottom: 15px;

    font-size: 60px;
}


.empty-shopping-list h3 {
    margin-bottom: 7px;

    color: #10231a;

    font-size: 22px;
}


.empty-shopping-list p {
    line-height: 1.5;
}


/* ---------------------------------------------------------
   LIST ITEM REMOVE BUTTON
   --------------------------------------------------------- */

.remove-list-item {
    border: none;

    background: transparent;

    color: #c9342c;

    font-size: 14px;
    font-weight: 700;
}


.remove-list-item:hover {
    text-decoration: underline;
}


/* ---------------------------------------------------------
   PRICE / TOTAL
   --------------------------------------------------------- */

.list-item-price {
    display: block;

    margin-top: 4px;

    color: #16834f;

    font-weight: 700;
}


/* ---------------------------------------------------------
   DONE BUTTON
   --------------------------------------------------------- */

#finishListButton {
    margin-top: 12px;
}


#finishListButton:disabled {
    cursor: not-allowed;

    opacity: 0.45;
}


/* ---------------------------------------------------------
   FINISHED LIST SUMMARY
   --------------------------------------------------------- */

.finished-list-summary {
    margin:
        20px
        0
        28px;

    padding: 20px;

    border:
        1px solid
        #d7e0da;

    border-radius: 16px;

    background: #f7faf8;

    text-align: left;
}


.finished-list-summary-row {
    display: flex;

    justify-content: space-between;

    gap: 15px;

    padding:
        8px
        0;

    border-bottom:
        1px solid
        #e5ebe7;
}


.finished-list-summary-row:last-child {
    border-bottom: none;
}


/* ---------------------------------------------------------
   VISUAL FEEDBACK
   --------------------------------------------------------- */

.tap-feedback {
    animation:
        melfamTap
        0.22s ease;
}


@keyframes melfamTap {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.96);
    }

    100% {
        transform: scale(1);
    }

}


/* ---------------------------------------------------------
   LIST COUNTER PULSE
   --------------------------------------------------------- */

.list-count.changed {
    animation:
        listCounterPulse
        0.35s ease;
}


@keyframes listCounterPulse {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.35);
    }

    100% {
        transform: scale(1);
    }

}


/* ---------------------------------------------------------
   TOAST MESSAGE
   --------------------------------------------------------- */

.shopping-toast {
    position: fixed;

    left: 50%;
    bottom: 25px;

    transform:
        translateX(-50%)
        translateY(30px);

    z-index: 5000;

    width:
        min(
            calc(100% - 40px),
            420px
        );

    padding:
        15px
        20px;

    border-radius: 14px;

    background: #10231a;
    color: white;

    text-align: center;

    font-size: 16px;
    font-weight: 700;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.20);

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}


.shopping-toast.show {
    opacity: 1;

    transform:
        translateX(-50%)
        translateY(0);
}


/* ---------------------------------------------------------
   PRODUCT IMAGE FALLBACK
   --------------------------------------------------------- */

.product-image-fallback {
    width: 100%;
    height: 100%;

    display: flex;

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

    background: #f3f6f2;

    font-size: 65px;
}


/* ---------------------------------------------------------
   SECTION IMAGE
   --------------------------------------------------------- */

.section-image {
    width: 65px;
    height: 65px;

    object-fit: contain;

    border-radius: 12px;
}


/* ---------------------------------------------------------
   LOADING SPINNER
   --------------------------------------------------------- */

.shopping-spinner {
    width: 35px;
    height: 35px;

    margin:
        5px
        auto
        15px;

    border:
        4px solid
        #dce7df;

    border-top-color:
        #16834f;

    border-radius: 50%;

    animation:
        melfamSpin
        0.8s linear infinite;
}


@keyframes melfamSpin {

    to {
        transform: rotate(360deg);
    }

}


/* ---------------------------------------------------------
   ERROR RETRY
   --------------------------------------------------------- */

.retry-button {
    margin-top: 15px;

    padding:
        10px
        18px;

    border: none;
    border-radius: 10px;

    background: #16834f;
    color: white;

    font-weight: 700;
}


/* ---------------------------------------------------------
   MOBILE IMPROVEMENTS
   --------------------------------------------------------- */

@media (max-width: 600px) {

    /*
       Large tap targets are deliberate because this
       interface is intended to minimize typing.
    */

    .section-card {
        min-height: 150px;
    }


    .section-icon {
        font-size: 48px;
    }


    .section-card strong {
        font-size: 17px;
    }


    .product-card {
        min-height: 250px;
    }


    .product-card.selected {
        border-width: 3px;
    }


    .product-speak-button {
        width: 44px;
        height: 44px;
    }


    .product-card-quantity button {
        width: 44px;
        height: 44px;
    }


    .shopping-list-item {
        padding: 14px;
    }


    .remove-list-item {
        min-height: 38px;
    }

}


/* ---------------------------------------------------------
   ACCESSIBILITY
   --------------------------------------------------------- */

button:focus-visible,
.section-card:focus-visible,
.product-card:focus-visible {

    outline:
        4px solid
        rgba(
            215,
            169,
            46,
            0.55
        );

    outline-offset:
        3px;
}


/* ---------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------- */

@media (
    prefers-reduced-motion: reduce
) {

    *,
    *::before,
    *::after {

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            0.01ms !important;

        scroll-behavior:
            auto !important;

    }

}


/* =========================================================
   END MELFAM SHOPPING STYLES
   ========================================================= */
