/* ========================================
   DICED MEAL PACKS - Bundle Builder Styles
   ======================================== */

:root {
    --diced-primary: #1B4332;
    --diced-accent: #2D6A4F;
    --diced-green-light: #D8F3DC;
    --diced-green-pale: #F0FFF4;
    --diced-highlight: #D4A017;
    --diced-red: #C62828;
    --diced-dark: #111827;
    --diced-gray: #6B7280;
    --diced-light-gray: #F3F4F6;
    --diced-border: #E5E7EB;
    --diced-white: #FFFFFF;
    --diced-radius: 12px;
    --diced-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --diced-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

#diced-bundle-builder {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Steps */
.diced-step {
    display: none;
    margin-bottom: 40px;
}
.diced-step.diced-step-active {
    display: block;
}
.diced-step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.diced-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--diced-primary);
    color: var(--diced-white);
    border-radius: 50%;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.diced-step-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--diced-dark);
    margin: 0;
    padding: 0;
}

/* Date Grid */
.diced-date-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.diced-date-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--diced-white);
    border: 2px solid var(--diced-border);
    border-radius: var(--diced-radius);
    cursor: pointer;
    transition: all 0.2s;
}
.diced-date-btn:hover {
    border-color: var(--diced-accent);
    background: var(--diced-green-pale);
}
.diced-date-btn.selected {
    border-color: var(--diced-primary);
    background: var(--diced-green-light);
    box-shadow: var(--diced-shadow);
}
.diced-date-short {
    font-weight: 700;
    font-size: 16px;
    color: var(--diced-dark);
}
.diced-date-full {
    font-size: 13px;
    color: var(--diced-gray);
    margin-top: 4px;
}

/* Bundle Size Grid */
.diced-bundle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.diced-bundle-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--diced-white);
    border: 2px solid var(--diced-border);
    border-radius: var(--diced-radius);
    cursor: pointer;
    transition: all 0.2s;
}
.diced-bundle-btn:hover {
    border-color: var(--diced-accent);
    background: var(--diced-green-pale);
    transform: translateY(-2px);
    box-shadow: var(--diced-shadow-lg);
}
.diced-bundle-btn.selected {
    border-color: var(--diced-primary);
    background: var(--diced-green-light);
}
.diced-bundle-size {
    font-size: 36px;
    font-weight: 800;
    color: var(--diced-primary);
    line-height: 1;
}
.diced-bundle-label {
    font-size: 14px;
    color: var(--diced-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}
.diced-bundle-discount {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--diced-highlight);
    color: var(--diced-white);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

/* Specialty Bundles */
.diced-specialty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--diced-dark);
    margin: 28px 0 16px;
}
.diced-specialty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.diced-specialty-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--diced-white);
    border: 2px solid var(--diced-border);
    border-radius: var(--diced-radius);
    cursor: pointer;
    transition: all 0.2s;
}
.diced-specialty-btn:hover {
    border-color: var(--diced-accent);
    background: var(--diced-green-pale);
}
.diced-specialty-btn.selected {
    border-color: var(--diced-primary);
    background: var(--diced-green-light);
}
.diced-specialty-name {
    font-weight: 700;
    color: var(--diced-dark);
    font-size: 15px;
}
.diced-specialty-desc {
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
    margin-top: 2px;
}
.diced-specialty-btn.selected .diced-specialty-desc {
    color: rgba(255,255,255,0.8);
}
.diced-specialty-price {
    font-weight: 700;
    color: var(--diced-primary);
    font-size: 16px;
}

/* Selection Bar (Sticky) */
.diced-selection-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--diced-primary);
    color: var(--diced-white);
    border-radius: var(--diced-radius);
    margin-bottom: 20px;
    box-shadow: var(--diced-shadow-lg);
    flex-wrap: wrap;
    gap: 10px;
}
.diced-selection-count {
    font-size: 16px;
    font-weight: 600;
}
.diced-selection-total {
    font-size: 15px;
}
.diced-selection-total strong {
    font-size: 20px;
}
.diced-savings-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--diced-highlight);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

/* Filters */
.diced-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--diced-border);
}
.diced-filter-btn {
    padding: 10px 18px;
    background: var(--diced-white);
    border: 1px solid var(--diced-border);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--diced-dark);
    min-height: 42px;
    white-space: nowrap;
}
.diced-filter-btn:hover {
    background: var(--diced-green-pale);
    border-color: var(--diced-accent);
}
.diced-filter-btn.diced-filter-active {
    background: var(--diced-primary);
    color: var(--diced-white);
    border-color: var(--diced-primary);
}

