/* mobile-first, ქართული გამყიდველის პანელი — მოდერნული SaaS სტილი */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Georgian:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .07);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 10px 24px -8px rgba(15, 23, 42, .15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans Georgian", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
}
.header-right { display: flex; align-items: center; gap: 10px; }
.user-email { color: var(--muted); font-size: 0.85rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.container { max-width: 760px; margin: 0 auto; padding: 16px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* 🔔 handoff — „ყურადღება სჭირდება" ბარათი (გამოირჩევა ქარვისფერი აქცენტით) */
.attention-card {
  border-color: #f59e0b;
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}
.attention-card h2 { color: #b45309; }

/* Auth */
.auth-view { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 400px; }
.auth-back { display: inline-block; font-size: .85rem; color: var(--muted); text-decoration: none; margin-bottom: 12px; }
.auth-back:hover { color: var(--primary); }
.auth-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 6px; }
.auth-subtitle { text-align: center; color: #6b7280; font-size: .9rem; margin: 0 0 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--border);
  background: var(--bg); border-radius: 8px; cursor: pointer; font-size: 1rem;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-link { display: block; text-align: center; font-size: 0.85rem; color: var(--primary); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  font: inherit; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; color: var(--text); width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.checkbox-label input { width: auto; }
.product-form { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  font: inherit; padding: 12px 16px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; font-weight: 600;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 10px 22px -6px rgba(99, 102, 241, .8); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); padding: 8px 12px; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 0.85rem; }

/* Shop bar */
.shop-bar { display: flex; align-items: flex-end; gap: 10px; }
.shop-select-wrap { flex: 1; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; }

/* Usage (გამოწერა/გამოყენება) */
.usage-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.usage-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: .9rem; }
.usage-nums { color: var(--muted); }
.usage-bar { height: 8px; background: #e2e8f0; border-radius: 999px; margin: 8px 0 6px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
.usage-bar span.near { background: #d97706; }
.usage-foot { font-size: .8rem; color: var(--muted); }
.usage-upgrade { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: .85rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usage-upgrade > span { color: var(--muted); }
.usage-upgrade.pending { display: block; color: #d97706; font-weight: 500; }
.usage-upgrade .pay-info { margin-top: 8px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-weight: 400; line-height: 1.75; }
.usage-upgrade .btn-sm { padding: 5px 12px; }

/* Dashboard tabs */
.tabs-nav { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  flex: 1; min-width: 100px; padding: 12px 10px; font: inherit; font-weight: 600;
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 10px; cursor: pointer;
}
.tab-btn:hover { background: var(--bg); }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 8px 18px -8px rgba(99, 102, 241, .8); }

/* Import (Excel/CSV) */
.import-hint { font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; }
.import-hint a { color: var(--primary); }
.import-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.import-row input[type="file"] { flex: 1; min-width: 180px; }
.import-result { margin-top: 10px; font-size: 0.9rem; }
.import-result.import-ok { color: var(--ok); }
.import-result.import-err { color: var(--danger); }
.import-err-title { font-weight: 600; margin-bottom: 6px; }
.import-result ul { margin: 0; padding-left: 18px; max-height: 200px; overflow: auto; }

/* Import — სვეტების მორგება (mapping) */
.import-mapping {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--primary-light);
}
.mapping-title { font-weight: 600; margin-bottom: 10px; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mapping-row { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.mapping-row select { padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.mapping-preview { overflow-x: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; }
.mapping-preview table { border-collapse: collapse; width: 100%; font-size: 0.8rem; background: var(--card); }
.mapping-preview th, .mapping-preview td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; white-space: nowrap; }
.mapping-preview th { background: var(--primary-light); font-weight: 600; }
.mapping-extra { margin-bottom: 12px; }
.mapping-extra-title { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.extra-chk { display: inline-flex; align-items: center; gap: 4px; margin: 0 12px 6px 0; font-size: 0.85rem; }

/* Facebook section */
.fb-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.fb-status { font-size: 0.9rem; margin-bottom: 8px; }
.fb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-connected { color: var(--ok); font-weight: 600; }
.fb-disconnected { color: var(--muted); }

/* Product list */
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-header h2, #product-form-card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.product-list { display: flex; flex-direction: column; gap: 10px; }
.product-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; transition: border-color .15s ease, box-shadow .2s ease, transform .12s ease;
}
.product-item:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); }
.product-info { min-width: 0; }
.product-name { font-weight: 600; }
.product-meta { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.badge-on { background: #dcfce7; color: var(--ok); }
.badge-off { background: #fee2e2; color: var(--danger); }

/* შეკვეთის სტატუსის ფერადი აქცენტი (მარცხენა ზოლი) */
.order-item { border-left-width: 4px; }
.order-new { border-left-color: var(--primary); }
.order-processing { border-left-color: #d97706; }
.order-done { border-left-color: var(--ok); }
.order-cancelled { border-left-color: #94a3b8; opacity: .85; }
.order-item:hover { transform: none; }
.product-actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty-state { text-align: center; color: var(--muted); padding: 16px; }

/* Loading — skeleton */
.skel-item {
  padding: 14px; border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; gap: 9px;
}
.skel { border-radius: 6px; background: #e8edf3; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s ease infinite;
}
.skel-line { height: 13px; }
.skel-line.lg { width: 55%; height: 15px; }
.skel-line.sm { width: 32%; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Loading — button spinner */
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; top: 50%; left: 50%;
  margin: -8px 0 0 -8px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: btnspin .6s linear infinite;
}
.btn-ghost.is-loading::after, .btn-danger.is-loading::after {
  border-color: rgba(99,102,241,.35); border-top-color: var(--primary);
}
@keyframes btnspin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 12px 18px; border-radius: 10px; color: #fff; z-index: 100;
  max-width: 90vw; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.toast-ok { background: var(--ok); }
.toast-err { background: var(--danger); }

/* mobile */
@media (max-width: 480px) {
  .row-2 { grid-template-columns: 1fr; }
  .product-item { flex-direction: column; align-items: stretch; }
  .product-actions { justify-content: flex-end; }
}
