/**
 * Ruang Dunu - Cart Styles
 * Separate CSS to avoid modifying existing style.css
 * Uses existing CSS variables from :root
 */

/* ===== CART ICON (NAVBAR) ===== */
.rd-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: var(--transition);
    color: var(--bg-white);
    background: none;
    border: none;
    outline: none;
}

.rd-cart-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

.rd-cart-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.header.scrolled .rd-cart-icon {
    color: var(--text-main);
}

.header.scrolled .rd-cart-icon:hover {
    background: rgba(14, 95, 100, 0.08);
}

.header.transparent-override .rd-cart-icon {
    color: var(--bg-white) !important;
}

/* Badge */
.rd-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    font-family: var(--font-heading);
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    text-align: center;
    border-radius: 50px;
    padding: 0 4px;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.rd-cart-badge--visible {
    transform: scale(1);
}


/* ===== TOAST NOTIFICATION ===== */
.rd-toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.rd-toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    white-space: nowrap;
    max-width: 90vw;
}

.rd-toast--success {
    background: rgba(14, 95, 100, 0.92);
}

.rd-toast--info {
    background: rgba(60, 60, 68, 0.92);
}

.rd-toast--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.rd-toast--exit {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
}

.rd-toast__icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.rd-toast__message {
    line-height: 1.3;
}


/* ===== CART MODAL ===== */
.rd-cart-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rd-cart-modal.show {
    opacity: 1;
}

.rd-cart-modal__content {
    background: var(--bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(30px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.rd-cart-modal.show .rd-cart-modal__content {
    transform: translateY(0) scale(1);
}

/* Modal Header */
.rd-cart-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.rd-cart-modal__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    line-height: 1;
}

.rd-cart-modal__title svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.rd-cart-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

.rd-cart-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

/* Modal Body */
.rd-cart-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.rd-cart-modal__body::-webkit-scrollbar {
    width: 4px;
}
.rd-cart-modal__body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
}

/* Empty State */
.rd-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    gap: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.rd-cart-empty__icon {
    font-size: 3rem;
    opacity: 0.4;
    line-height: 1;
}

.rd-cart-empty__text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Cart Items */
.rd-cart-items {
    display: flex;
    flex-direction: column;
}

.rd-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
    position: relative;
}

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

.rd-cart-item:hover {
    background: rgba(14, 95, 100, 0.02);
}

.rd-cart-item__img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-light);
}

.rd-cart-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rd-cart-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.rd-cart-item__name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rd-cart-item__varian {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1;
}

.rd-cart-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.4rem;
    gap: 0.5rem;
}

.rd-cart-item__subtotal {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

/* Qty Controls */
.rd-cart-item__qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.rd-qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: none;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.rd-qty-btn:hover {
    background: var(--secondary);
    color: var(--bg-white);
}

.rd-qty-btn:active {
    transform: scale(0.92);
}

.rd-qty-value {
    width: 30px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 28px;
    background: var(--bg-white);
}

/* Delete Button */
.rd-cart-item__delete {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 0;
    opacity: 0.5;
}

.rd-cart-item__delete:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    opacity: 1;
}

.rd-cart-item__delete svg {
    display: block;
}

/* Modal Footer */
.rd-cart-modal__footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.5rem;
    background: var(--bg-light);
    border-radius: 0 0 16px 16px;
}

.rd-cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.rd-cart-total-label {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.rd-cart-total-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.rd-cart-actions {
    display: flex;
    gap: 0.75rem;
}

.rd-cart-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.rd-cart-btn--cancel {
    background: var(--bg-white);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.rd-cart-btn--cancel:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
}

.rd-cart-btn--checkout {
    background: #25D366;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.rd-cart-btn--checkout:hover {
    background: #20b858;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.rd-cart-btn--checkout:active {
    transform: translateY(0);
}

.rd-cart-btn svg {
    width: 16px;
    height: 16px;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    .rd-cart-modal__content {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        transform: translateY(100%);
    }

    .rd-cart-modal.show .rd-cart-modal__content {
        transform: translateY(0);
    }

    .rd-cart-modal {
        align-items: flex-end;
        padding: 0;
    }

    .rd-cart-item {
        padding: 0.85rem 1rem;
    }

    .rd-cart-item__img {
        width: 50px;
        height: 50px;
    }

    .rd-cart-modal__header {
        padding: 1rem 1.25rem;
    }

    .rd-cart-modal__footer {
        padding: 1rem 1.25rem;
    }

    .rd-cart-item__name {
        font-size: 0.8rem;
    }

    .rd-cart-item__subtotal {
        font-size: 0.78rem;
    }
    
    .rd-cart-btn {
        padding: 0.7rem 0.75rem;
        font-size: 0.8rem;
    }

    .rd-toast-container {
        bottom: 1rem;
        width: 90%;
    }

    .rd-toast {
        font-size: 0.8rem;
        padding: 0.65rem 1rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .rd-cart-modal__content {
        max-width: 460px;
    }
}