/* Meals Grid */
.diced-meals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.diced-meal-card {
    position: relative;
    background: var(--diced-white);
    border: 2px solid var(--diced-border);
    border-radius: var(--diced-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.diced-meal-card:hover {
    border-color: var(--diced-accent);
    box-shadow: var(--diced-shadow);
    transform: translateY(-2px);
}
.diced-meal-card.diced-meal-selected {
    border-color: var(--diced-primary);
    background: var(--diced-green-pale);
    box-shadow: 0 0 0 2px var(--diced-primary);
}
.diced-meal-card.diced-meal-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.diced-meal-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.diced-meal-info {
    padding: 12px 14px;
}
.diced-meal-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--diced-dark);
    margin-bottom: 6px;
    line-height: 1.3;
}
.diced-meal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.diced-meal-calories {
    font-size: 13px;
    color: var(--diced-gray);
    font-weight: 500;
}
.diced-meal-price {
    font-weight: 700;
    color: var(--diced-primary);
    font-size: 15px;
}

/* Quantity badge on selected meals */
.diced-meal-qty-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--diced-primary);
    color: var(--diced-white);
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--diced-shadow);
}

/* Selected check overlay */
.diced-meal-check {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--diced-primary);
    color: var(--diced-white);
    border-radius: 50%;
    font-size: 16px;
}
.diced-meal-selected .diced-meal-check {
    display: flex;
}

/* Cart Actions */
.diced-cart-actions {
    text-align: center;
    padding: 20px 0;
}
.diced-add-to-cart-btn {
    display: inline-block;
    padding: 16px 48px;
    background: var(--diced-primary);
    color: var(--diced-white);
    border: none;
    border-radius: var(--diced-radius);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.diced-add-to-cart-btn:hover:not(:disabled) {
    background: var(--diced-accent);
    transform: translateY(-2px);
    box-shadow: var(--diced-shadow-lg);
}
.diced-add-to-cart-btn:disabled {
    background: var(--diced-gray);
    cursor: not-allowed;
    opacity: 0.6;
}
.diced-cart-hint {
    font-size: 14px;
    color: var(--diced-gray);
    margin-top: 10px;
}

/* Loading Overlay */
.diced-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--diced-white);
    font-size: 18px;
}
.diced-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--diced-white);
    border-radius: 50%;
    animation: diced-spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes diced-spin {
    to { transform: rotate(360deg); }
}

/* Success message */
.diced-success-msg {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--diced-primary);
    color: var(--diced-white);
    border-radius: var(--diced-radius);
    box-shadow: var(--diced-shadow-lg);
    font-weight: 600;
    z-index: 10000;
    animation: diced-slideIn 0.3s ease;
}
@keyframes diced-slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    #diced-bundle-builder {
        padding: 10px;
    }
    .diced-step-header h2 {
        font-size: 20px;
    }
    .diced-date-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .diced-bundle-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .diced-bundle-size {
        font-size: 28px;
    }
    .diced-specialty-grid {
        grid-template-columns: 1fr;
    }
    .diced-meals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .diced-meal-image {
        height: 130px;
    }
    .diced-meal-name {
        font-size: 13px;
    }
    .diced-selection-bar {
        flex-direction: column;
        text-align: center;
        border-radius: 0;
        margin-left: -10px;
        margin-right: -10px;
    }
    .diced-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
    }
    .diced-filter-btn {
        flex-shrink: 0;
    }
    .diced-add-to-cart-btn {
        width: 100%;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .diced-bundle-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .diced-meals-grid {
        grid-template-columns: 1fr;
    }
    .diced-date-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== VARIATION POPUP ===== */
.diced-var-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
}
.diced-var-overlay.diced-var-overlay-show { display: block; }

.diced-var-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 100001;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'Outfit', -apple-system, sans-serif;
}
.diced-var-popup.diced-var-open { display: block; }

.diced-var-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #E5E7EB;
    background: #1B4332;
    border-radius: 16px 16px 0 0;
}
.diced-var-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
}
.diced-var-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.diced-var-body {
    padding: 24px;
}
.diced-var-field {
    margin-bottom: 16px;
}
.diced-var-field:last-child {
    margin-bottom: 0;
}
.diced-var-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #1B4332;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.diced-var-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Outfit', sans-serif;
    color: #374151;
    background: #ffffff;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    min-height: 50px;
    line-height: 1.4;
    box-sizing: border-box;
}
.diced-var-select:focus {
    border-color: #1B4332;
    outline: none;
    box-shadow: 0 0 0 3px rgba(27,67,50,0.1);
}

.diced-var-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 2px solid #E5E7EB;
    background: #F8F9FA;
    border-radius: 0 0 16px 16px;
}
.diced-var-price {
    font-size: 22px;
    font-weight: 900;
    color: #1B4332;
}
.diced-var-confirm {
    padding: 12px 28px;
    background: #D4A017;
    color: #0d2818;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}
.diced-var-confirm:hover:not(:disabled) {
    background: #e8b520;
    transform: translateY(-1px);
}
.diced-var-confirm:disabled {
    background: #9CA3AF;
    cursor: default;
    color: #ffffff;
}

/* Variation tags on meal cards */
.diced-meal-var-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0;
}
.diced-meal-var-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #D8F3DC;
    color: #1B4332;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .diced-var-popup { width: 95vw; }
    .diced-var-footer { flex-direction: column; gap: 10px; }
    .diced-var-confirm { width: 100%; }
}

/* Completion popup animation */
@keyframes dicedPopIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
