/* --- 1. CORE LAYOUT --- */
body { 
    font-family: 'Segoe UI', -apple-system, sans-serif; 
    max-width: 100%; margin: 0; padding: 0; 
    background: #f9f9f9; box-sizing: border-box;
}

h2 { color: #333; text-align: center; text-transform: uppercase; letter-spacing: 1px; }

#menu { 
    max-width: 750px; 
    margin: 20px auto; 
    padding: 0 20px;
    box-sizing: border-box;
}

#custom-cart-container { 
    max-width: 750px; 
    margin: 20px auto; 
    padding: 0 20px;
    box-sizing: border-box;
}

/* Standard buttons inside menu items */
.add-btn { 
    background: #28a745; color: white; border: none; 
    padding: 4px 18px; border-radius: 20px; 
    font-weight: bold; cursor: pointer; 
}

/* --- 3. BADGES & STEPPERS --- */

/* The Container: Starts as a square, expands to a pill */
.qty-badge-menu {
    background: #f2f2f2;
    color: #28a745; 
    border: none;
    border-radius: 25px;
    width: 28px; 
    height: 28px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 14px; 
    font-weight: 800; 
    margin-inline-end: 12px;
    flex-shrink: 0;
    overflow: hidden; 
    transition: all 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.qty-badge-menu.open {
    width: auto;
    height: auto;
    justify-content: space-between;
    padding: 5px 12px;
    border-radius: 25px;
    gap: 18px;
}

/* The hidden buttons inside the badge */
.qty-badge-menu button {
    display: none; 
    background: none;
    border: none;
    color: #28a745;
    font-weight: 400;
    cursor: pointer;
    font-size: 22px;
    padding: 0;
    height: auto;
    align-items: center;
}
.qty-badge-menu.open button {
    display: flex; 
}

/* The number inside the badge */
.qty-badge-menu span {
    pointer-events: none;
    font-size: 1.3em;
    font-weight: 500;
    color: #28a745;
}

/* --- 4. CUSTOM PIZZA STATUS (The "White Box") --- */
#custom-cart-status {
    padding: 15px;
    background: #fff;
    border-radius: 15px;
    border: 1px solid #eee;
}

#custom-cart-status.has-custom {
    border-left: 6px solid #28a745;
    transition: border-left 0.3s ease;
}

#live-cart-list p {
    margin: 0;
    font-size: 0.9em;
}

#live-cart-list h4 { 
    margin: 0 0 10px 0; 
    font-size: 0.75em; 
    color: #aaa; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.cart-item:last-child { border-bottom: none; }

.fade-out { opacity: 0 !important; transform: translateX(20px) !important; pointer-events: none; }

/* --- 5. THE BUILDER DRAWER & GRID --- */
.drawer-offscreen {
    position: fixed; bottom: -100%; left: 50%; transform: translateX(-50%); 
    width: 100%; max-width: 750px; height: 100%; background: white; 
    z-index: 9999; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 25px 25px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.drawer-offscreen.active { bottom: 0; }

.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); display: none; z-index: 9998;
}

/* --- 6. STICKY FOOTER PILL --- */
.sticky-footer {
    position: fixed; bottom: 20px; left: 0; width: 100%;
    z-index: 1000; padding: 0 15px; box-sizing: border-box;
    display: none; 
}

/* Hide the cart pill whenever ANY modal is open */
body.modal-open .sticky-footer { 
    display: none !important; 
}

body.builder-open .sticky-footer { display: none !important; }

.checkout-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 22px;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    gap: 20px;
}

.checkout-pill:hover {
    background: #218838;
}

.qty-circle {
    background: white; color: #28a745; width: 28px; height: 28px;
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: .9rem;
}

/* --- 7. UTILITIES & ANIMATIONS --- */

/* --- BUILDER INTERNAL LAYOUT --- */

/* This targets the container inside your drawer-offscreen */
#drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill the entire drawer */
}

.menu-item {
    background: white;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start; /* Aligns badge to top of text */
    justify-content: flex-start;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    gap: 12px;
    transition: transform 0.2s ease;
}

.custom-cart-item {
    background: white;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start; /* Aligns badge to top of text */
    justify-content: flex-start;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    gap: 12px;
    transition: transform 0.2s ease;

}

/* Shared Text Stack */
.item-text-info {
    display: flex;
    flex-direction: column; 
    flex: 1;
    text-align: left;
}

.item-text-info strong {
    font-size: 1.05em;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.2;
}

