
  /* Meal scan modal detail CSS */
  /* =========================================================
   Meal Result Card
   Used by scan confirmation Swal + meal detail modal
   ========================================================= */

.meal-result-card {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    color: #171b17;
    text-align: left;
}


/* ---------- Image ---------- */

.meal-result-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 20px;
    background: #f3f5f3;
    aspect-ratio: 16 / 10;
}

.meal-result-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}


/* ---------- Overview ---------- */

.meal-result-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 10px 16px;
    text-align: center;
}

.meal-result-calories {
    color: #101310;
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.045em;
}

.meal-result-calories span {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.meal-result-goal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin-top: 10px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #edf7ef;
    color: #317545;
    font-size: 0.75rem;
    line-height: 1.25;
    font-weight: 800;
}

.meal-result-goal-icon {
    flex-shrink: 0;
}


/* ---------- Macros ---------- */

.meal-result-macros {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 22px;
}

.meal-result-macro {
    min-width: 0;
    padding: 13px 8px 11px;
    border: 1px solid #edf0ed;
    border-radius: 15px;
    background: #f8f9f8;
    text-align: center;
}

.meal-result-macro strong {
    display: block;
    color: #161916;
    font-size: 1rem;
    line-height: 1.15;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.meal-result-macro span {
    display: block;
    margin-top: 4px;
    color: #8a908a;
    font-size: 0.62rem;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}


/* ---------- Ingredients ---------- */

.meal-result-foods {
    margin-top: 2px;
}

.meal-result-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    color: #3c423c;
    font-size: 0.7rem;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.065em;
}

.meal-result-section-head > span:last-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 23px;
    height: 23px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f1f3f1;
    color: #767d76;
    font-size: 0.65rem;
}

.meal-result-food-list {
    border-top: 1px solid #edf0ed;
}

.meal-result-food {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid #edf0ed;
}

.meal-result-food-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.meal-result-food-emoji {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;

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

    border-radius: 11px;
    background: #f4f6f4;
    font-size: 1.25rem;
}

.meal-result-food-copy {
    min-width: 0;
}

.meal-result-food-name {
    overflow: hidden;
    color: #171a17;
    font-size: 0.84rem;
    line-height: 1.25;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.meal-result-food-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    color: #8a908a;
    font-size: 0.68rem;
    line-height: 1.2;
}

.meal-result-food-macros {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 7px;
    flex-shrink: 0;
    color: #777d77;
    font-size: 0.62rem;
    line-height: 1.2;
    white-space: nowrap;
}

.meal-result-food-macros strong {
    color: #4b514b;
    font-weight: 900;
}


/* ---------- Actions ---------- */
.meal-result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
}

.meal-result-action-note {
    max-width: 330px;
    margin: 0 0 4px;
    color: #7b827b;
    font-size: 0.72rem;
    line-height: 1.45;
    text-align: center;
}

.meal-result-primary-btn {
    min-width: 170px;
    min-height: 44px;
    padding: 10px 20px;

    border: 0;
    border-radius: 999px;

    background: #00060c;
    color: #fff;

    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.015em;

    cursor: pointer;
    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}

.meal-result-primary-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.meal-result-primary-btn:active {
    transform: translateY(0);
}

.meal-result-primary-btn i {
    margin-right: 6px;
}

.meal-result-close-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 4px 12px;

    color: #858b85;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;

    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;

    transition:
        color 0.15s ease,
        opacity 0.15s ease;
}

.meal-result-close-btn:hover {
    color: #222;
}

.meal-result-close-btn:focus {
    outline: none;
}
/* =========================================================
   SweetAlert wrapper
   ========================================================= */

.swal2-popup.meal-result-swal {
    width: min(92vw, 470px);
    padding: 24px 22px 20px;
    border-radius: 24px;
}

.meal-result-swal .swal2-title {
    margin: 0 0 16px;
    padding: 0 28px;

    color: #242824;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: -0.025em;
}

.meal-result-swal-content {
    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   Meal detail modal
   ========================================================= */

#mealDetailModal .modal-content {
    border: 0;
    border-radius: 22px;
    overflow: hidden;
}

#mealDetailModal .modal-header {
    padding: 20px 22px 15px;
    border-bottom: 1px solid #f0f1f0;
}

#mealDetailModal .modal-title {
    color: #181b18;
    font-size: 1.05rem;
    font-weight: 900;
}

#mealDetailModal .modal-body {
    padding: 18px 22px 24px;
}

/* =========================================================
   Meal Scan Progress
   ========================================================= */

