/* =============================================
   BFL'Y Portal — portal.css
   Renkler ve yazı tipleri ana siteden (bflyuav.com)
   ============================================= */

:root {
  --bg:          #0D1117;
  --bg-card:     #111827;
  --bg-dark:     #080D13;
  --bg-raised:   #162033;
  --brand:       #182a47;
  --brand-mid:   #1e3a63;
  --text:        #F0F0F5;
  --text-muted:  #8899BB;
  --accent:      #4A9ECC;
  --accent-dim:  #2d7aaa;
  --accent-glow: rgba(74, 158, 204, 0.35);
  --border-dim:    rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --ok:     #3FB27F;
  --warn:   #E0A33A;
  --danger: #E5534B;

  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-pill: 999px;
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);

  --nav-height: 64px;
  --max-width:  1100px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

/* ===== TEMEL ===== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  line-height: 1.25;
}
h2 { font-size: 1rem; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px 72px;
}

.page-head { margin: 28px 0 22px; }
.page-title { font-size: clamp(1.25rem, 3vw, 1.7rem); }
.page-sub { margin: 6px 0 0; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.pre { white-space: pre-line; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }

/* Sayfa verisi gelene kadar */
body.is-loading .container { opacity: 0; }
body.is-loading::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ÜST MENÜ ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: rgba(8, 13, 19, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-dim);
}
.topbar-inner {
  max-width: var(--max-width);
  height: var(--nav-height);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { color: var(--accent); }

.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a, .nav button {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.nav a:hover, .nav button:hover { color: var(--text); background: var(--bg-card); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--brand); }
.nav .nav-sep { width: 1px; margin: 6px 4px; background: var(--border-strong); }
.nav .nav-logout { display: none; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dim);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); text-decoration: none; }
.icon-btn.active { background: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.bell-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-btn { display: none; }

@media (max-width: 1120px) {
  .menu-btn { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px 16px 16px;
    flex-direction: column;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-dim);
    box-shadow: var(--shadow-md);
  }
  .nav.open { display: flex; }
  .nav a, .nav button { padding: 12px; font-size: 1rem; }
  .nav .nav-sep { width: auto; height: 1px; margin: 6px 0; }
  .nav .nav-logout { display: block; color: var(--danger); }
}

/* ===== BUTONLAR ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: #62b8e0; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-ok { background: var(--ok); color: #06140d; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(229, 83, 75, 0.5); }
.btn-danger:hover:not(:disabled) { background: rgba(229, 83, 75, 0.1); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 0.62rem; }
.btn-block { width: 100%; }

/* ===== FORMLAR ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* iOS'ta odaklanınca yakınlaştırmasın */
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { min-height: 90px; resize: vertical; }
select.inline, input.inline { width: auto; max-width: 100%; }
.row > .grow { flex: 1 1 200px; width: auto; min-width: 0; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 12px;
}

.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { border-color: var(--accent); background: rgba(74, 158, 204, 0.12); }

.form-error { color: var(--danger); font-size: 0.85rem; margin: 0 0 12px; }

/* ===== KARTLAR / LİSTELER ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title {
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
details.card > summary { margin: 0; cursor: pointer; }
details.card[open] > summary { margin-bottom: 16px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}
.cards .card + .card { margin-top: 0; }
@media (max-width: 480px) {
  .card { padding: 16px; }
}

.stat { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-row { display: flex; flex-wrap: wrap; gap: 24px; }
.stat-row > div { min-width: 90px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
}
.list-item + .list-item { margin-top: 8px; }
a.list-item:hover, button.list-item:hover { border-color: var(--accent); text-decoration: none; }
button.list-item { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.card .list-item { background: var(--bg-dark); }
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.item-body { margin-top: 6px; color: var(--text-muted); font-size: 0.9rem; white-space: pre-line; }
.is-unread { border-left: 3px solid var(--accent); }
.is-unread .item-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.overdue { color: var(--danger); font-weight: 600; }

.empty {
  padding: 28px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-muted);
}

/* ===== ETİKETLER ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.st-atandi     { color: var(--accent); border-color: rgba(74, 158, 204, 0.5); }
.st-devam      { color: var(--warn); border-color: rgba(224, 163, 58, 0.5); }
.st-tamamlandi { color: var(--ok); border-color: rgba(63, 178, 127, 0.5); }
.st-iptal      { color: var(--text-muted); text-decoration: line-through; }
.st-onay_bekliyor { color: #B79CFF; border-color: rgba(183, 156, 255, 0.5); }
.chip-grade  { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.04); }
.chip-leader { color: #B79CFF; border-color: rgba(183, 156, 255, 0.5); }
.pr-acil   { background: var(--danger); border-color: transparent; color: #fff; }
.pr-yuksek { color: var(--danger); border-color: rgba(229, 83, 75, 0.5); }
.pr-dusuk  { opacity: 0.7; }
.chip-admin { color: var(--warn); border-color: rgba(224, 163, 58, 0.5); }
.chip-off   { color: var(--danger); border-color: rgba(229, 83, 75, 0.5); }
.chip-ok    { color: var(--ok); border-color: rgba(63, 178, 127, 0.5); }

/* ===== BİLGİ KUTULARI ===== */
.notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(74, 158, 204, 0.4);
  border-radius: var(--radius-md);
  background: rgba(74, 158, 204, 0.08);
}
.notice.warn  { border-color: rgba(224, 163, 58, 0.5); background: rgba(224, 163, 58, 0.08); }
.notice.error { border-color: rgba(229, 83, 75, 0.5); background: rgba(229, 83, 75, 0.08); }
.notice.ok    { border-color: rgba(63, 178, 127, 0.5); background: rgba(63, 178, 127, 0.08); }
.notice ol, .notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice > :last-child { margin-bottom: 0; }