.item-text-info small {
    font-size: 0.9em;
    color: #999;
    line-height: 1.3;
    margin-bottom: 6px; 
}

/* Shared Price Style */
.item-price, 
.item-total-price {
    font-weight: 800;
    font-size: 0.95em;
    color: #28a745; 
    display: block;
}

/* Specific Tweak for the Summary Box */
#custom-cart-status .custom-cart-item {
    display: flex; /* REQUIRED for flipping to work */
    align-items: center;
    justify-content: space-between;
    border: none;
    border-bottom: 1px solid #f2f2f2;
    border-radius: 0;
    margin-bottom: 0;
    padding: 15px 0;
    width: 100%;
}

/* Force the flip when Hebrew is active */
[dir="rtl"] #custom-cart-status .custom-cart-item {
    flex-direction: row-reverse !important;
}

/* Ensure the text stays aligned to the right in Hebrew */
[dir="rtl"] #custom-cart-status .item-text-info {
    text-align: right !important;
    flex-grow: 1;
    padding-right: 12px;
    padding-left: 0;
}

#custom-cart-status .custom-cart-item:last-child {
    border-bottom: none;
}

/* --- 2. MENU ITEMS & BUILDER BUTTON --- */
.menu-item, .builder-button { 
    background: white; padding: 15px; margin-bottom: 12px; 
    border-radius: 12px; display: flex; justify-content: space-between; 
    align-items: center; border: 1px solid #eee; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.builder-action-hint { color: #28a745; font-weight: bold; }

/* The "Window" */
.hero-image-container {
    width: 100%;
    height: 220px;       /* This is your rectangle height - adjust as needed */
    overflow: hidden;    /* Anything outside the 220px height is hidden */
    position: relative;  /* Keeps it at the top of the page flow */
    margin: 0;
    padding: 0;
}

/* The "Pizza" */
.hero-img {
    width: 100%;
    height: 100%;        /* Forces image to fill the container height */
    
    /* THE CRITICAL LINE: This ensures the image isn't squashed.
       It behaves like a background 'cover' */
    object-fit: cover;
    
    /* This centers the pizza so the crop happens equally top/bottom */
    object-position: center; 
    
    display: block;
}

/* The Nav Bar - Starts transparent */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px; /* Increased slightly for better breathing room */
    display: flex;
    align-items: center; /* Vertically centers the buttons */
    justify-content: space-between; /* Pushes back-btn to left, action-btn to right */
    padding: 0 16px; /* This is your horizontal "safe zone" */
    box-sizing: border-box; /* Important: keeps the padding inside the 100% width */
    z-index: 1000;
    transition: background 0.3s ease;
}

/* When Scrolled */
.nav-bar.scrolled {
    background: white;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 60px; /* Consistent height when sticky */
}

/* The Logo - Center/Bottom position */
.header-logo {
    position: absolute;
    left: 50%;
    top: 110px;
    width: 80px; height: 80px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: pointer;
}

/* Logo when scrolled - Top/Left position */
.nav-bar.scrolled .header-logo {
    left: 15px; /* Adjust based on if you have a back button */
    top: 50%;   /* Use 50% for perfect vertical centering */
    width: 35px; 
    height: 35px;
    transform: translateY(-50%); /* Only translate Y, remove X centering */
}

.action-btn {
width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white; /* You can also use rgba(255, 255, 255, 0.9) */
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); /* Makes them look "floating" */
    color: #333; /* Icon color */
    transition: all 0.3s ease;
    position: fixed;
    top: 10px;       /* Pushes it to the top edge */
    right: 20px;     /* Keeps it on the right side */
    z-index: 9999;
}

/* Size the SVG */
.link-icon {
    width: 20px;
    height: 20px;
}


/* 1. Default State (At the top) */
.link-icon {
    display: block;
    width: 20px;
    height: 20px;
}

.link-icon { display: none; }
.dots-icon { display: block; font-size: 24px; font-weight: bold; color: #333; }

#toast {
    position: fixed;
    bottom: 100px; 
    left: 50%;
    transform: translateX(-50%);
    background: rgba(51, 51, 51, 0.95); /* Slightly transparent look */
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden; /* Added for extra safety */
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    /* Highest priority z-index */
    z-index: 99999; 
    pointer-events: none;
}

#toast.show { 
    opacity: 1; 
    visibility: visible;
    transform: translateX(-50%) translateY(-10px); /* Small "pop-up" animation */
}


.action-wrapper {
    position: relative; 
    display: flex;
    align-items: center;
}

