/*
 * FoodiePress - Popup Modal Styles v4.1.2 (Final Fixes)
 */

:root {
    --fp-modal-bg: #ffffff;
    --fp-modal-text-primary: #2e3138;
    --fp-modal-text-secondary: #5f656b;
    --fp-modal-border-color: #f0f0f0;
    --fp-modal-accent: #e21b70;
    --fp-modal-optional-bg: #f4f5f5;
    --fp-variation-bg: rgba(226, 27, 112, 0.05);
}

body.fp-body-noscroll {
    overflow: hidden;
}

body.fp-modal-is-open {
    overscroll-behavior-y: contain;
}

.fp-modal-container {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10002;
    background-color: rgba(0,0,0,0);
    font-family: 'Rubik', sans-serif;
    transition: background-color 0.4s ease;
    justify-content: center;
    align-items: flex-end; /* Mobile-first: bottom sheet */
}
.fp-modal-container.open { 
    display: flex;
    background-color: rgba(9, 12, 15, 0.64);
}

.fp-modal-content-new {
    background-color: var(--fp-modal-bg);
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.fp-modal-content-new.is-visible {
    transform: translateY(0);
}
.fp-modal-content-new.is-dragging {
    transition: none;
}

/* Restored original mobile height logic */
.fp-modal-content-new.has-options { height: 80vh; max-height: 80vh; }
.fp-modal-content-new.no-options {
  height: 70vh;
  max-height: 70vh;
}
@media screen and (min-height: 600px) and (max-height: 699px) {
  .fp-modal-content-new.no-options { height: 75vh; max-height: 75vh; }
}
@media screen and (min-height: 700px) and (max-height: 729px) {
  .fp-modal-content-new.no-options { height: 70vh; max-height: 70vh; }
}
@media screen and (min-height: 730px) and (max-height: 829px) {
  .fp-modal-content-new.no-options { height: 65vh; max-height: 65vh; }
}
@media screen and (min-height: 830px) and (max-height: 859px) {
  .fp-modal-content-new.no-options { height: 60vh; max-height: 60vh; }
}
@media screen and (min-height: 860px) and (max-height: 949px) {
  .fp-modal-content-new.no-options {height: 64vh;max-height: 59vh;}
}
@media screen and (min-height: 950px) and (max-height: 999px) {
  .fp-modal-content-new.no-options { height: 50vh; max-height: 50vh; }
}

/* Drag handle and spinner */
.fp-modal-drag-handle { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 5px; background-color: #cccccc; border-radius: 2.5px; z-index: 15; cursor: grab; }
.fp-loading-spinner-wrapper { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.fp-loading-spinner { width: 48px; height: 48px; border: 5px solid rgba(255,255,255,0.3); border-bottom-color: #FFF; border-radius: 50%; display: inline-block; animation: fp-spinner-rotation 1s linear infinite; }
@keyframes fp-spinner-rotation { 100% { transform: rotate(360deg); } }

/* Desktop Overrides */
@media (min-width: 768px) {
    .fp-modal-container { align-items: center; padding: 40px; }
    .fp-modal-drag-handle { display: none; }
    .fp-modal-content-new { width: 100%; max-width: 640px; border-radius: 12px; transform: scale(0.9); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease; }
    .fp-modal-content-new.is-visible { transform: scale(1); opacity: 1; }
    .fp-modal-content-new.has-options, .fp-modal-content-new.no-options { height: auto; max-height: 90vh; }
    .fp-modal-close-btn { background-color: #e8e9ea; color: #707070; }
    .fp-modal-product-image-container { height: 300px; border-radius: 12px 12px 0 0; }
}

/* Fixed Height & Internal Scrolling Structure */
.fp-modal-form { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.fp-modal-scroll-area-new { flex-grow: 1; overflow-y: auto; min-height: 0; scrollbar-width: none; /* Firefox */ }
.fp-modal-scroll-area-new::-webkit-scrollbar { display: none; /* Chrome, Safari */ }
.fp-modal-footer-new, .fp-modal-product-image-container { flex-shrink: 0; }
.fp-modal-product-image-container img { width: 100%; height: 100%; object-fit: contain; } /* Prevents cropping */

/* Base Content Styles */
.fp-modal-close-btn { position: absolute; top: 12px; right: 12px; z-index: 15; cursor: pointer; background-color: rgba(0,0,0,0.2); border-radius: 50%; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; border: none; font-size: 1.5rem; color: #fff; }
.fp-modal-inner-padding { padding: 0 24px; }
.fp-modal-product-header { margin: 24px 0 12px 0; }
.fp-modal-product-title { text-align: center; font-size: 1.8rem; font-weight: 700; color: var(--fp-modal-text-primary); margin: 0; }
.fp-modal-product-price { text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--fp-modal-text-primary); margin-top: 4px; }
.fp-modal-product-description { text-align: center; font-size: 1rem; line-height: 1.6; color: var(--fp-modal-text-secondary); margin-top: 12px; }

/* Options Styling (Addons and Variations) */
.fp-options-wrapper { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.fp-choice-group-wrapper { background-color: rgba(226, 27, 112, 0.05); border: 1px solid rgba(226, 27, 112, 0.1); border-radius: 12px; padding: 16px; }
.fp-variation-wrapper { background-color: var(--fp-variation-bg); }
.fp-choice-group-heading { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; font-weight: 700; margin: 0 0 4px 0; }
.fp-choice-required-badge, .fp-choice-optional-badge { font-size: 0.7rem; font-weight: 500; padding: 3px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.fp-choice-required-badge { background-color: var(--fp-modal-accent); color: #fff; }
.fp-choice-optional-badge { background-color: #e9ecef; color: #495057; }
.fp-choice-group-subtitle { font-size: 0.9rem; color: var(--fp-modal-text-secondary); margin: 0 0 12px 0; }
.fp-choice-list { display: flex; flex-direction: column; gap: 8px; }
.fp-choice-item { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 12px; background-color: var(--fp-modal-bg); padding: 12px; border-radius: 8px; cursor: pointer; border: 1px solid #eee; transition: all 0.2s ease; }
.fp-choice-item.is-selected { border-color: var(--fp-modal-accent); box-shadow: 0 0 0 1px var(--fp-modal-accent); }
.fp-choice-item.is-disabled { opacity: 0.5; cursor: not-allowed; }
.fp-choice-item input[type="radio"], .fp-choice-item input[type="checkbox"] { appearance: none; -webkit-appearance: none; margin: 0; width: 20px; height: 20px; border: 2px solid #adb5bd; border-radius: 50%; transition: all 0.2s ease; display: grid; place-content: center; }
.fp-choice-item input[type="checkbox"] { border-radius: 4px; }
.fp-choice-item input[type="radio"]::before, .fp-choice-item input[type="checkbox"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; transform: scale(0); transition: 120ms transform ease-in-out; background-color: var(--fp-modal-accent); }
.fp-choice-item input[type="checkbox"]::before { border-radius: 2px; }
.fp-choice-item input:checked { border-color: var(--fp-modal-accent); }
.fp-choice-item input:checked::before { transform: scale(1); }
form.cart table.variations { display: none !important; }

/* Modal Footer */
.fp-modal-footer-new { padding: 16px 24px; border-top: 1px solid var(--fp-modal-border-color); box-shadow: 0 -4px 12px rgba(0,0,0,0.05); display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; z-index: 5;padding-bottom: calc(16px + env(safe-area-inset-bottom, 1rem)); }
.fp-quantity-selector { display: flex; align-items: center; justify-content: space-between; background-color: var(--fp-modal-optional-bg); border-radius: 12px; height: 52px; }
.fp-quantity-selector .fp-qty-btn { background: none; border: none; font-size: 1.8rem; color: var(--fp-modal-accent); width: 40px; cursor: pointer; font-weight: 400; }
.fp-quantity-selector .fp-quantity-display { width: 40px; text-align: center; font-size: 1.1rem; font-weight: 700; color: var(--fp-modal-text-primary); }
.fp-modal-footer-new .fp-add-to-cart-button { color: #ffffff; height: 52px; font-size: 1rem; border-radius: 12px; background-color: var(--fp-modal-accent); font-weight: 700; border: none; cursor: pointer; transition: all 0.3s ease; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; width: 100%; }
.fp-modal-footer-new .fp-add-to-cart-button:disabled { background-color: #cccccc; cursor: not-allowed; }
.fp-add-to-cart-text { text-transform: uppercase; }

/* Mobile Layout for Button */
@media (max-width: 480px) {
    .fp-modal-footer-new .fp-add-to-cart-button {
        flex-direction: column;
        justify-content: center;
        gap: 0;
        line-height: 1.3;
        padding: 6px 12px;
        text-align: center;
    }
    .fp-add-to-cart-text { font-size: 0.9rem; }
    .fp-add-to-cart-total-price { font-size: 0.8rem; margin-left: 0; }
}

/* === FIX: Theme Override for Heading Colors === */
/* This rule is more specific than the theme's generic 'h3' rule, ensuring our color is used. */
/* The !important flag is used to override aggressive theme styling. */
.fp-modal-content-new h3.fp-choice-group-heading {
    color: var(--fp-modal-text-primary, #2e3138) !important;
}