/* ============================================================
   Efem Ticaret — Common Stylesheet
   Unified design tokens, fonts, and UI primitives.
   Each page can still add its own page-specific rules in <style>.
   ============================================================ */

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

/* ---- Design Tokens ---- */
:root {
  /* Surfaces */
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --white:     #ffffff;
  --gray-bg:   #f3f4f6;

  /* Borders */
  --border:    #e0e4e9;
  --border2:   #cdd2d9;

  /* Text */
  --text:      #1a2744;
  --text2:     #5a6478;
  --text3:     #8a9099;
  --text4:     #b0b6bf;
  --muted:     #8a9099;

  /* Brand */
  --red:        #E3000B;
  --red-dark:   #c0031b;
  --red-soft:   #fff1f1;
  --red-border: #fcc;
  --accent:     #E3000B;     /* alias for legacy rules */
  --accent-bg:  #fff1f1;     /* alias */

  /* States */
  --green:        #16a34a;
  --green-bg:     #f0fdf4;
  --green-soft:   #ecfdf5;
  --green-border: #bbf7d0;

  --blue:         #2563eb;
  --blue-bg:      #eff6ff;
  --blue-soft:    #eff6ff;
  --blue-border:  #bfdbfe;

  --amber:        #d97706;
  --amber-bg:     #fef3c7;
  --amber-soft:   #fffbeb;
  --amber-border: #fde68a;

  --purple:       #7c3aed;
  --purple-bg:    #f5f3ff;

  --orange:       #ea580c;
  --orange-bg:    #fff7ed;

  /* Misc */
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* ---- Body / Typography ---- */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Top bar / Nav (System B style — used as canonical) ---- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo { font-size: 19px; font-weight: 700; letter-spacing: -.3px; color: var(--text); }
.topbar-logo span { color: var(--red); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.home-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px 0 6px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text2);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.home-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.home-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Legacy navbar / back-btn (System A) ---- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.back-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--text3);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: none; border: none; cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.back-btn:hover { background: var(--bg); color: var(--text); }
.back-btn svg { width: 14px; height: 14px; }
.nav-sep { width: 1px; height: 20px; background: var(--border); }
.nav-divider { width: 1px; height: 20px; background: var(--border); }
.logo { font-weight: 700; font-size: 18px; color: var(--red); letter-spacing: -.3px; }
.logo-name { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.logo-name span { color: var(--red); }
.nav-title { font-size: 14px; font-weight: 500; color: var(--text); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-user { font-size: 12px; color: var(--text3); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px; font-weight: 500;
  transition: all .12s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--bg); border-color: var(--border2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 12px; height: 12px; }
.btn-p, .btn-primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-p:hover, .btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-g { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.btn-g:hover { background: #dcfce7; }
.btn-b { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }
.btn-b:hover { background: #dbeafe; }
.btn-block { width: 100%; justify-content: center; padding: 11px 14px; font-size: 13px; font-weight: 600; }
.btn-sm { padding: 5px 9px; font-size: 11px; }

/* Icon button (compact action buttons in tables) */
.ib {
  width: 28px; height: 28px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  color: var(--text3);
}
.ib:hover { border-color: var(--border2); color: var(--text); background: #f9fafb; }
.ib.del:hover { color: var(--red); border-color: var(--red-border); background: var(--red-soft); }
.ib svg { width: 13px; height: 13px; }

/* ---- Form inputs ---- */
label {
  font-size: 10px; font-weight: 700; color: var(--text3);
  display: block; margin-bottom: 3px;
  text-transform: uppercase; letter-spacing: .4px;
}
.form-input, input.form-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,0,11,.08); }
.form-input::placeholder { color: var(--text4); }

/* ---- Search ---- */
.search-wrap, .srch { position: relative; }
.search-wrap svg.s-icon, .srch svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text4);
  pointer-events: none;
}
.search-input, .srch input {
  width: 100%;
  padding: 9px 12px 9px 30px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .2s;
}
.search-input:focus, .srch input:focus { border-color: var(--red); }
.search-input::placeholder { color: var(--text4); }
.search-clear {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border: none; background: transparent;
  border-radius: 4px;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  color: var(--text3);
}
.search-clear:hover { background: var(--bg); color: var(--red); }
.search-clear.visible { display: flex; }
.search-clear svg { width: 12px; height: 12px; }
.search-info { font-size: 11px; color: var(--text3); font-weight: 500; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.05); }

/* ---- Pills / Badges ---- */
.pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  display: inline-block;
}
.pill-live   { background: var(--green-bg); color: var(--green); }
.pill-err    { background: var(--red-soft); color: var(--red); }
.pill-cached { background: #fef9c3; color: #854d0e; }
.pill-admin  { background: #fef3c7; color: #92400e; }

/* ---- Modal ---- */
.modal-bg, .overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 500;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-bg.active, .modal-bg.show, .overlay.open, .overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal-title {
  font-size: 15px; font-weight: 700;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.modal-acts {
  display: flex; gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.modal-status {
  margin-top: 10px;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 7px;
  display: none;
}
.modal-status.ok  { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.modal-status.err { background: var(--red-soft); border: 1px solid #fca5a5; color: var(--red); }
.modal-note {
  font-size: 11px; color: var(--text3);
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--blue-bg);
  border-radius: 7px;
  border-left: 3px solid var(--blue);
  line-height: 1.5;
}
.mform { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.mform .full { grid-column: span 2; }

/* ---- Toast ---- */
.toast-wrap {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 700;
  display: flex; flex-direction: column; gap: 6px;
}
.toast {
  position: fixed; bottom: 18px; right: 18px;
  background: #1f2937;
  color: #f9fafb;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transform: translateY(60px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 100;
  max-width: 300px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.out  { opacity: 0; transform: translateX(20px); transition: all .25s; }

/* ---- Tables (common base) ---- */
tbody tr:hover { background: #fafbfc; }
.r-name { font-weight: 600; color: var(--text); }
.act-btns { display: flex; gap: 3px; }

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }
