/* ============================================================
   Elif Farm — Ana Stil Sistemi
   Referans: Stok Takip uygulamasının koyu teması
   ============================================================ */

/* ── Değişkenler ──────────────────────────────────────────── */
:root {
  --bg-base:       #0a0a0a;
  --bg-card:       #161616;
  --bg-card2:      #1c1c1c;
  --bg-input:      #222222;
  --bg-hover:      rgba(255,255,255,0.04);

  --border:        rgba(255,255,255,0.08);
  --border-active: rgba(255,255,255,0.18);
  --border-focus:  rgba(232,160,32,0.5);
  --separator:     rgba(255,255,255,0.05);

  --accent:        #e8a020;
  --accent-dim:    rgba(232,160,32,0.15);
  --accent-dark:   #c47f0a;

  --text-primary:   #f0f0f0;
  --text-secondary: #888888;
  --text-muted:     #555555;

  --green:     #2ecc71;
  --green-bg:  rgba(46,204,113,0.12);
  --orange:    #e8a020;
  --orange-bg: rgba(232,160,32,0.13);
  --red:       #e74c3c;
  --red-bg:    rgba(231,76,60,0.12);
  --blue:      #3b82f6;
  --blue-bg:   rgba(59,130,246,0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ── Layout ───────────────────────────────────────────────── */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px; /* bottom nav için */
}

/* ── App Header ───────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.app-logo__icon {
  width: 30px; height: 30px;
  background: var(--accent-dim);
  border: 0.5px solid var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.app-logo__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.date-badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
}

/* ── Tab Bar (üst) ────────────────────────────────────────── */
.tab-bar {
  display: flex;
  padding: 12px 16px 0;
  border-bottom: 0.5px solid var(--separator);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 2px;
  position: sticky;
  top: 52px;
  background: var(--bg-base);
  z-index: 99;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  padding: 0 4px 10px;
  min-width: 56px;
  text-align: center;
  position: relative;
  border: none;
  background: none;
  transition: color 0.15s;
}

.tab-item.active {
  color: var(--accent);
  font-weight: 500;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -0.5px;
  left: 15%; right: 15%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ── Bölüm Başlığı ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 20px;
}

.section-header:first-child { margin-top: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.dot-warn { background: var(--orange); }
.dot-alert { background: var(--red); }

/* ── Kart ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  overflow: hidden;
  margin-bottom: 12px;
}

.card-body { padding: 14px 16px; }

/* ── Tablo ────────────────────────────────────────────────── */
.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  overflow: hidden;
}

.table-head {
  display: flex;
  padding: 7px 14px;
  border-bottom: 0.5px solid var(--border);
}

.table-head span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.table-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--separator);
  transition: background 0.1s;
}
.table-row:last-child { border-bottom: none; }
.table-row:active { background: var(--bg-hover); }
.table-row.clickable { cursor: pointer; }
.table-row.total-row {
  background: rgba(255,255,255,0.02);
}

/* ── Metrik Kartlar ───────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric-value.green  { color: var(--green); }
.metric-value.orange { color: var(--orange); }
.metric-value.red    { color: var(--red); }
.metric-value.muted  { color: var(--text-secondary); }

.metric-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Badge'ler ────────────────────────────────────────────── */
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge--ok     { background: var(--green-bg);  color: var(--green); }
.badge--warn   { background: var(--orange-bg); color: var(--orange); }
.badge--alert  { background: var(--red-bg);    color: var(--red); }
.badge--info   { background: var(--blue-bg);   color: var(--blue); }
.badge--muted  { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.cat-badge {
  font-size: 12px;
  font-weight: 500;
}

/* ── Form Elemanları ──────────────────────────────────────── */
.ef-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.ef-input, .ef-select, .ef-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.ef-input:focus, .ef-select:focus, .ef-textarea:focus {
  border-color: var(--border-focus);
}

.ef-input::placeholder, .ef-textarea::placeholder {
  color: var(--text-muted);
}

.ef-input.error { border-color: var(--red); }

.ef-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.ef-textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* ── Butonlar ─────────────────────────────────────────────── */
.ef-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  padding: 12px 16px;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.ef-btn:active { transform: scale(0.97); }
.ef-btn:disabled { opacity: 0.4; pointer-events: none; }

.ef-btn--primary {
  background: var(--accent);
  color: #000;
  border-color: transparent;
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.ef-btn--secondary {
  background: transparent;
  color: var(--text-secondary);
  width: 100%;
  padding: 12px;
}

.ef-btn--danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(231,76,60,0.2);
}

.ef-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.ef-btn--icon {
  background: var(--bg-card2);
  border-color: var(--border);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

/* ── Toast ────────────────────────────────────────────────── */
.ef-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card2);
  border: 0.5px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  max-width: 300px;
  text-align: center;
  pointer-events: none;
}

.ef-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ef-toast--success { border-color: rgba(46,204,113,0.4); color: var(--green); }
.ef-toast--error   { border-color: rgba(231,76,60,0.4);  color: var(--red); }
.ef-toast--warn    { border-color: rgba(232,160,32,0.4); color: var(--orange); }

/* ── Loading ──────────────────────────────────────────────── */
#ef-loading {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.ef-loading__box {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ef-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ────────────────────────────────────────────────── */
#ef-confirm, #ef-reason {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 950;
  padding: 16px;
}

.ef-modal {
  background: var(--bg-card);
  border: 0.5px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
}

.ef-modal__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.ef-modal__body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.ef-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.ef-modal #ef-reason-text {
  width: 100%;
  margin-bottom: 0;
}

/* ── Uyarı Bandı ──────────────────────────────────────────── */
.alert-band {
  background: var(--orange-bg);
  border: 0.5px solid rgba(232,160,32,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--orange);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert-band--red {
  background: var(--red-bg);
  border-color: rgba(231,76,60,0.2);
  color: var(--red);
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 0.5px;
  background: var(--separator);
  margin: 16px 0;
}

/* ── Login Sayfası ────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.login-logo__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── iOS Push Banner ──────────────────────────────────────── */
.push-banner {
  background: var(--accent-dim);
  border: 0.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ── Tablet / Desktop ─────────────────────────────────────── */
@media (min-width: 768px) {
  .app-container { max-width: 720px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
}