.secret-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

/* ===== SEKMELER / ARAÇ ÇUBUĞU ===== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-dim);
  overflow-x: auto;
}
.tab {
  margin-bottom: -1px;
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:disabled { opacity: 0.4; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.active { background: var(--brand); color: var(--text); }

.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label {
  min-width: 150px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ===== MÜSAİTLİK IZGARASI ===== */
/* Not: .av-wrap'e overflow verilmemeli; verilirse yapışkan gün başlıkları bozulur */
.av-grid {
  display: grid;
  grid-template-columns: 40px repeat(7, minmax(0, 1fr));
  column-gap: 3px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.av-day {
  position: sticky;
  top: calc(var(--nav-height) + env(safe-area-inset-top));
  z-index: 2;
  padding: 6px 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.av-day small { display: block; font-size: 0.64rem; font-weight: 400; }
.av-day.is-clickable { cursor: pointer; }
.av-day.is-clickable:hover { color: var(--accent); }
.av-day.is-today { color: var(--accent); }
.av-time {
  padding-right: 6px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1;
  transform: translateY(-4px);
}
.av-cell {
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.045);
  margin-bottom: 2px;
  display: block;
  width: 100%;
}
.av-cell.is-hour { margin-top: 3px; }
.is-editable .av-cell { cursor: pointer; }
.is-editable .av-cell:hover { background: rgba(74, 158, 204, 0.3); }
.av-cell.is-on, .is-editable .av-cell.is-on:hover { background: var(--accent); }
.av-cell:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

/* Isı haritası seviyeleri */
.lv-1 { background: rgba(74, 158, 204, 0.18) !important; }
.lv-2 { background: rgba(74, 158, 204, 0.36) !important; }
.lv-3 { background: rgba(74, 158, 204, 0.56) !important; }
.lv-4 { background: rgba(74, 158, 204, 0.78) !important; }
.lv-5 { background: var(--accent) !important; }
.av-cell.is-picked { outline: 2px solid var(--text); outline-offset: -2px; }
.is-heat .av-cell { cursor: pointer; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.75rem; }
.legend i { display: inline-block; width: 18px; height: 12px; border-radius: 2px; background: rgba(255, 255, 255, 0.045); }

.range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.range-form .field { margin: 0; min-width: 110px; flex: 1; }

.day-lines { margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.85rem; }
.day-lines li { display: flex; gap: 10px; }
.day-lines b { min-width: 36px; color: var(--text-muted); font-weight: 600; }

/* ===== ZAMAN ÇİZELGESİ (LOG) ===== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  margin-left: 6px;
  padding: 0 0 18px 22px;
  border-left: 2px solid var(--border-strong);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  top: 4px;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg-card);
}
.timeline li.ev-durum::before { border-color: var(--warn); }
.timeline li.ev-yorum::before { border-color: var(--text-muted); }
.t-time { color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.t-text { margin-top: 2px; }
.t-note {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-item { display: grid; grid-template-columns: 170px 1fr; gap: 4px 16px; }
.log-time { color: var(--text-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .log-item { grid-template-columns: 1fr; }
}

/* ===== FOTOĞRAFLAR ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.photo-grid a {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-dark);
  border: 1px solid var(--border-dim);
}
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid > p { grid-column: 1 / -1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== YETKİ SATIRLARI ===== */
.perm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-dim);
}
.perm-row:last-child { border-bottom: none; }
.perm-row .seg button { padding: 6px 10px; font-size: 0.8rem; }
.perm-state { font-size: 0.78rem; }
.perm-state.yes { color: var(--ok); }
.perm-state.no  { color: var(--danger); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-dim);
}
.switch-row:last-child { border-bottom: none; }
.switch-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
input[type=number], input[type=time] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.help h2 { margin-top: 8px; }
.help ul { padding-left: 20px; }
.help li { margin: 6px 0; }

/* ===== BİLDİRİM BALONLARI ===== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s var(--ease-out);
}
.toast.error { border-left-color: var(--danger); }
.toast.ok    { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ===== GİRİŞ SAYFASI ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at top, rgba(30, 58, 99, 0.55), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: block; height: 64px; width: auto; margin: 0 auto 14px; }
.auth-eyebrow {
  margin: 0 0 22px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-align: center;
}