.dropdown-menu {
    display: none;
    position: fixed;
    top: 55px;
    right: 0;
    left: auto;
    width: 220px;
    background: white;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border: 1px solid #eee;
    z-index: 2000;
    flex-direction: column;
}

.dropdown-menu.active {
    display: flex;
}

.more-menu-item {
    padding: 16px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    background: white;
    text-align: left;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f2f2f2; /* The "separator" line */
    transition: background 0.2s ease;
}

/* Remove the line from the very last item */
.more-menu-item:last-child {
    border-bottom: none;
}

.more-menu-item:hover {
    background: #f9f9f9;
}


.header-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* Tight gap between chips */
    margin: 10px auto 25px auto;
    padding: 0 15px;
    flex-wrap: wrap;
}

.header-info-chip {
    background: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #555;
    border: 1px solid #eee;
    /* Soft shadow for the MVP look */
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.header-info-item {
    white-space: nowrap;
}

.header-info-status {
    color: #28a745;
    font-weight: 700;
}

.header-info-dot {
    color: #ddd;
    font-size: 8px;
    user-select: none; /* Prevents selecting the dot when copying text */
}

.header-info-chip.pickup-chip {
    background: #f0faf3 !important;
    border: 1.5px solid #28a745 !important;
    cursor: pointer;
}

.pickup-chip {
    background: #f0faf3 !important;
    border-color: #28a745 !important;
    color: #28a745 !important;
    cursor: pointer;
}


/* BUSINESS INFORMATION MODAL */

.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

/* This class will be added/removed by JavaScript */
.modal-open {
    overflow: hidden;
    height: 100vh;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    border-radius: 12px;
    padding: 0 24px 24px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 16px 0 8px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #888;
}

.info-section {
    margin-top: 20px;
}

.info-section h3 {
    font-size: 20px;
    margin-bottom: 4px;
    color: #333;
}

.shop-desc {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}


.more-info-link {
    color: #28a745; /* Wolt Blue */
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.more-info-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Ensure the container keeps them on the same line */
.header-fees-container {
    display: flex;
    align-items: center;
}



/* 1. The Main Container (Positioning) */
.lang-dropdown {
    position: fixed;
    top: 10px;
    right: 80px;
    z-index: 10000;
    font-family: sans-serif;
    display: inline-block;
}

/* 2. The Trigger Button */
.lang-trigger {
    width: 100%; /* Make sure it fills the container */
    background: white;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* FIX: Force LTR and Row order so it doesn't flip in Hebrew */
    direction: ltr !important;
    flex-direction: row !important;
    line-height: 1; /* Prevents text height from pushing the container */
}

/* 3. The Menu */
.lang-options {
    display: none; 
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    flex-direction: column;
    overflow: hidden;
}

/* This class will be toggled by JS */
.lang-options.active {
    display: flex;
}

.lang-options a {
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid #f2f2f2;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* RECTANGULAR FLAG STYLE */
.lang-options img, .lang-trigger img {
    width: 32px;        /* Fixed width */
    height: 22px;       /* Fixed height for rectangular look */
    border-radius: 2px; /* Slight rounding on corners */
    object-fit: cover;  /* Prevents squishing */
    border: 1px solid #eee; /* Adds a tiny border so white flags don't disappear */
    display: block; 
    margin: 0;
}

.lang-options a:hover {
    background: #f8f9fa;
    border-radius: 12px;
    color: #007bff;
}

.lang-options a:last-child {
    border-bottom: none;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 6. The Arrow Icon */
.arrow-down {
    border: solid #666;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 2px;
    transform: rotate(45deg);
    margin-left: 5px;
    margin-bottom: 2px; /* Pulls it up slightly to feel centered with text */
}


/* 4. The Text Span (Ensures centering) */
#current-lang-text {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%; /* Match parent height */
}

@media (min-width: 769px) {
    #active-columns,
    #history-columns {
        align-items: stretch;
    }

    #active-columns > div,
    #history-columns > div {
        height: calc(100vh - 241px);
        overflow-y: auto;
        min-height: unset;
    }

    #active-columns > div > h2,
    #history-columns > div > h2 {
        position: sticky;
        top: 0;
        z-index: 10;
        background: inherit;
        margin: -10px -10px 10px -10px;
        padding: 10px 10px 10px 10px;
    }
}

@media (max-width: 768px) {
    #pizza-modal-content .builder-img-wrap {
        height: 80px !important;
    }
}
