@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@700;800&display=swap');

:root {
  --primary: #00a884;
  --primary-hover: #008f72;
  --primary-light: #e7f8f5;
  --secondary: #ff3366;
  --bg: #efeae2;
  --surface: #ffffff;
  --text: #111b21;
  --text-muted: #667781;
  --border: #e9edef;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(11, 20, 26, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: #f0f2f5; color: var(--text); line-height: 1.5; min-height: 100vh; padding-bottom: 80px; overflow-x: hidden; touch-action: pan-y; }

.top-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px; height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.brand-title {
  font-family: 'Outfit', sans-serif; font-size: 21px; font-weight: 800;
  background: linear-gradient(135deg, #00a884, #005c4b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  display: inline-flex; align-items: center; gap: 8px;
}

.dropdown-container { position: relative; }
.btn-icon-top {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: 0.2s; font-size: 15px;
}
.btn-icon-top:hover { background: var(--border); }

.dropdown-menu {
  display: none; position: absolute; right: 0; top: 46px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  width: 170px; overflow: hidden; z-index: 100;
}
.dropdown-menu.show { display: block; animation: fadeIn 0.15s ease; }

.dropdown-menu a, .dropdown-item-logout {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; text-decoration: none;
  color: var(--text); font-size: 13.5px; font-weight: 500; background: transparent; border: none;
  width: 100%; text-align: left; cursor: pointer; transition: 0.2s;
}
.dropdown-menu a:hover, .dropdown-item-logout:hover { background: var(--bg); color: var(--primary); }
.dropdown-item-logout { color: #ef4444; }
.dropdown-item-logout:hover { background: #fee2e2 !important; color: #ef4444 !important; }
.dropdown-divider { height: 1px; background: var(--border); margin: 2px 0; }

.navbar { 
  background: var(--surface); border-top: 1px solid var(--border); padding: 0 10px; height: 65px; 
  display: flex; align-items: center; justify-content: center; position: fixed; bottom: 0; left: 0;
  right: 0; z-index: 50; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); 
}
.nav-links { display: flex; gap: 4px; background: transparent; padding: 0; }
.nav-links a { text-decoration: none; color: var(--text-muted); padding: 8px 12px; border-radius: 20px; font-weight: 600; font-size: 12px; transition: 0.2s; display: flex; align-items: center; gap: 5px; position: relative; }
.nav-links a.active { background: var(--primary-light); color: var(--primary); }

.unread-badge {
  position: absolute; top: 2px; right: 6px; background: #ef4444; color: white; font-size: 10px;
  font-weight: 700; padding: 1px 5px; border-radius: 10px; min-width: 16px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.product-tags-nav { display: flex; gap: 8px; margin-bottom: 16px; }
.tag-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: 12px; cursor: pointer; transition: 0.2s;
}
.tag-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

main { max-width: 900px; margin: 12px auto 0 auto; padding: 0 16px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; color: var(--text); }

.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s; display: flex; flex-direction: column; border: 1px solid var(--border); position: relative; }
.card:hover { transform: translateY(-2px); }
.card img { width: 100%; height: 150px; object-fit: cover; }
.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.card-price { font-weight: 700; color: var(--secondary); margin-bottom: 8px; font-size: 13.5px; }
.card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; flex: 1; white-space: pre-wrap; word-break: break-word; }
.seller-info { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.seller-info img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

.badge-tag {
  position: absolute; top: 10px; right: 10px; padding: 4px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.badge-tag.available { background: #22c55e; }
.badge-tag.sold { background: #ef4444; }
.badge-tag.pending { background: #f59e0b; }
.badge-tag.rejected { background: #64748b; }

.verified-badge {
  display: inline-block; width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231d9bf0' d='M12 .3l2.2 2.2 3.1-.6.6 3.1 2.8 1.6-1 3 1 3-2.8 1.6-.6 3.1-3.1-.6L12 23.7l-2.2-2.2-3.1.6-.6-3.1L3.3 17l1-3-1-3 2.8-1.6.6-3.1 3.1.6z'/%3E%3Cpath fill='%23fff' d='M10.2 15.6L7 12.4l1.4-1.4 1.8 1.8 4.4-4.4 1.4 1.4z'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat; margin-left: 4px; vertical-align: middle; flex-shrink: 0;
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; border: none; cursor: pointer; transition: 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #a7d8cc; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 6px; }

.global-chat-wrapper {
  position: fixed; top: 64px; bottom: 65px; left: 0; right: 0; display: flex; flex-direction: column;
  background: var(--bg); background-image: radial-gradient(#cbd5e1 0.75px, transparent 0.75px);
  background-size: 16px 16px; z-index: 30;
}

.global-chat-header {
  background: var(--surface); padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}

.online-badge {
  font-size: 12px; font-weight: 600; color: var(--text); background: var(--primary-light);
  padding: 4px 10px; border-radius: 14px; display: inline-flex; align-items: center; gap: 6px;
}

.online-indicator { display: inline-block; width: 8px; height: 8px; background-color: #22c55e; border-radius: 50%; }

.chat-box { flex: 1; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

.chat-msg { display: flex; gap: 8px; max-width: 82%; animation: fadeIn 0.15s ease; scroll-margin: 20px; }
.chat-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg img.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; align-self: flex-end; margin-bottom: 2px; flex-shrink: 0; }

.msg-col { display: flex; flex-direction: column; min-width: 0; }

.msg-bubble-wrap { display: flex; align-items: flex-end; gap: 2px; }
.chat-msg.me .msg-bubble-wrap { flex-direction: row-reverse; }

.reply-btn { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 6px; opacity: 0.45; flex-shrink: 0; transition: 0.2s; }
.reply-btn:hover, .reply-btn:active { opacity: 1; color: var(--primary); }

.msg-bubble { 
  background: var(--surface); padding: 7px 56px 9px 12px; border-radius: 8px; border-top-left-radius: 0;
  font-size: 13.5px; box-shadow: 0 1px 1px rgba(11,20,26,0.1); color: var(--text); word-wrap: break-word; 
  position: relative; min-width: 60px;
}
.chat-msg.me .msg-bubble { background: #dcf8c6; border-top-left-radius: 8px; border-top-right-radius: 0; }
.msg-name { font-size: 11px; font-weight: 700; margin-bottom: 2px; color: #005c4b; display: flex; align-items: center; gap: 4px; }
.chat-msg.me .msg-name { display: none; }

.msg-footer {
  position: absolute; right: 10px; bottom: 6px; font-size: 10.5px; color: var(--text-muted);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 3px;
}
.chat-msg.me .msg-footer { color: rgba(0,0,0,0.45); }

.chat-media-container { margin-bottom: 4px; border-radius: 6px; overflow: hidden; max-width: 220px; }
.chat-media { width: 100%; max-height: 200px; object-fit: cover; border-radius: 6px; display: block; }

.chat-input-area { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: #f0f2f5; align-items: center; flex-shrink: 0; }
.chat-input-area input[type="text"] { flex: 1; padding: 10px 16px; border: none; border-radius: 20px; outline: none; font-size: 13.5px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.chat-input-area input[type="text"]:focus { box-shadow: inset 0 0 0 1.5px var(--primary); }
.chat-input-area input[type="text"]:disabled { opacity: 0.6; }

.file-upload-btn { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: transparent; cursor: pointer; color: var(--text-muted); flex-shrink: 0; }
.file-upload-btn input[type="file"] { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; cursor: pointer; }

.msg-ticks { font-size: 11px; }
.msg-ticks.read { color: #34b7f1; }

.reply-preview {
  display: none; align-items: center; justify-content: space-between; background: #f0f2f5;
  border-left: 4px solid var(--primary); padding: 8px 12px; margin: 8px 12px 0 12px; border-radius: 6px;
  gap: 10px; flex-shrink: 0;
}
.reply-preview-content { flex: 1; overflow: hidden; }
.reply-preview-name { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.reply-preview-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 4px; flex-shrink: 0; }

.reply-quote {
  background: rgba(0,0,0,0.05); border-left: 3px solid var(--primary); border-radius: 6px;
  padding: 5px 8px; margin-bottom: 5px; cursor: pointer; max-width: 100%;
}
.chat-msg.me .reply-quote { background: rgba(0,0,0,0.08); }
.reply-quote-name { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 1px; }
.reply-quote-text { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.highlight-flash { animation: flashBg 1s ease; border-radius: 8px; }
@keyframes flashBg { 0% { background: rgba(0, 168, 132, 0.25); } 100% { background: transparent; } }

.inbox-action-header {
  position: sticky; top: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; z-index: 20;
}
.inbox-card {
  background: var(--surface); padding: 12px 16px; border-radius: var(--radius); display: flex;
  align-items: center; gap: 12px; cursor: pointer; border: 1px solid var(--border); transition: 0.2s;
  user-select: none; position: relative;
}
.inbox-card.selected { background: var(--primary-light); border-color: var(--primary); }

.inbox-unread-count {
  background: #ef4444; color: white; font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; min-width: 20px; text-align: center;
}

.image-modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); z-index: 999; align-items: center; justify-content: center; padding: 20px; }
.image-modal.open { display: flex; }
.image-modal img { max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.image-modal-close { position: absolute; top: 20px; right: 20px; background: rgba(255, 255, 255, 0.2); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.group-card { background: var(--surface); padding: 14px; border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; transition: 0.2s; }
.group-card:hover { border-color: var(--primary); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.badge.admin { background: #fef3c7; color: #b45309; }

.modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(3px); z-index: 100; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-content { background: var(--surface); width: 100%; max-width: 440px; border-radius: var(--radius); padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 17px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-group input, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; outline: none; background: #fafafa; }

.admin-badge-option {
  display: flex; align-items: center; gap: 10px; background: var(--bg); padding: 12px; border-radius: 8px;
  border: 1px solid var(--border); margin-top: 15px; cursor: pointer;
}
.admin-badge-option input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.admin-badge-option label { margin: 0; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text); }

.app-footer { text-align: center; margin-top: 30px; padding: 15px 0; font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--border); }
.app-footer strong { color: var(--text); font-weight: 600; }

/* QRIS BOT CARD */
.qris-card { background: var(--surface); border-radius: 10px; padding: 10px; max-width: 260px; box-shadow: 0 1px 3px rgba(0,0,0,0.12); border: 1px solid var(--border); }
.qris-header { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 8px; display:flex; align-items:center; gap:6px; }
.qris-image { width: 100%; border-radius: 6px; display: block; }
.qris-detail { font-size: 12px; color: var(--text-muted); margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.qris-total { font-weight: 700; color: var(--text); }
.qris-status { margin-top: 8px; text-align: center; font-size: 11.5px; font-weight: 700; padding: 5px; border-radius: 6px; }
.qris-status-pending { background: #fef3c7; color: #b45309; }
.qris-status-paid { background: #dcfce7; color: #15803d; }
.qris-status-expired, .qris-status-cancelled { background: #fee2e2; color: #b91c1c; }
.qris-cancel-slot { margin-top: 6px; }
.qris-cancel-btn { width: 100%; background: #fee2e2; color: #b91c1c; border: none; padding: 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.qris-cancel-btn:hover { background: #fecaca; }

/* ADMIN: PRODUK PENDING */
.pending-product-card { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 10px; }
.pending-product-img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.pending-product-info { flex: 1; overflow: hidden; }
.pending-product-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-product-price { font-size: 12px; color: var(--secondary); font-weight: 700; }
.pending-product-seller { font-size: 11px; color: var(--text-muted); }
.pending-product-actions { display: flex; gap: 6px; flex-shrink: 0; }