/* --- Cart & Orders Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Modal box ── */
.modal-content {
    background: white;
    border-radius: 12px;
    width: 92%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    animation: slideUp 0.25s ease;
    overflow: hidden;
}

/* ── Header — compact ── */
.modal-header {
    background: #4CAF50;
    color: white;
    padding: 0.8rem 1.2rem;
    /* ← was 1.5rem */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    /* ← was 1.5rem */
    text-align: left;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.6rem;
    /* ← was 2rem */
    cursor: pointer;
    transition: transform 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    transform: rotate(90deg);
}

/* ── Body — scrolls, takes all available space ── */
.modal-body {
    flex: 1;
    padding: 0.8rem 1rem;
    /* ← was 1.5rem */
    overflow-y: auto;
    min-height: 0;
}

/* ── Cart items list: grows to fill space ── */
.cart-items-list,
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    /* ← was 1rem */
}

/* ── Single cart item: smaller padding ── */
.cart-item,
.order-item {
    padding: 0.65rem 0.9rem;
    /* ← was 1rem */
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    font-size: 0.93rem;
    /* ← was 1rem */
}

.cart-item-price {
    color: #4CAF50;
    font-weight: 700;
    font-size: 0.93rem;
    /* ← was 1.1rem */
}

/* ── Cart item quantity controls ── */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border: 1.5px solid #4CAF50;
    background: #fff;
    color: #4CAF50;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.qty-btn:hover {
    background: #4CAF50;
    color: #fff;
}

.remove-btn {
    padding: 0.3rem 0.7rem;
    background: #fdecea;
    color: #e74c3c;
    border: 1.5px solid #ffc8c8;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.remove-btn:hover {
    background: #e74c3c;
    color: #fff;
}

/* ── Footer — compact ── */
.modal-footer {
    border-top: 1px solid #eee;
    padding: 0.75rem 1rem;
    /* ← was 1.5rem */
    background: #f9f9f9;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

/* ── Summary rows ── */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.18rem 0;
    /* ← was 0.5rem */
    font-size: 0.87rem;
    color: #555;
}

.summary-row.total {
    font-size: 1rem;
    /* ← was 1.3rem */
    font-weight: 700;
    color: #4CAF50;
    border-top: 2px solid #eee;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
}

/* ── Action buttons — smaller ── */
.modal-buttons {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.7rem;
    /* ← was 1rem */
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 0.6rem 0.5rem;
    /* ← was 1rem */
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    /* ← was 1rem */
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.35);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.btn-secondary:hover {
    background: #f1f8e9;
}

/* ── Orders ── */
.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.order-id {
    font-weight: 700;
    color: #333;
}

.order-date {
    color: #999;
    font-size: 0.85rem;
}

.order-total {
    font-weight: 700;
    color: #4CAF50;
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

.empty-cart,
.no-orders {
    text-align: center;
    color: #999;
    padding: 2rem 1rem;
    font-size: 1rem;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .modal-content {
        width: 97%;
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0 auto;
    }

    .modal-buttons {
        flex-direction: row;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.82rem;
        padding: 0.55rem 0.4rem;
    }
}