/* ==========================================================================
   Custom Burger Stack Builder Styles (Inspired by Tall Order interactive reel)
   ========================================================================== */

.custom-builder-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(circle at 50% 35%, #103B2C 0%, #081F17 65%, #04120D 100%);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-family: var(--apple-font, "Cairo", system-ui, sans-serif);
}

.custom-builder-container {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 16px 110px;
    box-sizing: border-box;
    position: relative;
}

/* 1. Builder Top Header */
.builder-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.builder-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 15px;
}
.builder-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}
.builder-close-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}
.builder-close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* 2. Hero Stack Headline */
.builder-hero {
    text-align: center;
    padding: 14px 0 8px;
}
.builder-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    color: #A7F3D0;
    background: rgba(16, 185, 129, 0.15);
    padding: 4px 12px;
    border-radius: 99px;
    border: 1px solid rgba(16, 185, 129, 0.25);
    margin-bottom: 8px;
    font-weight: 600;
}
.builder-hero-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}
.builder-hero-title span {
    color: #FCD34D;
    font-style: italic;
}
.builder-hero-sub {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

/* 3. The Stage: Burger Stack + Measurement Ruler */
.builder-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    margin: 12px 0 16px;
}

/* Decorative backdrop circle */
.stage-backdrop-ring {
    position: absolute;
    width: 290px;
    height: 290px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    pointer-events: none;
    z-index: 1;
}

/* Vertical Height Ruler (Left / Side) */
.builder-ruler-wrap {
    position: absolute;
    left: 8px;
    top: 15px;
    bottom: 15px;
    width: 50px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}
.ruler-track {
    position: relative;
    height: 100%;
    width: 100%;
    border-right: 1.5px solid rgba(255, 255, 255, 0.2);
}
.ruler-ticks {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.ruler-tick {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    font-family: monospace;
}
.tick-mark {
    width: 6px;
    height: 1px;
    background: rgba(255, 255, 255, 0.35);
}
.tick-mark.major {
    width: 12px;
    background: #FCD34D;
    height: 1.5px;
}

/* Dynamic Ruler Marker Indicator */
.ruler-marker-indicator {
    position: absolute;
    right: -2px;
    display: flex;
    align-items: center;
    transform: translateY(50%);
    transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 15;
}
.ruler-marker-pill {
    background: #F59E0B;
    color: #1A1002;
    font-weight: 800;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.ruler-marker-pointer {
    color: #F59E0B;
    font-size: 10px;
    margin-right: -2px;
}

/* Burger Stack Container */
.builder-stack-column {
    position: relative;
    z-index: 5;
    width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stack-layer-item {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.stack-layer-item:hover {
    transform: scale(1.04);
}
.stack-layer-item:active {
    transform: scale(0.96);
}
.stack-layer-item img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

/* Remove cross icon hover */
.layer-delete-hover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    opacity: 0;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.stack-layer-item:hover .layer-delete-hover {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.stack-hint-caption {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* 4. Ingredients Tray Card (Glassmorphic) */
.builder-tray-card {
    background: rgba(10, 34, 25, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 16px;
    margin-top: auto;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

/* Category Filter Tabs */
.tray-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    scrollbar-width: none;
}
.tray-tabs::-webkit-scrollbar { display: none; }
.tray-tab-btn {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.tray-tab-btn.is-active {
    background: #10B981;
    color: #FFFFFF;
    border-color: #10B981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Ingredients Grid */
.tray-items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 2px;
}
@media (max-width: 420px) {
    .tray-items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.ingredient-btn-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ingredient-btn-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}
.ingredient-btn-card:active {
    transform: scale(0.95);
}
.ingredient-btn-card.has-items {
    border-color: #10B981;
    background: rgba(16, 185, 129, 0.12);
}

.ingredient-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #F59E0B;
    color: #1A1002;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ingredient-card-thumb {
    width: 48px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.ingredient-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.ingredient-card-name {
    font-size: 11px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ingredient-card-price {
    font-size: 10px;
    font-weight: 800;
    color: #FCD34D;
}

/* 5. Floating Bottom Checkout Capsule */
.builder-bottom-island {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(7, 24, 18, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    z-index: 999999;
}
.island-price-block {
    display: flex;
    flex-direction: column;
}
.island-price-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
}
.island-price-val {
    font-size: 18px;
    font-weight: 800;
    color: #FCD34D;
}

.island-order-btn {
    background: #10B981;
    color: #FFFFFF;
    border: 0;
    padding: 12px 22px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
    transition: transform 0.15s, background 0.15s;
}
.island-order-btn:hover {
    background: #059669;
    transform: scale(1.02);
}
.island-order-btn:active {
    transform: scale(0.97);
}

/* Entry Animation */
@keyframes layerDropIn {
    0% { transform: translateY(-30px) scale(1.1); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.animate-drop-in {
    animation: layerDropIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
