/* ==========================================
        NAVBAR: CART TRIGGER BUTTON
========================================== */

.nav-cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8efe3;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-cart-btn:hover {
    background: var(--secondary);
    color: #fff;
}

.nav-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--secondary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.nav-cart-btn:hover .nav-cart-count {
    background: #fff;
    color: var(--secondary);
}

.nav-cart-count.is-hidden {
    display: none;
}

/* ==========================================
        MODAL BASE (shared by cart + checkout)
========================================== */

.rt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 27, 27, .65);
    backdrop-filter: blur(5px);

    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;

    z-index: 10500;

    animation: rtFadeIn .25s ease;
}

.rt-modal-overlay.is-open {
    display: flex;
}

@keyframes rtFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rtPopup {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}

.rt-modal-card {
    background: var(--surface);
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .2);

    position: relative;
    max-height: 88vh;
    display: flex;
    flex-direction: column;

    animation: rtPopup .3s ease;
}

.rt-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 1;
}

.rt-modal-close:hover {
    color: var(--primary);
}

.rt-modal-header {
    padding: 24px 28px 12px;
    border-bottom: 1px solid var(--border);
}

.rt-modal-header h2 {
    font-size: 20px;
    color: var(--primary);
    margin: 0;
}

.rt-modal-body {
    padding: 20px 28px;
    overflow-y: auto;
    flex: 1;
}

.rt-modal-footer {
    padding: 18px 28px 24px;
    border-top: 1px solid var(--border);
}

/* ==========================================
        CART MODAL
========================================== */

.cart-modal-card {
    max-width: 480px;
}

.cart-modal-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.cart-modal-item img,
.cart-modal-item .no-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    background: var(--background);
    flex-shrink: 0;
}

.cart-modal-item .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.cart-modal-details {
    flex: 1;
    min-width: 0;
}

.cart-modal-details h4 {
    margin: 0 0 4px;
    font-size: 15px;
    color: var(--text);
}

.cart-modal-options,
.cart-modal-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.cart-modal-price {
    font-size: 13px;
    color: var(--secondary);
    font-weight: 600;
}

.cart-modal-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.cart-modal-controls button {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: var(--text);
}

.cart-modal-controls button:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.cart-modal-controls .cart-modal-remove {
    margin-left: auto;
    width: auto;
    border-radius: 20px;
    padding: 0 10px;
    height: 26px;
    font-size: 12px;
    color: #b92d3a;
    border-color: var(--border);
}

.cart-modal-controls .cart-modal-remove:hover {
    background: #b92d3a;
    color: #fff;
    border-color: #b92d3a;
}

.cart-modal-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
}

.cart-modal-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 14px;
}

.cart-modal-actions {
    display: flex;
    gap: 10px;
}

.cart-modal-actions .btn-primary,
.cart-modal-actions .btn-secondary {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.cart-modal-actions .btn-primary {
    background: linear-gradient(135deg, var(--secondary), #b88643);
    color: #fff;
}

.cart-modal-actions .btn-primary:hover {
    filter: brightness(1.05);
}

.cart-modal-actions .btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.cart-modal-actions .btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.cart-modal-actions .btn-secondary:hover {
    border-color: #b92d3a;
    color: #b92d3a;
}

/* ==========================================
        CHECKOUT MODAL
========================================== */

.checkout-modal-card {
    max-width: 560px;
}

.checkout-modal-review {
    background: var(--background);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    max-height: 160px;
    overflow-y: auto;
}

.checkout-modal-review-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.checkout-modal-review-item:last-child {
    border-bottom: none;
}

.checkout-modal-review-item .item-name {
    color: var(--text);
}

.checkout-modal-review-item .item-options {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
}

.checkout-modal-totals {
    margin-bottom: 20px;
}

.checkout-modal-totals .totals-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
    color: var(--text-muted);
}

.checkout-modal-totals .totals-grand {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 10px;
}

.checkout-modal-form h3 {
    font-size: 15px;
    color: var(--primary);
    margin: 0 0 12px;
}

.checkout-modal-form .input-group {
    margin-bottom: 14px;
}

.checkout-modal-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.checkout-modal-form input,
.checkout-modal-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.checkout-modal-form textarea {
    min-height: 60px;
    resize: vertical;
}

.checkout-modal-payment {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}

.checkout-modal-payment label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.checkout-modal-payment input {
    width: auto;
    accent-color: var(--secondary);
}

.checkout-modal-submit {
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--secondary), #b88643);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 6px;
}

.checkout-modal-submit:hover {
    filter: brightness(1.05);
}

.checkout-modal-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.rt-modal-alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.rt-modal-alert.error {
    background: #fdecea;
    color: #b92d3a;
    border: 1px solid #f3c1c1;
}

.rt-modal-alert.success {
    background: #eaf5e9;
    color: var(--success);
    border: 1px solid #c8e2c5;
}

.rt-modal-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
}

@media (max-width: 600px) {
    .rt-modal-header,
    .rt-modal-body,
    .rt-modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
}
