/* ==========================================================================
   SEMKANESH MARTKETPLACE - MODERN UI CSS (FULL & ANTI-BUG)
   ========================================================================== */
:root {
    --primary-color: #4A90E2; 
    --primary-dark: #357ABD;
    --secondary-color: #F39C12; 
    --success-color: #2ECC71; 
    --danger-color: #E74C3C; 
    --background-color: #F8F9FA;
    --surface-color: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --border-color: #E0E0E0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.08);
    --border-radius: 12px;
    --nav-height: 65px;
    --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { max-width: 100vw; overflow-x: hidden; font-family: 'Poppins', sans-serif; background-color: var(--background-color); color: var(--text-primary); line-height: 1.5; font-size: 14px; }

a { text-decoration: none; color: var(--primary-color); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; outline: none; background: transparent; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--primary-color); }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.p-20 { padding: 20px; }
.bg-light { background-color: var(--background-color); }

h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-outline { border: 1px solid var(--border-color); color: var(--text-secondary); }
.badge-primary { background: var(--primary-color); color: white; }
.badge-success { background: var(--success-color); color: white; }
.badge-danger { background: var(--danger-color); color: white; }
.badge-warning { background: var(--secondary-color); color: white; }

.main-body { padding-bottom: calc(var(--nav-height) + 20px); width: 100%; }
.pb-nav { padding-bottom: 80px; }

/* HEADER */
.top-header { display: flex; justify-content: space-between; align-items: center; height: var(--header-height); background: var(--surface-color); padding: 0 15px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); width: 100%; }
.top-header h2 { font-size: 16px; margin: 0; }
.btn-back, .btn-icon { font-size: 18px; padding: 10px; color: var(--text-primary); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

/* BOTTOM NAV */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: var(--surface-color); display: flex; justify-content: space-around; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 1000; border-top-left-radius: 15px; border-top-right-radius: 15px; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 10px; width: 20%; position: relative; transition: 0.3s; }
.nav-item i { font-size: 20px; margin-bottom: 4px; }
.nav-item.active { color: var(--primary-color); }
.fab-item { position: relative; top: -18px; }
.fab { width: 56px; height: 56px; background: var(--primary-color); border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; box-shadow: 0 4px 10px rgba(74, 144, 226, 0.4); border: 4px solid var(--surface-color); }
.fab i { font-size: 24px !important; margin: 0 !important; display: flex !important; align-items: center; justify-content: center; width: 100%; height: 100%; }

/* BUTTONS & FORMS */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border-radius: var(--border-radius); font-weight: 500; font-size: 14px; transition: 0.3s; width: 100%; text-align: center; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary-color); color: white; box-shadow: var(--shadow-md); }
.btn-outline { border: 1px solid var(--primary-color); color: var(--primary-color); background: transparent; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-success { background: var(--success-color); color: white; }

.form-group { margin-bottom: 15px; width: 100%; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 12px; }
.form-control { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 14px; background: var(--surface-color); outline: none; }
.form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1); }
.form-row { display: flex; gap: 10px; width: 100%; }
.form-row .half { flex: 1; min-width: 0; }
.input-icon { position: relative; width: 100%; }
.input-icon i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.input-icon input, .input-icon select { width: 100%; padding: 12px 15px 12px 40px; border: 1px solid var(--border-color); border-radius: var(--border-radius); background: var(--surface-color); font-size: 14px; outline: none; }

/* AUTH */
.auth-body { background: var(--surface-color); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; width: 100vw; }
.auth-container { width: 100%; max-width: 400px; }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-logo { width: 60px; height: 60px; background: var(--primary-color); color: white; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 15px; box-shadow: var(--shadow-md); }
.auth-header h1 { font-size: 20px; margin-bottom: 5px; }
.auth-header p { color: var(--text-secondary); font-size: 12px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 13px; }

