@import url('partials.css');

/* ========================
   TAMPILAN DASAR KERANJANG
   ======================== */
:root {
    --maroon-grad-1: #781625;
    --maroon-grad-2: #470b14;
    --maroon-dark: #32060d;
    --text-light: #ffffff;
    --text-muted-light: #e6d5d8;
    --primary-redd: #781625;
}

.keranjang-main {
    padding: 60px 0 120px 0;
}

.container-keranjang {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a2530;
    margin-bottom: 40px;
    text-align: left;
    position: relative;
    padding-bottom: 10px;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-redd, #741111);
    border-radius: 2px;
}

.keranjang-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ====================
   BAGIAN KIRI (PRODUK)
   ==================== */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item-card {
    display: flex;
    padding: 14px 18px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #eaeaea;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

.item-img-placeholder {
    width: 85px;
    aspect-ratio: 1 / 1;
    background-color: var(--placeholder-bg, #f5f5f5);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.item-img-placeholder i {
    font-size: 26px;
    color: var(--icon-gray, #aaa);
    display: inline-block !important;
}

.item-details {
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    padding-right: 50px;
}

.item-name {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
    line-height: 1.3;
}

.item-meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    line-height: 1.3;
}

.meta-val {
    font-weight: 500;
    color: #334155;
}

.color-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #ccc;
    vertical-align: middle;
    margin-left: 4px;
}

.item-price {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.price-original-strike {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.85em;
    margin-right: 4px;
}

.price-current {
    color: var(--maroon-grad-1);
    font-weight: 700;
    font-size: 1.05em;
}

.grosir-badge {
    background-color: #27ae60;
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 4px;
    display: inline-block;
}

.qty-controls-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    width: fit-content;
}

.btn-qty-sm {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-qty-sm:hover {
    background: var(--maroon-grad-1);
    color: #ffffff;
    border-color: var(--maroon-grad-1);
}

.item-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background-color: #f1f5f9;
    color: #ef4444;
}

/* ========================
   BAGIAN KANAN (RINGKASAN)
   ======================== */
.cart-summary-sidebar {
    position: sticky;
    top: 30px;
}

.summary-card {
    background: linear-gradient(135deg, var(--maroon-grad-1) 0%, var(--maroon-grad-2) 100%);
    border-radius: 20px;
    padding: 35px;
    color: var(--text-light);
    box-shadow: 0 15px 35px rgba(50, 8, 14, 0.45);
    border: 1px solid var(--maroon-dark);
}

.summary-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 14px;
    color: var(--text-muted-light);
}

.summary-row .price-val {
    font-weight: 600;
    color: var(--text-light);
}

.summary-row.saving-row {
    color: #4ade80;
    font-weight: 600;
}

.summary-row.saving-row .price-val {
    color: #4ade80;
}

.summary-row.total-row {
    margin-top: 15px;
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
}

.summary-row.total-row .price-val {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
}

.summary-info-text {
    font-size: 12px;
    color: var(--text-muted-light);
    margin-top: 15px;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    border-radius: 10px;
}

.summary-info-text strong {
    color: #ffffff;
}

.btn-checkout {
    width: 100%;
    background-color: #ffffff;
    color: var(--maroon-grad-2);
    border: none;
    height: 50px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-checkout:hover {
    background-color: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

.btn-checkout:active {
    transform: translateY(0);
}

/* ================
   KERANJANG KOSONG
   ================ */
.empty-cart-simple {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-simple i {
    font-size: 64px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.empty-cart-simple h2 {
    font-size: 22px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.empty-cart-simple p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 24px;
}

.empty-cart-simple .fas {
    color: #741111;
}

.empty-cart-simple .btn-start-shopping {
    display: inline-block;
    padding: 12px 28px;
    background-color: #741111;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.empty-cart-simple .btn-start-shopping:hover {
    background-color: #580c0c;
    transform: translateY(-2px);
}

/* =================
   MODAL EDIT VARIAN
   ================= */
.cart-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.cart-modal.active { 
    display: flex; 
}

.cart-modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 20px;
    width: 90%; 
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.cart-modal-close {
    position: absolute; 
    right: 20px; 
    top: 20px;
    font-size: 22px; 
    cursor: pointer; 
    color: #94a3b8;
    transition: color 0.2s;
}

.cart-modal-close:hover {
    color: #1e293b;
}

.modal-option-title { 
    font-weight: 600; 
    margin: 14px 0 8px 0; 
    font-size: 14px; 
    color: #334155;
}

.variant-select-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-bottom: 14px; 
}

.btn-option { 
    padding: 8px 16px; 
    border: 1px solid #cbd5e1; 
    border-radius: 8px; 
    background: #ffffff; 
    cursor: pointer; 
    font-size: 13px; 
    color: #334155;
    transition: all 0.2s ease;
}

.btn-option.selected { 
    border-color: var(--maroon-grad-1); 
    background-color: var(--maroon-grad-1); 
    color: #ffffff; 
    font-weight: 600;
}

.btn-save-modal { 
    width: 100%; 
    padding: 12px; 
    background: linear-gradient(135deg, var(--maroon-grad-1) 0%, var(--maroon-grad-2) 100%);
    color: #ffffff; 
    border: none; 
    border-radius: 10px; 
    font-weight: 600; 
    font-size: 14px;
    cursor: pointer; 
    margin-top: 18px; 
    box-shadow: 0 4px 12px rgba(120, 22, 37, 0.3);
    transition: all 0.2s ease;
}

.btn-save-modal:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* ==========================================================================
   MODAL HAPUS & POP-UP
   ========================================================================== */

.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px 28px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.85);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-overlay.active .custom-modal-box {
    transform: scale(1);
}

.custom-modal-icon {
    font-size: 42px;
    margin-bottom: 15px;
    color: #741111
}

.custom-modal-icon.warning {
    color: #e67e22;
}

.custom-modal-icon.danger {
    color: #e74c3c;
}

.custom-modal-icon.info {
    color: #3498db;
}

.custom-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.custom-modal-message {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    margin-bottom: 22px;
}

.custom-modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-modal {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background-color: #f1f2f6;
    color: #57606f;
}

.btn-modal-cancel:hover {
    background-color: #dfe4ea;
}

.btn-modal-confirm {
    background-color: #741111;
    color: #ffffff;
}

.btn-modal-confirm:hover {
    background-color: #550c0c;
}

.btn-modal-primary {
    background-color: #741111;
    color: #ffffff;
    width: 100%;
}

.btn-modal-primary:hover {
    background-color: #550c0c;
}

.checkout-summary-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: left;
}

.checkout-summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
}

.checkout-summary-item:last-child {
    margin-bottom: 0;
}

.checkout-summary-item.total {
    border-top: 1px dashed #ced4da;
    padding-top: 8px;
    font-weight: 700;
    color: #741111;
    font-size: 15px;
}

/* =========================
   RESPONSIF MOBILE & TABLET
   ========================= */
@media (max-width: 992px) {
    .keranjang-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .summary-card {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .keranjang-main {
        padding: 30px 0 80px 0;
    }

    .page-title {
        font-size: 26px;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    .cart-item-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .item-details {
        margin-left: 0;
        margin-top: 15px;
        padding-right: 0;
        width: 100%;
    }

    .item-actions {
        top: 20px;
        right: 15px;
    }
}