:root {
    --primary: #e9e8e6cc;
    --primary-bright: #f8fafc;
    --bg: #ffffff;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass: rgba(252, 252, 252, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text-muted: #94a3b8;
    --orange : rgb(189, 134, 31);
}

* {
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
    color: white;
}

/* Base Body */
body {
    margin: 0;
    padding: 0;
    background: #0f172a;
}

.app-content {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding-bottom: 30px;
}

/* Simulasi Layar Mobile */
@media (min-width: 431px) {
    body {
        background: #020617;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }

    .device-wrapper {
        position: relative;
        padding: 15px;
        background: #1e293b;
        border-radius: 50px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
        border: 4px solid #334155;
    }

    .mobile-frame {
        width: 375px;
        height: 812px;
        background: #0f172a;
        border-radius: 35px;
        overflow: hidden;
        position: relative;
        border: 8px solid #000;
    }

    .app-content {
        height: 100%;
        overflow-y: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .app-content::-webkit-scrollbar {
        display: none;
    }
}

/* Navigasi Utama */
nav {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.logo {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 1px;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.cart-btn {
    background: var(--orange);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    transition: 0.2s;
}

.cart-btn span {
    color: var(--primary);
}

.container {
    padding: 0 4%;
    max-width: 1200px;
    margin: auto;
}

/* Pencarian */
.search-container {
    margin-top: 15px;
    position: relative;
    display: block;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: 0.3s;
    font-size: 0.85rem;
}

.search-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    pointer-events: none;
}

/* Kategori */
.category-wrapper {
    margin-top: 15px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--glass);
}

.category-header {
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.arrow {
    transition: 0.3s ease;
    font-size: 0.8rem;
    opacity: 0.5;
}

.category-header.active .arrow {
    transform: rotate(180deg);
}

.category-content {
    display: none;
    padding: 10px;
    border-top: 1px solid var(--border);
}

.category-content.show {
    display: grid;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Kartu Produk (Penyesuaian Agar Tidak Terpotong) */
.product-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    position: relative;
    width: 100%;
}

.product-img {
    width: 90px;
    min-width: 90px;
    height: 90px;
    object-fit: cover;
}

.product-info {
    padding: 8px 10px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-info h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 1px;
    text-overflow: ellipsis;
}

.product-price {
    color: var(--primary);
    font-weight: bold;
    font-size: 0.8rem;
    margin: 2px 0 6px 0;
}

/* Form Kuantitas & Tombol Tambah */
.cart-form {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

/* Stepper (-) Qty (+) */
.qty-stepper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    height: 28px;
    flex-shrink: 0;
}

.btn-qty {
    background: transparent;
    border: none;
    color: var(--primary);
    width: 22px;
    height: 100%;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    user-select: none;
    padding: 0;
}

.btn-qty:hover {
    background: rgba(255, 255, 255, 0.1);
}

.qty-input {
    width: 22px;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    color: white;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btn-add {
    flex: 1;
    width: 1%;
    height: 28px;
    background: transparent;
    border: 0px solid var(--primary);
    color: var(--orange);
    padding: 0 4px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.7rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: right;
    white-space: nowrap;
    text-align: right;
}

.btn-add:hover:not(:disabled) {
    font-size: 1rem;
    color: black;
}

.btn-add:disabled {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Card Status Pesanan */
.status-card {
    background: var(--glass);
    border-left: 4px solid var(--primary);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

/* Live Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: none;
}

.chat-btn-trigger {
    background: var(--orange);
    color: black;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: none;
    animation: pulse 2s infinite;
}

.chat-box {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 290px;
    height: 380px;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 14px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.chat-header {
    background: var(--orange);
    color: black;
    padding: 10px 14px;
    font-weight: bold;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.chat-messages {
    flex-grow: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.msg {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    max-width: 80%;
    word-wrap: break-word;
}

.msg.seller {
    background: var(--glass);
    align-self: flex-start;
    border: 1px solid var(--border);
}

.msg.user {
    background: var(--orange);
    color: black;
    align-self: flex-end;
}

.chat-input-area {
    padding: 8px;
    background: #0f172a;
    display: flex;
    gap: 6px;
    border-top: 1px solid var(--border);
}

.chat-input-area input {
    flex-grow: 1;
    background: var(--glass);
    border: 1px solid var(--border);
    color: white;
    padding: 7px 10px;
    border-radius: 6px;
    outline: none;
    font-size: 0.8rem;
}

.chat-send-btn {
    background: var(--orange);
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: black;
}

/* Modal UI */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #1e293b;
    width: 90%;
    max-width: 380px;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--primary);
}

.close-btn { font-size: 1.8rem; cursor: pointer; color: white; }

.input-group { margin-bottom: 12px; }
.input-group label { display: block; font-size: 0.78rem; color: #94a3b8; margin-bottom: 4px; }
.input-group input {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white;
    outline: none;
    font-size: 0.85rem;
}

.btn-save {
    width: 100%;
    background: var(--primary);
    color: black;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    margin-top: 8px;
    cursor: pointer;
}

.btn-logout {
    display: block;
    text-align: center;
    margin-top: 12px;
    color: #ef4444;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.logo-wrapper {
    text-align: center;
}

.shimmer-text {
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #c5a059;
    background: linear-gradient(90deg, #c5a059, #fff, #c5a059);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 2s linear infinite;
}

.loading-bar-container {
    width: 130px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px auto 0;
    border-radius: 10px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: #c5a059;
    animation: loadProgress 2.5s ease-in-out forwards;
}

@keyframes shine {
    to { background-position: 200% center; }
}

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    display: none;
}

.chat-btn-wrapper {
    position: relative;
}

.chat-badge-user {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
    border: 2px solid var(--bg);
    font-weight: bold;
    display: none;
    z-index: 1001;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Konsistensi Tampilan Dekstop Sesuai Gambar */
@media (min-width: 768px) {
    .category-content.show {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 12px;
    }

    .product-card {
        flex-direction: row;
    }

    .product-img {
        width: 90px;
        min-width: 90px;
        height: 90px;
    }

    .product-info {
        padding: 8px 10px;
    }
}