/* HOME */
.main-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: var(--surface-color); border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; box-shadow: var(--shadow-sm); width: 100%; }
.header-actions { display: flex; gap: 15px; }
.action-icon { position: relative; font-size: 20px; color: var(--text-primary); }
.action-icon .badge { position: absolute; top: -5px; right: -8px; background: var(--danger-color); color: white; font-size: 9px; padding: 2px 5px; border-radius: 10px; border: 2px solid var(--surface-color); }
.user-info-flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background-color: var(--border-color); flex-shrink: 0; }
.user-greet { min-width: 0; }
.user-greet p { margin: 0; font-size: 11px; color: var(--text-secondary); }
.user-greet h4 { margin: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick-actions { display: flex; justify-content: space-around; padding: 20px 15px; width: 100%; }
.quick-card { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 30%; }
.quick-card .icon-wrapper { width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; box-shadow: var(--shadow-sm); }
.quick-card .green { background: var(--success-color); }
.quick-card .blue { background: var(--primary-color); }
.quick-card .orange { background: var(--secondary-color); }
.quick-card span { font-size: 11px; font-weight: 500; color: var(--text-primary); text-align: center; }

.search-section { padding: 0 15px; margin-bottom: 20px; width: 100%; }
.search-box { display: flex; align-items: center; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 25px; padding: 6px 16px; box-shadow: var(--shadow-sm); width: 100%; }
.search-icon { color: var(--text-secondary); margin-right: 10px; font-size: 16px; flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; padding: 6px 0; min-width: 0; }
.btn-search { background: transparent; color: var(--primary-color); font-weight: 600; font-size: 13px; padding-left: 12px; margin-left: 8px; border-left: 1px solid var(--border-color); flex-shrink: 0; }

.section-title { padding: 0 15px; margin-bottom: 10px; width: 100%; }
.section-title h2 { font-size: 14px; }
.horizontal-scroll { display: flex; overflow-x: auto; padding: 0 15px 15px; gap: 12px; scrollbar-width: none; width: 100%; }
.horizontal-scroll::-webkit-scrollbar { display: none; }
.dept-card { min-width: 100px; background: var(--surface-color); padding: 12px 10px; border-radius: 12px; text-align: center; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.dept-card i { font-size: 24px; color: var(--primary-color); margin-bottom: 8px; }
.dept-card span { display: block; font-size: 11px; font-weight: 500; }
.chips-container .chip { background: white; border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 20px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

.products-section { padding: 0 15px; width: 100%; }
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.product-card { background: var(--surface-color); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); position: relative; width: 100%; }
.product-image { width: 100%; height: 150px; object-fit: cover; background: var(--border-color); }
.product-info { padding: 10px; }
.product-info h3 { font-size: 13px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.product-info .price { color: var(--primary-color); font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.product-info .meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); }
.status-badge { position: absolute; top: 8px; left: 8px; padding: 4px 8px; border-radius: 8px; font-size: 10px; font-weight: bold; color: white; z-index: 2; }

/* UPLOAD PRODUK & DETAIL */
.form-container { padding: 20px 15px; width: 100%; }
.image-upload-wrapper { width: 100%; margin-bottom: 15px; }
.upload-dropzone { width: 100%; height: 140px; border: 2px dashed var(--primary-color); background: #F0F7FF; border-radius: var(--border-radius); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--primary-color); cursor: pointer; text-align: center; padding: 15px; transition: 0.2s; }
.upload-dropzone i { font-size: 36px; margin-bottom: 8px; }
.upload-dropzone span { font-size: 12px; font-weight: 500; }
.image-preview-area { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; width: 100%; }
.img-preview { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }

.product-gallery { position: relative; width: 100%; }
.product-gallery img { width: 100%; height: 250px; object-fit: cover; background: var(--border-color); }
.product-info-box { background: var(--surface-color); padding: 15px; border-radius: 0 0 20px 20px; box-shadow: var(--shadow-sm); margin-bottom: 10px; width: 100%; }
.product-price { font-size: 20px; font-weight: 700; color: var(--primary-color); }
.product-title { font-size: 16px; margin: 5px 0 10px; }
.product-meta { display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap; }
.product-location { font-size: 12px; color: var(--text-secondary); }
.seller-card { background: var(--surface-color); padding: 15px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 10px; width: 100%; border-radius: 12px; border: 1px solid var(--border-color); }
.seller-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; background: var(--border-color); flex-shrink: 0; }
.seller-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.seller-info h3 { font-size: 14px; margin: 0 0 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.seller-info p { font-size: 11px; margin: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-view-seller { flex-shrink: 0; padding: 6px 12px; font-size: 12px; width: auto; border-radius: 6px; }

.product-description-box { background: var(--surface-color); padding: 15px; margin-bottom: 10px; width: 100%; border-radius: 12px; }
.product-description-box h3 { font-size: 14px; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; }
.product-description-box p { font-size: 13px; white-space: pre-line; color: var(--text-secondary); line-height: 1.6; }
.bottom-action-bar { position: fixed; bottom: 0; left: 0; width: 100%; padding: 10px 15px; background: var(--surface-color); box-shadow: 0 -2px 10px rgba(0,0,0,0.1); display: flex; gap: 10px; z-index: 1000; }
.bottom-action-bar .btn { flex: 1; }

/* ==========================================================================
   UI CHAT BARU (DESAIN MODERN NON-WA, DISCORD/IG DM STYLE)
   ========================================================================== */
.chat-list-container { padding: 10px 0; width: 100%; }
.chat-item { display: flex; align-items: center; padding: 15px; background: var(--surface-color); border-bottom: 1px solid var(--border-color); gap: 15px; width: 100%; cursor: pointer; transition: background 0.2s; }
.chat-item:hover { background: #F8F9FA; }
.chat-item-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--border-color); }
.chat-item-content { flex: 1; overflow: hidden; min-width: 0; }
.chat-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.chat-item-header h4 { font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.chat-time { font-size: 10px; color: var(--text-secondary); flex-shrink: 0; }
.chat-last-message { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.chat-unread-badge { background: var(--primary-color); color: white; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: bold; float: right; margin-top: -18px; }

/* KUNCI ANTI OFFSIDE CHAT */
.active-chat-wrapper { position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; z-index: 9999; background: #FFFFFF; display: flex; flex-direction: column; }
.chat-header { border-bottom: 1px solid var(--border-color); box-shadow: none; display: flex; align-items: center; gap: 15px; padding: 0 15px; height: var(--header-height); flex-shrink: 0; width: 100%; background: var(--surface-color); }
.chat-header-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 100%; }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--border-color); flex-shrink: 0; }
.chat-header-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }
.chat-header-text h3 { font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); line-height: 1.2; font-weight: 600; }
.chat-header-text p { font-size: 11px; margin: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }

/* DESAIN GELEMBUNG PESAN MODERN */
.chat-messages-container { flex: 1; overflow-y: auto; padding: 20px 15px; display: flex; flex-direction: column; gap: 15px; width: 100%; background: #FFFFFF; }
.message-row { display: flex; align-items: flex-end; gap: 10px; width: 100%; }
.message-row.me { justify-content: flex-end; }
.message-row.them { justify-content: flex-start; }
.chat-avatar-msg { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--border-color); }
.message-content-box { display: flex; flex-direction: column; max-width: 75%; }
.message-row.me .message-content-box { align-items: flex-end; }
.message-row.them .message-content-box { align-items: flex-start; }
.message-bubble { padding: 12px 16px; border-radius: 20px; font-size: 13px; line-height: 1.5; word-wrap: break-word; position: relative; }
.message-row.me .message-bubble { background: var(--primary-color); color: #FFFFFF; border-bottom-right-radius: 4px; }
.message-row.them .message-bubble { background: #F1F5F9; color: #0F172A; border-bottom-left-radius: 4px; }
.message-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 10px; color: #94A3B8; }

/* Fitur Hapus Pesan & Centang Biru */
.msg-actions { opacity: 0.5; cursor: pointer; transition: 0.2s; padding: 2px 5px; }
.msg-actions:hover { color: var(--danger-color); opacity: 1; }
.tick-icon { font-size: 10px; }
.tick-read { color: #3B82F6; } /* Biru */
.tick-sent { color: #94A3B8; } /* Abu-abu */

/* Area Input Chat */
.chat-input-area { flex-shrink: 0; background: var(--surface-color); padding: 10px 15px; display: flex; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); width: 100%; }
#formSendMessage { display: flex; gap: 10px; align-items: center; width: 100%; margin: 0; }
#inputMessage { flex: 1; padding: 12px 20px; border: none; border-radius: 25px; font-size: 14px; outline: none; background: #F1F5F9; min-width: 0; color: #0F172A; }
.btn-send { width: 40px; height: 40px; background: var(--primary-color); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 16px; transition: transform 0.2s; flex-shrink: 0; box-shadow: 0 2px 5px rgba(74,144,226,0.3); }

/* ==========================================================================
   UI NOTIFIKASI KEREN (FLOATING CARD STYLE)
   ========================================================================== */
.notification-container { padding: 15px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.notif-item { display: flex; padding: 15px; background: var(--surface-color); gap: 15px; width: 100%; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 1px solid #F1F5F9; transition: transform 0.2s; cursor: pointer; }
.notif-item:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.notif-item.unread { background: #F8FAFC; border-color: #BAE6FD; box-shadow: 0 4px 12px rgba(56,189,248,0.15); position: relative; }
.notif-item.unread::after { content: ''; position: absolute; top: 15px; right: 15px; width: 8px; height: 8px; background: var(--primary-color); border-radius: 50%; box-shadow: 0 0 8px var(--primary-color); }
.notif-icon { width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 18px; flex-shrink: 0; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1); }
.notif-content { flex: 1; overflow: hidden; min-width: 0; }
.notif-content h4 { font-size: 14px; margin: 0 0 4px; color: #0F172A; }
.notif-content p { font-size: 12px; margin: 0 0 6px; color: #64748B; line-height: 1.4; }
.notif-time { font-size: 10px; color: #94A3B8; font-weight: 500; }

/* PROFILE LAINNYA */
.profile-container { width: 100%; }
.profile-header-card { background: var(--surface-color); padding: 30px 20px; text-align: center; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; box-shadow: var(--shadow-sm); width: 100%; }
.profile-avatar-wrapper { position: relative; display: inline-block; margin-bottom: 15px; }
.profile-avatar-large { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-color); background: var(--border-color); }
.btn-edit-avatar { position: absolute; bottom: 0; right: 0; background: var(--primary-color); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 2px solid white; box-shadow: var(--shadow-sm); }
.profile-stats { display: flex; margin: 15px; background: var(--surface-color); border-radius: 12px; box-shadow: var(--shadow-sm); padding: 15px 0; }
.stat-box { flex: 1; text-align: center; border-right: 1px solid var(--border-color); min-width: 0; }
.stat-box:last-child { border-right: none; }
.stat-box h3 { font-size: 18px; color: var(--primary-color); margin: 0; }
.stat-box p { font-size: 11px; color: var(--text-secondary); margin: 0; }
.profile-menu { margin: 15px; background: var(--surface-color); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.menu-item { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); width: 100%; }
.menu-item:last-child { border-bottom: none; }
.menu-icon { width: 35px; height: 35px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; margin-right: 15px; font-size: 14px; flex-shrink: 0; }
.menu-text { flex: 1; font-size: 14px; font-weight: 500; text-align: left; }
.bg-blue { background: var(--primary-color); }
.bg-green { background: var(--success-color); }
.bg-orange { background: var(--secondary-color); }
.bg-purple { background: #9B59B6; }

/* HELPER */
.alert { padding: 12px 15px; border-radius: 8px; margin-bottom: 15px; font-size: 13px; width: 100%; }
.alert-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.alert-danger { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.info-alert { display: flex; gap: 15px; padding: 15px; border-radius: 12px; align-items: flex-start; margin-bottom: 15px; width: 100%; }
.info-cod { background: #E8F4F8; color: #2C3E50; }
.info-warning { background: #FFF3E0; color: #D35400; }
.info-alert i { font-size: 24px; color: var(--primary-color); flex-shrink: 0; }
.info-alert strong { font-size: 13px; display: block; margin-bottom: 4px; }
.info-alert p { font-size: 11px; margin: 0; }
.shimmer-box { background: #f6f7f8; background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%); background-repeat: no-repeat; background-size: 800px 100%; animation: placeholderShimmer 1.5s linear infinite forwards; }
@keyframes placeholderShimmer { 0% { background-position: -468px 0; } 100% { background-position: 468px 0; } }