.meal-scan-progress {
    width: 100%;
    max-width: 240px;
    margin: 0 auto 8px;
}

.meal-scan-image-stage {
    position: relative;
    width: 100%;
    overflow: hidden;

    border-radius: 16px;
    background: #f2f4f2;
}

.meal-scan-progress-image {
    display: block;
    width: 100%;
    height: auto;
}

.meal-scan-progress-line {
    position: absolute;
    z-index: 2;

    left: 0;
    top: 0;

    width: 100%;
    height: 3px;

    background: #39d376;

    box-shadow:
        0 0 8px rgba(57, 211, 118, 0.65),
        0 0 16px rgba(57, 211, 118, 0.28);

    animation: mealScanLine 2s ease-in-out infinite;
}

@keyframes mealScanLine {

    0% {
        top: 0;
        transform: translateY(0);
        opacity: 0.7;
    }

    50% {
        top: 100%;
        transform: translateY(-100%);
        opacity: 1;
    }

    100% {
        top: 0;
        transform: translateY(0);
        opacity: 0.7;
    }
}

.meal-scan-progress-emojis {
    min-height: 38px;
    margin-top: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;

    font-size: 1.65rem;
    line-height: 1;
}
/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 576px) {

    .swal2-popup.meal-result-swal {
        width: calc(100% - 22px);
        padding: 20px 16px 18px;
        border-radius: 22px;
    }

    .meal-result-media {
        border-radius: 17px;
        aspect-ratio: 16 / 10;
    }

    .meal-result-overview {
        padding: 16px 6px 14px;
    }

    .meal-result-calories {
        font-size: 1.8rem;
    }

    .meal-result-macros {
        gap: 7px;
        margin-bottom: 20px;
    }

    .meal-result-macro {
        padding: 11px 5px 10px;
        border-radius: 13px;
    }

    .meal-result-food {
        gap: 8px;
        padding: 9px 0;
    }

    .meal-result-food-emoji {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
        font-size: 1.1rem;
    }

    .meal-result-food-name {
        font-size: 0.8rem;
    }

    .meal-result-food-macros {
        gap: 5px;
        font-size: 0.58rem;
    }

    #mealDetailModal .modal-body {
        padding: 16px;
    }
}


/**/
/* ---------------------------------
   Meal Scan - Retry / Error Swal
---------------------------------- */

.meal-retry-swal {
    width: min(92vw, 410px) !important;
    padding: 28px 24px 22px !important;
    border-radius: 22px !important;
    background: #fff !important;
    box-shadow: 0 24px 70px rgba(0, 6, 12, 0.18) !important;
}

.meal-retry-icon {
    width: 58px !important;
    height: 58px !important;
    margin: 0 auto 18px !important;
    border-width: 2px !important;
}

.meal-retry-title {
    margin: 0 !important;
    padding: 0 !important;
    color: #00060c !important;
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
}

.meal-retry-content {
    margin: 12px 0 0 !important;
    padding: 0 !important;
}

.meal-retry-copy {
    max-width: 330px;
    margin: 0 auto;
    text-align: center;
}

.meal-retry-copy p {
    margin: 0 0 8px;
    color: #555d58;
    font-size: 0.9rem;
    line-height: 1.5;
}

.meal-retry-copy span {
    display: block;
    color: #838b85;
    font-size: 0.75rem;
    line-height: 1.45;
}

.meal-retry-actions {
    width: 100% !important;
    margin: 22px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.meal-retry-confirm,
.meal-retry-cancel {
    width: 100%;
    min-height: 46px;
    margin: 0 !important;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 700;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.meal-retry-confirm {
    border: 1px solid #00060c;
    background: #00060c;
    color: #fff;
}

.meal-retry-cancel {
    border: 1px solid #e5e9e6;
    background: #fff;
    color: #323833;
}

.meal-retry-confirm:hover,
.meal-retry-cancel:hover {
    transform: translateY(-1px);
}

.meal-retry-confirm:active,
.meal-retry-cancel:active {
    transform: translateY(0);
}

.meal-retry-confirm i,
.meal-retry-cancel i {
    margin-right: 7px;
}

.meal-retry-close {
    color: #8b928d !important;
    font-size: 1.5rem !important;
}

.meal-retry-close:hover {
    color: #00060c !important;
}

@media (max-width: 480px) {
    .meal-retry-swal {
        width: calc(100vw - 28px) !important;
        padding: 24px 18px 18px !important;
        border-radius: 18px !important;
    }

    .meal-retry-title {
        font-size: 1.15rem !important;
    }

    .meal-retry-actions {
        margin-top: 18px !important;
    }
}