/* =====================================================================
   PARFÜM YÖNETİM SİSTEMİ - ANA STİL DOSYASI
   Mobil öncelikli, iOS hissi veren modern tasarım
   ===================================================================== */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #93c5fd;
  --color-success: #22c55e;
  --color-success-dark: #16a34a;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-white: #ffffff;
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-500: #64748b;
  --color-gray-700: #334155;
  --color-gray-900: #0f172a;

  --bg-body: var(--color-gray-100);
  --bg-card: var(--color-white);
  --bg-elevated: var(--color-white);
  --text-main: var(--color-gray-900);
  --text-muted: var(--color-gray-500);
  --border-color: var(--color-gray-200);

  --brand-gradient: linear-gradient(135deg, var(--color-primary), var(--color-success));

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-body: #0b1220;
  --bg-card: #161f30;
  --bg-elevated: #1c2538;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #263048;
  --color-gray-100: #1c2538;
  --color-gray-200: #263048;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  transition: background var(--transition), color var(--transition);
  letter-spacing: -0.01em;
}

h1, h2, h3, h4 { letter-spacing: -0.015em; }

body { padding-bottom: 84px; }
body.no-bottom-nav { padding-bottom: 24px; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2.5px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: 10px; }

/* ---------- Layout ---------- */
.app-container { max-width: 560px; margin: 0 auto; padding: 16px; animation: fadeUp 0.35s ease both; }
.app-container.wide { max-width: 900px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(14px);
  opacity: 0.98;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 800; }
.topbar .topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--brand-gradient); opacity: 0.9;
}

/* ---------- Kartlar ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 14px;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  border: 1px solid var(--border-color);
}
.card:active { transform: scale(0.99); }
.card.hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: transparent; }

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  animation: fadeUp 0.4s ease both;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 10px;
}
.stat-card .stat-value { font-size: 22px; font-weight: 800; margin: 2px 0; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); }

.dashboard-greeting {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand-gradient); border-radius: var(--radius-lg);
  padding: 18px 20px; color: #fff; box-shadow: 0 10px 24px rgba(37,99,235,0.25);
}
.dashboard-greeting p, .dashboard-greeting h2 { color: #fff; }
.dashboard-greeting .text-muted { color: rgba(255,255,255,0.85) !important; }
.dashboard-greeting .btn-ghost { background: rgba(255,255,255,0.18); color: #fff; }

.icon-blue   { background: #eff6ff; color: var(--color-primary); }
.icon-green  { background: #ecfdf5; color: var(--color-success); }
.icon-orange { background: #fff7ed; color: var(--color-warning); }
.icon-red    { background: #fef2f2; color: var(--color-danger); }
[data-theme="dark"] .icon-blue { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .icon-green { background: rgba(34,197,94,0.15); }
[data-theme="dark"] .icon-orange { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .icon-red { background: rgba(239,68,68,0.15); }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  border: none; font-weight: 600; font-size: 14.5px;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.75; cursor: default; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 6px 16px rgba(37,99,235,0.38); transform: translateY(-1px); }
.btn-success { background: var(--color-success); color: #fff; box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.btn-success:hover { background: var(--color-success-dark); box-shadow: 0 6px 16px rgba(34,197,94,0.38); transform: translateY(-1px); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--color-primary); border: 1.5px solid var(--color-primary); }
.btn-outline:hover { background: #eff6ff; }
[data-theme="dark"] .btn-outline:hover { background: rgba(37,99,235,0.15); }
.btn-ghost { background: var(--color-gray-100); color: var(--text-main); }
.btn-ghost:hover { background: var(--color-gray-200); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color); background: var(--bg-elevated);
  color: var(--text-main); font-size: 15px; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.search-box { position: relative; margin-bottom: 16px; }
.search-box input {
  width: 100%; padding: 13px 14px 13px 42px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-color); background: var(--bg-elevated); color: var(--text-main); font-size: 15px;
}
.search-box .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: 0.5; }

/* ---------- Rozetler ---------- */
.badge {
  display: inline-block; padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700;
}
.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-green  { background: #ecfdf5; color: #16a34a; }
.badge-orange { background: #fff7ed; color: #d97706; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-gray   { background: var(--color-gray-100); color: var(--text-muted); }
[data-theme="dark"] .badge-blue { background: rgba(37,99,235,0.18); }
[data-theme="dark"] .badge-green { background: rgba(34,197,94,0.18); }
[data-theme="dark"] .badge-orange { background: rgba(245,158,11,0.18); }
[data-theme="dark"] .badge-purple { background: rgba(124,58,237,0.18); }
[data-theme="dark"] .badge-red { background: rgba(239,68,68,0.18); }

/* ---------- Stok durum renkleri ---------- */
.stock-ok { color: var(--color-success); font-weight: 700; }
.stock-low { color: var(--color-warning); font-weight: 700; }
.stock-critical { color: var(--color-danger); font-weight: 700; }
.stock-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.stock-dot.ok { background: var(--color-success); }
.stock-dot.low { background: var(--color-warning); }
.stock-dot.critical { background: var(--color-danger); }

/* ---------- Liste satırı ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.list-item:active { transform: scale(0.99); }
a.list-item:hover { box-shadow: var(--shadow-md); border-color: transparent; transform: translateY(-1px); }
.list-item .avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 17px;
}
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-title { font-weight: 700; font-size: 15px; margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .item-sub { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---------- Mobil alt menü ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--bg-card); border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(15,23,42,0.06);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--text-muted); font-weight: 600;
  padding: 4px 8px; border-radius: 12px; transition: color var(--transition);
  position: relative;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--color-primary); }
.nav-badge {
  position: absolute; top: -2px; right: 2px; background: var(--color-danger); color: #fff;
  font-size: 9.5px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  box-shadow: 0 0 0 2px var(--bg-card);
}
.bottom-nav .nav-fab {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; margin-top: -26px; box-shadow: 0 8px 20px rgba(34,197,94,0.4);
  transition: transform var(--transition);
}
.bottom-nav .nav-fab:active { transform: scale(0.92); }

/* ---------- Popup / Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px); display: none; align-items: flex-end;
  justify-content: center; z-index: 100; animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--bg-card); width: 100%; max-width: 480px;
  border-radius: 24px 24px 0 0; padding: 22px; max-height: 88vh; overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.16,1,0.3,1);
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-box { border-radius: var(--radius-lg); }
}
.modal-handle { width: 40px; height: 5px; background: var(--color-gray-300); border-radius: 10px; margin: 0 auto 16px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--color-gray-100); border: none; display: flex; align-items: center; justify-content: center; }

/* ---------- Progress / Takip ---------- */
.tracking-progress { position: relative; padding: 8px 0; }
.track-step { display: flex; gap: 14px; position: relative; padding-bottom: 28px; }
.track-step:last-child { padding-bottom: 0; }
.track-step .track-dot {
  width: 32px; height: 32px; border-radius: 50%; background: var(--color-gray-200);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 2;
  transition: background var(--transition), transform var(--transition);
}
.track-step.done .track-dot { background: var(--color-success); color: #fff; animation: pop 0.35s ease; }
.track-step.current .track-dot { background: var(--color-primary); color: #fff; animation: pulse 1.6s infinite; }
.track-step .track-line {
  position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--color-gray-200);
}
.track-step.done .track-line { background: var(--color-success); }
.track-step .track-title { font-weight: 700; font-size: 14.5px; }
.track-step .track-time { font-size: 12px; color: var(--text-muted); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at top, #eff6ff, var(--bg-body) 60%);
}
[data-theme="dark"] .login-wrap { background: radial-gradient(circle at top, #16213a, var(--bg-body) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px 26px; box-shadow: var(--shadow-lg); animation: fadeUp 0.5s ease; }
.login-logo { width: 68px; height: 68px; border-radius: 20px; background: var(--brand-gradient); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; color: #fff; font-size: 30px; box-shadow: 0 10px 24px rgba(37,99,235,0.3); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 12px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.5; }

.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--border-color);
  background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition);
}
.theme-toggle:active { transform: rotate(20deg) scale(0.9); }

.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; background: var(--bg-card); border: 1px solid var(--border-color);
}
.pagination a.active, .pagination span.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; width: calc(100% - 32px); max-width: 420px; }
.toast { padding: 14px 18px; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: 14px; margin-bottom: 8px; box-shadow: var(--shadow-md); animation: fadeUp 0.3s ease; }
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
.toast.info { background: var(--color-primary); }

.chip-group { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.chip-group::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  background: var(--bg-card); border: 1.5px solid var(--border-color); color: var(--text-muted); transition: all var(--transition);
}
.chip:hover { border-color: var(--color-primary-light); color: var(--color-primary); }
.chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); box-shadow: 0 4px 10px rgba(37,99,235,0.3); }

