/* Summary Modal — order totals / discount / loyalty (after notes step) */
.summary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.summary-modal.active {
    display: flex;
    padding: max(0.5rem, env(safe-area-inset-top, 0px))
        max(0.75rem, env(safe-area-inset-right, 0px))
        max(0.5rem, env(safe-area-inset-bottom, 0px))
        max(0.75rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.summary-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.summary-modal-content {
    position: relative;
    background-color: var(--black);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem));
    overflow: hidden;
    overflow-x: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    box-sizing: border-box;
    animation: modalSlideIn 0.3s ease-out;
    min-height: 0;
}

.summary-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    flex-shrink: 0;
}

.summary-modal-header h2 {
    font-family: 'Funnel Display', sans-serif;
    font-size: 1.75rem;
    color: var(--yellow);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.summary-modal-header h2 i {
    color: var(--yellow);
}

.summary-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s ease;
    line-height: 1;
}

.summary-modal-close:hover {
    color: var(--white);
}

.summary-modal-body {
    padding: 1.5rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.summary-modal .checkout-summary {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.summary-modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
    box-sizing: border-box;
    width: 100%;
    flex-shrink: 0;
}

.summary-cancel-btn,
.summary-confirm-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Funnel Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
    min-width: 0;
}

.summary-cancel-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-cancel-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.summary-confirm-btn {
    background-color: var(--yellow);
    color: var(--black);
}

.summary-confirm-btn:hover {
    background-color: #ffed4e;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}

@media (max-width: 768px) {
    .summary-modal-content {
        width: 95%;
        max-width: 95vw;
        margin: 0 auto;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .summary-modal-header,
    .summary-modal-body {
        padding: 1.25rem 1rem;
    }

    .summary-modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .summary-modal-header h2 {
        font-size: 1.5rem;
    }

    .summary-cancel-btn,
    .summary-confirm-btn {
        flex: none;
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .summary-modal.active {
        padding-left: 0;
        padding-right: 0;
        align-items: stretch;
        justify-content: stretch;
        flex-direction: column;
    }

    .summary-modal-content {
        width: 100%;
        max-width: none;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }

    .summary-modal-header,
    .summary-modal-body {
        padding: 1rem 0.75rem;
    }

    .summary-modal-footer {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .summary-modal-header h2 {
        font-size: 1.25rem;
    }

    .summary-cancel-btn,
    .summary-confirm-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}
