* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: #FAFAFA; color: #111; }

/* Header */
.account-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 50px; background: #fff; border-bottom: 1px solid #EFEFEF; }
.account-header a.back-link { color: #888; text-decoration: none; font-size: 13px; font-weight: 500; transition: color 0.3s; }
.account-header a.back-link:hover { color: #111; }
.account-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.account-header h2 span { color: #D4A373; font-weight: 400; }
.user-badge { background: #F4F4F4; color: #333; padding: 8px 16px; border-radius: 50px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }

/* Container & Sidebar */
.account-container { display: flex; max-width: 1200px; margin: 50px auto; gap: 40px; padding: 0 20px; align-items: flex-start; }
.account-sidebar { width: 280px; background: #fff; border-radius: 12px; padding: 40px 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.03); }
.profile-summary { text-align: center; margin-bottom: 40px; }
.profile-summary img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 1px solid #EAE7DF; padding: 4px; margin-bottom: 16px; }
.profile-summary h3 { font-size: 16px; color: #111; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }

/* Navigasi Tab (Elegan) */
.account-nav { list-style: none; margin-bottom: 40px; }
.account-nav li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 8px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: #888; transition: all 0.3s ease; }
.account-nav li svg { opacity: 0.6; }
.account-nav li:hover { background: #F9F9F9; color: #111; }
.account-nav li.active { background: #F4F7F6; color: #4A5D4E; font-weight: 600; }
.account-nav li.active svg { opacity: 1; }

/* Tombol Logout */
.logout-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px; border: 1px solid #FFEBEE; background: #fff; color: #C62828; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.logout-btn:hover { background: #FFEBEE; }

/* Area Konten Utama */
.account-content { flex: 1; background: #fff; border-radius: 12px; padding: 50px; box-shadow: 0 10px 40px rgba(0,0,0,0.03); min-height: 600px; }
.tab-section { display: none; animation: fadeIn 0.4s ease; }
.tab-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid #F0F0F0; }
.section-header h2 { font-size: 24px; color: #111; margin-bottom: 8px; font-weight: 600; letter-spacing: -0.5px; }
.section-header p { color: #888; font-size: 14px; }

/* Form Profil */
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 10px; }
.form-group input, .form-group textarea { width: 100%; padding: 15px 18px; border: 1px solid #EAE7DF; border-radius: 8px; font-family: inherit; font-size: 14px; outline: none; background: #FAFAFA; transition: 0.3s; }
.form-group input:focus, .form-group textarea:focus { border-color: #4A5D4E; background: #fff; }
.btn-primary { background: #4A5D4E; color: #fff; padding: 16px 28px; border: none; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; transition: 0.3s; letter-spacing: 0.5px; }
.btn-primary:hover { background: #38473B; box-shadow: 0 6px 20px rgba(74, 93, 78, 0.2); }

/* Voucher */
.claim-box { display: flex; gap: 12px; }
.claim-box input { flex: 1; padding: 15px 18px; border: 1px solid #EAE7DF; border-radius: 8px; text-transform: uppercase; font-size: 14px; letter-spacing: 1px; }
.btn-secondary { background: #111; color: #fff; padding: 0 28px; border: none; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; transition: 0.3s; }
.btn-secondary:hover { background: #D4A373; color: #fff; }
.voucher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 24px; }
.voucher-card { background: #fff; border: 1px solid #EAE7DF; border-radius: 12px; padding: 24px; position: relative; box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.voucher-card h4 { font-size: 24px; color: #111; margin-bottom: 8px; font-weight: 600; }
.voucher-card.used { opacity: 0.5; background: #FAFAFA; }

/* Meja Checkout (Premium Layout) */
.checkout-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px; }

/* Desain Item Keranjang */
.co-item { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; border-bottom: 1px solid #F0F0F0; }
.co-item-main { display: flex; gap: 20px; align-items: center; }
.co-item-main img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: #F4F4F4; }
.co-item-info { display: flex; flex-direction: column; gap: 6px; }
.co-item-name { font-size: 15px; font-weight: 600; color: #111; }
.co-item-qty { font-size: 13px; color: #888; }
.co-item-action { text-align: right; }
.co-item-subtotal { font-size: 15px; font-weight: 600; color: #111; margin-bottom: 8px; }

/* Tombol Hapus Elegan */
.co-remove-btn { background: none; border: none; color: #BC6C6C; font-size: 12px; font-weight: 500; text-decoration: underline; cursor: pointer; opacity: 0.7; transition: opacity 0.2s; }
.co-remove-btn:hover { opacity: 1; }

/* Kotak Ringkasan */
.checkout-summary { background: #FAFAFA; padding: 30px; border-radius: 12px; height: fit-content; border: 1px solid #F0F0F0; }
.checkout-summary h3 { font-size: 16px; margin-bottom: 24px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #111; }
.summary-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 14px; color: #555; }
.summary-row select { padding: 8px 12px; border: 1px solid #DCE0D9; border-radius: 6px; outline: none; background: #fff; color: #111; font-family: inherit; font-size: 13px; cursor: pointer; }
.summary-divider { height: 1px; background: #EAE7DF; margin: 20px 0; }
.total-row { font-size: 20px; font-weight: 700; color: #111; align-items: flex-end; }

/* Riwayat Pesanan */
.order-card { background: #fff; border: 1px solid #EAE7DF; border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.order-header { display: flex; justify-content: space-between; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px dashed #EAE7DF; }
.order-id { font-weight: 600; color: #111; font-size: 15px; }
.order-date { font-size: 12px; color: #888; }
.order-items { font-size: 14px; color: #555; line-height: 1.6; margin-bottom: 16px; }
.order-footer { display: flex; justify-content: space-between; align-items: center; }
.order-total { font-weight: 700; font-size: 16px; color: #111; }
.order-status { background: #F4F7F6; color: #4A5D4E; padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Responsive */
@media (max-width: 900px) {
    .account-container { flex-direction: column; margin: 20px auto; gap: 20px; }
    .account-sidebar, .account-content { width: 100%; padding: 30px 20px; }
    .checkout-grid { grid-template-columns: 1fr; }
}

/* --- Tambahan Desain Kartu Riwayat Pesanan --- */
.order-shipping-info {
    background-color: #F9F9F9;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #555;
    border-left: 3px solid #D4A373;
}

.order-shipping-info span {
    font-weight: 600;
    color: #111;
}

.order-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-track {
    background-color: #4A5D4E;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.3s;
}

.btn-track:hover {
    background-color: #38473B;
}

.btn-invoice {
    background-color: transparent;
    color: #111;
    border: 1px solid #DCE0D9;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-invoice:hover {
    background-color: #F4F4F4;
    border-color: #ccc;
}

/* Status warna khusus jika sudah selesai/dikirim */
.order-status.status-success {
    background-color: #4A5D4E;
    color: #fff;
}

/* =========================================
   6. RESPONSIVITAS LAYAR KECIL (MOBILE ELEGANCE)
   ========================================= */
@media (max-width: 900px) {
    /* Merubah arah susunan: Ringkasan di atas, Form di bawah */
    .checkout-container { 
        flex-direction: column-reverse; 
        gap: 30px; 
        margin: 20px auto 60px auto; 
    }
    
    .checkout-summary-area, .checkout-form-area { 
        width: 100%; 
    }
    
    /* Header lebih tipis di HP */
    .checkout-header { 
        padding: 16px 20px; 
    }
    .checkout-header h2 {
        font-size: 18px;
    }
    
    /* Styling ulang kotak Ringkasan (Summary) agar lebih rapi di HP */
    .checkout-summary-area { 
        position: static; 
        padding: 24px 20px; 
        border-radius: 10px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.05);
        border: 1px solid #EAE7DF;
    }
    
    /* Atur ulang ukuran gambar produk di HP */
    .summary-item img {
        width: 70px;
        height: 70px;
    }
    
    .checkout-title {
        font-size: 24px;
        line-height: 1.3;
    }

    /* Memperbaiki jarak kotak metode pembayaran */
    .payment-method-box {
        padding: 20px 16px;
    }

    /* Membuat ikon pembayaran membungkus (wrap) dengan baik jika layar sangat sempit */
    .payment-icons {
        gap: 8px;
        justify-content: flex-start;
    }
    
    /* Menyesuaikan kotak info customer */
    .customer-info-box {
        padding: 16px;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 16px;
    }
    .info-row .label {
        font-size: 11px;
    }
    .info-row .value {
        font-size: 14px;
    }
}

/* =========================================
   7. EXTRA SMALL DEVICES (IPHONE SE, DLL)
   ========================================= */
@media (max-width: 400px) {
    .secure-badge {
        display: none; /* Sembunyikan badge secure di layar sangat sempit agar tidak menabrak judul */
    }
    
    .btn-pay {
        font-size: 12px;
        padding: 16px;
    }
}

/* =========================================
   RESPONSIVITAS MOBILE (ACCOUNT DASHBOARD)
   ========================================= */
@media (max-width: 900px) {
    /* 1. Header Lebih Rapi di Tengah */
    .account-header { 
        padding: 16px 20px; 
        flex-direction: column; 
        gap: 12px; 
        text-align: center; 
    }

    /* 2. Susunan Kotak Utama */
    .account-container { 
        flex-direction: column; 
        margin: 20px auto 60px; 
        gap: 20px; 
        padding: 0 16px; 
    }
    
    .account-sidebar, .account-content { 
        width: 100%; 
        padding: 24px 20px; 
    }

    .account-content { 
        min-height: auto; 
    }

    /* 3. Perbaikan Profil (Menyamping, tidak memakan tempat) */
    .profile-summary {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 16px;
        margin-bottom: 24px;
        border-bottom: 1px solid #EAE7DF;
        padding-bottom: 20px;
    }
    .profile-summary img {
        width: 60px;
        height: 60px;
        margin-bottom: 0;
    }
    .profile-summary h3 {
        font-size: 15px;
    }

    /* 🔥 4. SULAP NAVIGASI JADI HORIZONTAL SCROLL (SWIPE) 🔥 */
    .account-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        margin-bottom: 24px;
        padding-bottom: 10px; /* Ruang untuk efek bayangan/scroll */
        
        /* Menyembunyikan scrollbar agar terlihat seperti aplikasi native */
        -ms-overflow-style: none;  
        scrollbar-width: none;  
    }
    .account-nav::-webkit-scrollbar { 
        display: none; 
    }
    
    .account-nav li {
        flex: 0 0 auto; /* Mencegah tombol menyusut/gepeng */
        margin-bottom: 0;
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap; /* Teks tidak turun ke baris baru */
    }

    /* 5. Perbaikan Grid Lainnya di Dalam Tab */
    .checkout-grid { 
        grid-template-columns: 1fr; 
    }
    .voucher-grid { 
        grid-template-columns: 1fr; 
    }
    
    /* 6. Perbaikan Item Keranjang di Tab Checkout */
    .co-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .co-item-action {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    .co-item-subtotal {
        margin-bottom: 0;
    }
}


/* =========================================
   🔥 PERBAIKAN RESPONSIVITAS MOBILE TOTAL 🔥
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Paksa Semua Form Grid (Provinsi, Kota, dll) Turun Jadi 1 Kolom */
    .form-group[style*="grid"] {
        grid-template-columns: 1fr !important; /* Paksa 1 kolom */
        gap: 12px !important;
    }

    /* 2. Tombol Simpan & Batal Alamat Jadi Atas-Bawah */
    #new-address-form > div[style*="display: flex; gap: 12px; margin-top: 20px;"] {
        flex-direction: column;
    }
    #new-address-form button {
        width: 100%;
    }

    /* 3. Daftar Alamat Tersimpan ala Shopee */
    #saved-address-list > div > div:first-child {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    
    #saved-address-list > div > div:last-child {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    #saved-address-list button {
        flex: 1; /* Tombol Jadikan Utama & Hapus membagi rata ruang */
        padding: 10px 0;
        text-align: center;
        border: 1px solid #DCE0D9 !important;
    }

    /* 4. Tab Riwayat Pesanan (History) */
    .order-card > div:first-child {
        flex-direction: column;
        gap: 8px;
    }
    .order-card > div:first-child > div:last-child {
        text-align: left !important;
    }
    
    /* Tombol-tombol aksi di riwayat pesanan dideretkan ke bawah */
    .order-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .order-actions button, .order-actions a {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 12px !important; /* Perbesar area klik untuk jempol */
    }
    .order-status {
        text-align: center;
        width: 100%;
        display: block;
        box-sizing: border-box;
    }

    /* 5. Kotak Klaim Voucher */
    .claim-box {
        flex-direction: column;
        gap: 12px;
    }
    .claim-box input {
        width: 100%;
        box-sizing: border-box;
    }
    .claim-box button {
        width: 100%;
        padding: 14px;
    }

    /* 6. Meja Checkout (Pastikan ringkasan turun ke bawah keranjang) */
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }
    
    .co-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .co-item-action {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
    }
    
    .co-item-subtotal {
        margin-bottom: 0 !important;
    }
}

/* =========================================
   PERBAIKAN MEJA CHECKOUT (ACCOUNT PAGE)
   ========================================= */

/* Pastikan semua elemen menghitung padding ke dalam lebar 100% */
.tab-section * {
    box-sizing: border-box;
}

/* Pembungkus Utama Meja Checkout */
.checkout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    margin-top: 20px;
}

/* Memisahkan Kiri (Keranjang) dan Kanan (Ringkasan) di Layar Besar */
@media (min-width: 768px) {
    .checkout-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }
    .checkout-wrapper .checkout-left {
        flex: 1.5; /* Proporsi lebih besar untuk daftar barang */
    }
    .checkout-wrapper .checkout-right {
        flex: 1; /* Proporsi lebih kecil untuk ringkasan */
        position: sticky;
        top: 20px;
    }
}

/* -----------------------------------------
   KOTAK KERANJANG KOSONG (Fix Overflow)
   ----------------------------------------- */
.checkout-empty-state {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 40px 20px;
    text-align: center;
    background: #FAFAFA;
    border-radius: 12px;
    border: 1px dashed #DCE0D9;
    overflow: hidden; /* Mencegah tumpah */
}

/* -----------------------------------------
   KOTAK RINGKASAN BELANJA
   ----------------------------------------- */
.summary-box {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #FAFAFA;
    border: 1px solid #EAE7DF;
    border-radius: 12px;
    padding: 24px;
    overflow: hidden;
}

.summary-box h3 {
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #EAE7DF;
    padding-bottom: 12px;
    color: #111;
}

/* Mengakali Dropdown (Select) agar teks panjang tidak merusak layout */
.summary-box select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #DCE0D9;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 16px;
    background-color: #fff;
    /* 3 Baris sakti ini mencegah teks panjang mendobrak batas layar */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.summary-box label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}

/* Baris Kalkulasi (Total Harga, Voucher, dll) */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
    width: 100%;
}

.summary-row.total-pay {
    border-top: 1px solid #DCE0D9;
    padding-top: 16px;
    margin-top: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.summary-box p {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    text-align: center;
    margin: 16px 0;
}

.summary-box button {
    width: 100%;
    padding: 14px;
    background-color: #A4B29E; /* Hijau pucat/sage sesuai desain Anda */
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.summary-box button:hover {
    background-color: #4A5D4E;
}