.qty-control { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--border-color); background: var(--bg-elevated); font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qty-value { min-width: 30px; text-align: center; font-weight: 700; }

/* ---------- Sekme Çubuğu (Siparişler / Talepler geçişi) ---------- */
.tab-bar {
  display: flex; gap: 6px; background: var(--color-gray-100); padding: 5px;
  border-radius: var(--radius-pill); margin-bottom: 16px;
}
.tab-bar a {
  flex: 1; text-align: center; padding: 10px 8px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 700; color: var(--text-muted); transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab-bar a.active { background: var(--bg-card); color: var(--color-primary); box-shadow: var(--shadow-sm); }
.tab-bar .tab-count {
  background: var(--color-danger); color: #fff; font-size: 10.5px; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- Hızlı İletişim Butonları ---------- */
.quick-actions { display: flex; gap: 8px; }
.quick-actions a {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  border: 1.5px solid var(--border-color); background: var(--bg-elevated);
  transition: transform var(--transition);
}
.quick-actions a:active { transform: scale(0.9); }
.quick-actions a.qa-call { background: #eff6ff; border-color: transparent; }
.quick-actions a.qa-whatsapp { background: #ecfdf5; border-color: transparent; }
[data-theme="dark"] .quick-actions a.qa-call { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .quick-actions a.qa-whatsapp { background: rgba(34,197,94,0.15); }

/* ---------- Bekleme süresi uyarı rozeti ---------- */
.aging-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: var(--radius-pill); background: #fff7ed; color: #d97706;
}
[data-theme="dark"] .aging-badge { background: rgba(245,158,11,0.15); }
.aging-badge.urgent { background: #fef2f2; color: #dc2626; }
[data-theme="dark"] .aging-badge.urgent { background: rgba(239,68,68,0.15); }

/* Dashboard istatistik kartları artık link olabiliyor */
a.stat-card { display: block; }
a.stat-card:active { transform: scale(0.97); }

/* ---------- Animasyonlar ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); } 70% { box-shadow: 0 0 0 10px rgba(37,99,235,0); } 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

@media (min-width: 640px) {
  .app-container { padding: 24px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
