*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --featured: #fef3c7;
  --featured-border: #f59e0b;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
}

/* ── Genel ── */
.hidden { display: none !important; }
.empty-msg { color: var(--muted); text-align: center; padding: 20px; }
.err-msg { color: var(--danger); padding: 8px; }

/* ── Login ── */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}
.login-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 1.3rem; margin-bottom: 24px; color: var(--primary); }
.form-error { color: var(--danger); font-size: 0.9rem; margin-bottom: 10px; }

/* ── Header ── */
header {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1 { font-size: 1.1rem; flex: 1; }

.header-actions { display: flex; gap: 4px; }

.hdr-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.hdr-btn:active { background: rgba(255,255,255,0.3); }

.seller-badge {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.9);
  font-size: 0.8rem;
  padding: 4px 16px;
  text-align: center;
}

.back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.view { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ── Arama ── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 8px;
  font-size: 1rem;
  background: transparent;
}

.search-bar span { color: var(--muted); }

/* ── Kart ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.15s;
}

.card:active { background: #f0f4ff; }
.card .name { font-weight: 600; font-size: 1rem; }
.card .sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* ── Butonlar ── */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

a.btn { text-decoration: none; display: block; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn + .btn { margin-top: 10px; }


/* ── Modal: Yeni Müşteri ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end;
  z-index: 100;
}

.modal {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 16px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.modal h2 { font-size: 1.1rem; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
.form-group input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--primary); }

.phone-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.no-phone-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.field-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 4px;
}

.phone-input-wrap {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.phone-input-wrap:focus-within { border-color: var(--primary); }
.phone-prefix {
  background: var(--bg);
  color: var(--muted);
  padding: 11px 10px;
  font-size: 1rem;
  border-right: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
}
.phone-input-wrap input {
  border: none !important;
  border-radius: 0 !important;
  flex: 1;
}

/* ── Sipariş Girişi ── */
#customer-label {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
}

.category-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 18px 0 8px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-card.featured {
  background: var(--featured);
  border-color: var(--featured-border);
}

.product-photo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.product-photo-placeholder {
  width: 56px;
  height: 56px;
  background: var(--border);
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.4rem;
}

.product-info { flex: 1; min-width: 0; }
.product-info .pname { font-weight: 600; font-size: 0.95rem; }
.product-info .pmeta { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.featured-badge {
  font-size: 0.7rem;
  background: var(--featured-border);
  color: #fff;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 6px;
  font-weight: 700;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}

.stepper button:active { background: var(--primary); color: #fff; }
.stepper .qty { font-size: 1.1rem; font-weight: 700; min-width: 24px; text-align: center; }

#send-order-btn {
  position: sticky;
  bottom: 16px;
  margin-top: 20px;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}

/* ── Onay ── */
#confirmation-view { text-align: center; }

.confirm-icon {
  font-size: 3.5rem;
  margin: 24px 0 8px;
}

#confirmation-view h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

#confirmation-view .sub {
  color: var(--muted);
  margin-bottom: 24px;
}

.order-summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.order-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.order-summary .summary-row:last-child { border-bottom: none; }
.order-summary .summary-row .qty { font-weight: 700; color: var(--primary); }

/* ── Yükleniyor ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── PWA banner ── */
#install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
}

#install-banner p { flex: 1; font-size: 0.9rem; }
#install-banner button {
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

#install-dismiss {
  background: none !important;
  color: #fff !important;
  font-size: 1.3rem;
  padding: 4px !important;
}

/* ── Ürün varyant accordion ── */
.variant-card {
  display: block;
  padding: 0;
  overflow: hidden;
}
.variant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.variant-header:active { background: #f0f4ff; }
.variant-header .pname { font-weight: 600; font-size: 0.95rem; }
.variant-header .pmeta { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.variant-arrow { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; }
.variant-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.variant-stepper {
  margin-top: 10px;
  justify-content: flex-end;
}

.variant-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.variant-radio-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.85rem; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 10px;
  transition: background 0.1s, border-color 0.1s;
}
.variant-radio-label:has(input:checked) {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.variant-radio-label input { display: none; }

/* ── Fiyat toggle ── */
.price-toggle-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; color: var(--muted);
  margin-bottom: 12px; cursor: pointer;
}

/* ── Arama temizle ── */
.search-clear-btn {
  background: none; border: none; color: var(--muted);
  font-size: 0.9rem; cursor: pointer; padding: 0 4px;
}

/* ── Geçmiş ── */
.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
}
.history-customer { font-weight: 600; font-size: 0.95rem; }
.history-meta { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.expand-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}
.history-items { border-top: 1px solid var(--border); padding: 8px 14px; }
.history-item-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.history-item-row:last-child { border-bottom: none; }
.history-item-row .qty { font-weight: 700; color: var(--primary); }

/* ── Ana Ekran ── */
.home-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
  padding: 24px;
}
.btn-new-order {
  font-size: 1.2rem;
  padding: 20px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}

/* ── Müşteri Seç Modal ── */
.modal-drag-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 0 auto 16px;
}
.customer-select-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.search-bar-modal { margin-bottom: 8px; }

/* ── Müşteri listesi ── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 4px 0 8px;
}
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-new { border-style: dashed; color: var(--primary); }
.card-new .name { color: var(--primary); }
.last-order { font-size: 0.75rem; color: var(--muted); flex-shrink: 0; }

/* ── Müşteri Detay Modal ── */
.modal-tall { max-height: 85vh; overflow-y: auto; }
.customer-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px;
}
.cd-name { font-size: 1.1rem; font-weight: 700; }
.cd-phone { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.modal-close-btn {
  background: none; border: none; font-size: 1.2rem;
  color: var(--muted); cursor: pointer; padding: 0 4px; flex-shrink: 0;
}
.cd-order-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg);
}
.cd-order-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.cd-order-items { font-size: 0.88rem; margin-bottom: 8px; line-height: 1.4; }
.btn-repeat {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-repeat:active { background: var(--primary); color: #fff; }

/* ── Satıcı Yönetimi ── */
.seller-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.seller-name { font-weight: 600; }
.seller-meta { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.delete-seller-btn {
  background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
}
.you-badge {
  font-size: 0.75rem; background: var(--primary); color: #fff;
  padding: 3px 8px; border-radius: 99px;
}

select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 1rem;
  outline: none;
  background: var(--card);
  transition: border-color 0.15s;
}
select:focus { border-color: var(--primary); }

/* ── Rapor Modal ── */
.modal-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; margin-top: -8px; }
.report-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
}
.report-ok { background: #dcfce7; color: #15803d; }
.report-err { background: #fee2e2; color: #b91c1c; }
