/* ============================================================
   Supermarket & Jastip — Global Styles
   ============================================================ */
:root {
  --primary:    #16a34a;
  --primary-dk: #15803d;
  --secondary:  #f97316;
  --accent:     #0ea5e9;
  --danger:     #dc2626;
  --warning:    #d97706;
  --bg:         #f8fafc;
  --card:       #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --text-muted: #64748b;
  --radius:     12px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 24px 0; }

/* ── Navbar ── */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; max-width: 1200px; margin: 0 auto;
}
.navbar-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.navbar-brand span { font-size: 1.5rem; }
.navbar-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { padding: 8px 12px; border-radius: 8px; font-size: .9rem; color: var(--text-muted); transition: all .2s; }
.nav-link:hover, .nav-link.active { background: #f0fdf4; color: var(--primary); }
.nav-cart { position: relative; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--secondary); color: #fff;
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; font-size: .9rem;
  font-weight: 600; border: none; cursor: pointer; transition: all .2s;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { opacity: .9; }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-sm        { padding: 6px 14px; font-size: .8rem; }
.btn-lg        { padding: 14px 28px; font-size: 1rem; }
.btn-block     { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--border); }

/* ── Product Card ── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; transition: all .2s; cursor: pointer; }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f1f5f9; }
.product-card-img-placeholder { width: 100%; aspect-ratio: 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.product-card-body { padding: 12px; }
.product-card-name { font-size: .9rem; font-weight: 600; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-price { color: var(--primary); font-weight: 700; font-size: 1rem; }
.product-card-seller { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.product-card-rating { font-size: .75rem; color: var(--warning); }
.product-card-stock { font-size: .75rem; }
.stock-limited { color: var(--danger); }
.stock-ok { color: var(--primary); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; background: var(--card);
  transition: border-color .2s; outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-yellow  { background: #fef9c3; color: #a16207; }

/* ── Status Badge ── */
.status-open              { @extend .badge-blue; }
.status-accepted          { background: #dbeafe; color: #1d4ed8; }
.status-shopping          { background: #fef9c3; color: #a16207; }
.status-waiting_confirmation { background: #ffedd5; color: #c2410c; }
.status-paid              { background: #dcfce7; color: #15803d; }
.status-on_delivery       { background: #e0f2fe; color: #0369a1; }
.status-completed         { background: #dcfce7; color: #15803d; }
.status-cancelled         { background: #fee2e2; color: #b91c1c; }
.status-disputed          { background: #fce7f3; color: #9d174d; }
.status-pending           { background: #fef9c3; color: #a16207; }
.status-processing        { background: #dbeafe; color: #1d4ed8; }
.status-shipped           { background: #e0f2fe; color: #0369a1; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .875rem; margin-bottom: 16px; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { background: #f8fafc; padding: 10px 14px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8fafc; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 16px; font-size: .875rem; font-weight: 500; border: none; background: none; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Sidebar Layout ── */
.layout-sidebar { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.sidebar { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; position: sticky; top: 80px; }
.sidebar-menu { list-style: none; }
.sidebar-menu li a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: .875rem; color: var(--text-muted); transition: all .2s; }
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: #f0fdf4; color: var(--primary); font-weight: 500; }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.stat-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }

/* ── Loading ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .875rem; box-shadow: var(--shadow-md); animation: slideIn .3s ease; max-width: 320px; }
.toast.success { background: var(--primary); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #059669 100%); color: #fff; padding: 60px 0; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 16px; }
.hero p  { font-size: 1.1rem; opacity: .9; margin-bottom: 28px; }
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-white { background: #fff; color: var(--primary); }
.btn-white:hover { background: #f0fdf4; }
.btn-outline-white { background: transparent; border: 2px solid rgba(255,255,255,.6); color: #fff; }
.btn-outline-white:hover { background: rgba(255,255,255,.1); }

/* ── Category Pills ── */
.category-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.category-pill { padding: 6px 16px; border-radius: 20px; font-size: .85rem; border: 1.5px solid var(--border); cursor: pointer; transition: all .2s; background: var(--card); }
.category-pill:hover, .category-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Jastip Card ── */
.jastip-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 16px; transition: all .2s; }
.jastip-card:hover { box-shadow: var(--shadow-md); }
.jastip-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.jastip-store { font-weight: 700; font-size: 1rem; }
.jastip-area  { font-size: .8rem; color: var(--text-muted); }
.jastip-items { font-size: .85rem; color: var(--text-muted); margin-bottom: 12px; }
.jastip-footer { display: flex; justify-content: space-between; align-items: center; }
.jastip-fee { font-weight: 700; color: var(--secondary); }

/* ── Chat ── */
.chat-container { height: 400px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; border-radius: 8px; }
.chat-msg { max-width: 75%; }
.chat-msg.mine { align-self: flex-end; }
.chat-bubble { padding: 10px 14px; border-radius: 12px; font-size: .875rem; line-height: 1.5; }
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg:not(.mine) .chat-bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-time { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }
.chat-msg.mine .chat-time { text-align: right; }

/* ── Wallet ── */
.wallet-card { background: linear-gradient(135deg, var(--primary), #059669); color: #fff; border-radius: var(--radius); padding: 28px; }
.wallet-label { font-size: .85rem; opacity: .8; margin-bottom: 8px; }
.wallet-balance { font-size: 2.5rem; font-weight: 800; }
.wallet-sub { font-size: .85rem; opacity: .7; margin-top: 8px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero h1 { font-size: 1.75rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar-nav .nav-link span { display: none; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
