/* ==========================================================================
   Hanturk Danışman Takip — marka tasarım sistemi
   Renkler referans panel görselinden örneklenmiştir (SPEC.md §7).
   ========================================================================== */

:root {
  /* Marka */
  --brand: #D91A45;
  --brand-dark: #B31438;
  --brand-tint: #FCF4F5;
  --brand-ring: rgba(217, 26, 69, .25);

  /* Zemin ve yüzeyler — referans görselden ölçülen yatay gradyan */
  --bg: #FCF5F3;
  --bg-from: #FDF7EE;
  --bg-to: #FBF3F7;
  --surface: #FFFFFF;
  --surface-muted: #F5F6F7;
  --border: #E3E4E8;

  /* Metin */
  --text: #202A3C;
  --text-muted: #6B7280;
  --text-on-brand: #FFFFFF;

  /* Randevu durumları — marka kırmızısı yalnızca aksiyona ayrılır */
  --st-planned: #1D4ED8;   --st-planned-bg: #EEF3FF;
  --st-completed: #15803D; --st-completed-bg: #ECFAF0;
  --st-postponed: #B45309;   --st-postponed-bg: #FEF6E7;
  --st-no-show: #9F1239;     --st-no-show-bg: #FDECF1;
  --st-cancelled: #6B7280;       --st-cancelled-bg: #F3F4F6;

  /* Ölçüler */
  --radius: 12px;
  --radius-sm: 10px;
  /* Buton ve menü öğesi yarıçapı: referans görselde yüksekliğin ~%25'i (≈10px) */
  --radius-btn: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --nav-h: 64px;

  /* Bootstrap köprüsü */
  --bs-primary: var(--brand);
  --bs-primary-rgb: 217, 26, 69;
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-dark);
  --bs-body-color: var(--text);
  /* Bootstrap bileşenleri (tablo, form, dropdown, modal) yüzey rengini bundan alır;
     sayfa zemini gradyanı body üzerinde ayrıca tanımlıdır. */
  --bs-body-bg: var(--surface);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-sm);
  --bs-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Temel --------------------------------------------------------------- */
body {
  background-color: var(--bg);
  background-image: linear-gradient(to right, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--bs-font-sans-serif);
  font-size: .9375rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .fw-semibold { font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
.text-muted-2 { color: var(--text-muted) !important; }
.num { font-variant-numeric: tabular-nums; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

:focus-visible,
.form-control:focus,
.form-select:focus,
.btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem var(--brand-ring);
}

/* --- Üst menü ----------------------------------------------------------- */
.app-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-nav .brand-logo { height: 34px; width: auto; display: block; }

.nav-pills-app { gap: .25rem; }

.nav-pills-app .nav-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .95rem;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

.nav-pills-app .nav-link i { font-size: 1.05rem; line-height: 1; }

.nav-pills-app .nav-link:hover {
  background: var(--brand-tint);
  color: var(--brand);
}

.nav-pills-app .nav-link.active {
  background: var(--brand);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-sm);
}

/* Bildirim zili — v1'de eksik gün / bekleyen iş sayacı */
/* Bildirim zili — ikon 2026-09-15'te menüden kaldırıldı, stil ileride
   bildirim altyapısı kurgulanınca yeniden kullanılmak üzere duruyor. */
.bell {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  border: 0;
}
.bell:hover { background: var(--surface-muted); }
.bell i { font-size: 1.2rem; }
.bell .badge-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .6875rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

/* Kullanıcı çipi */
.user-chip { display: inline-flex; align-items: center; gap: .625rem; }
.user-chip .u-name { font-weight: 600; line-height: 1.15; font-size: .875rem; }
.user-chip .u-role {
  display: inline-block;
  font-size: .6875rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: 8px;
  padding: .05rem .45rem;
  margin-top: .15rem;
}
.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: .8125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
}

/* --- Butonlar ----------------------------------------------------------- */
.btn { border-radius: var(--radius-btn); font-weight: 500; }

.btn-brand {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: var(--text-on-brand);
}
.btn-brand:hover, .btn-brand:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }

/* Yıkıcı aksiyon (superuser silme) — birincil kırmızıyla karışmasın */
.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--st-no-show);
  color: var(--st-no-show);
}
.btn-danger-outline:hover { background: var(--st-no-show-bg); color: var(--st-no-show); }


/* --- Kartlar ve tablolar ------------------------------------------------ */
.card-app {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-app > .card-app-head {
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.card-app > .card-app-body { padding: 1.125rem; }

.table-app { margin: 0; --bs-table-bg: var(--surface); }
.table-app > thead > tr > th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-app > tbody > tr > td { border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-app > tbody > tr:hover > td { background: var(--brand-tint); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* Kart ve tablo içindeki bağlantılar metin renginde durur, hover'da markaya döner.
   Marka kırmızısı böylece aksiyonlara ayrılmış kalır. */
.table-app a:not(.btn),
.card-app a:not(.btn) { color: var(--text); }
.table-app a:not(.btn):hover,
.card-app a:not(.btn):hover { color: var(--brand); text-decoration: underline; }

/* --- Durum etiketleri --------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.chip-planned   { color: var(--st-planned);   background: var(--st-planned-bg); }
.chip-completed { color: var(--st-completed); background: var(--st-completed-bg); }
.chip-postponed   { color: var(--st-postponed);   background: var(--st-postponed-bg); }
.chip-no-show     { color: var(--st-no-show);     background: var(--st-no-show-bg); }
.chip-cancelled       { color: var(--st-cancelled);       background: var(--st-cancelled-bg); }

/* --- Uyarı şeridi (randevusuz gün) ------------------------------------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.notice-warn { border-color: #F3DDB4; background: var(--st-postponed-bg); color: #7A3D05; }
.notice-warn i { color: var(--st-postponed); font-size: 1.15rem; }

/* --- Mobil hızlı aksiyon çubuğu ---------------------------------------- */
.quickbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1035;
  gap: .5rem;
  padding: .625rem .75rem calc(.625rem + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .06);
}
.quickbar .btn { flex: 1; }

@media (max-width: 991.98px) {
  .quickbar { display: flex; }
  body { padding-bottom: 78px; }
  .app-nav .brand-logo { height: 28px; }
  .nav-pills-app .nav-link { padding: .55rem .85rem; }
}

/* Dar ekranlarda en az 16px yan boşluk */
@media (max-width: 575.98px) {
  .container-xxl { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 400px) {
  body { font-size: .9rem; }
  .user-chip .u-name, .user-chip .u-role { display: none; }
}

/* Kullanıcı çipi dropdown tetikleyicisi */
.dropdown-toggle-no-caret::after { display: none !important; }
.dropdown-toggle-no-caret,
.dropdown-toggle-no-caret:hover,
.dropdown-toggle-no-caret:focus { color: var(--text); text-decoration: none; }

/* Henüz bağlanmamış / devre dışı butonlar belirgin şekilde pasif görünür */
.btn.disabled, .btn:disabled, fieldset:disabled .btn {
  opacity: .5;
  pointer-events: none;
}

/* Takvimde bugünün kartı */
.day-today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); }
.day-today > .card-app-head { background: var(--brand-tint); }

/* Haftalık takvim ızgarası: mobilde tek, tablette iki, geniş ekranda yedi sütun */
.week-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1320px) {
  .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
  .week-grid .card-app-head { padding: .625rem .75rem; }
  .week-grid .card-app-body { padding: .625rem .75rem; }
  .week-grid .btn-sm { padding: .2rem .35rem; font-size: .75rem; }
}

/* Dar sütunlarda gün başlığı ve etiketler taşmaz, alt satıra iner */
.week-grid .card-app-head {
  flex-wrap: wrap;
  row-gap: .25rem;
  gap: .5rem;
}
.week-grid .chip {
  font-size: .6875rem;
  padding: .1rem .45rem;
}

/* --- Ana ekran: hafta şeridi ------------------------------------------- */
.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .25rem;
}
.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .4rem .2rem;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}
.day-chip:hover { background: var(--brand-tint); color: var(--brand); }
.day-chip .d-name { font-size: .6875rem; text-transform: uppercase; letter-spacing: .02em; }
.day-chip .d-num { font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.day-chip .d-mark { font-size: .75rem; min-height: 1.1em; }
.day-chip .d-mark .missing { color: var(--st-postponed); }
.day-chip.today { border-color: var(--border); background: var(--surface-muted); }
.day-chip.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.day-chip.selected .d-num,
.day-chip.selected .d-mark,
.day-chip.selected .d-mark .missing { color: #fff; }

/* --- Ana ekran: sütun listeleri ---------------------------------------- */
.quick-form { background: var(--surface-muted); border-bottom: 1px solid var(--border); }
.quick-form .form-control,
.quick-form .form-select { background: var(--surface); }

.extra-fields > summary {
  cursor: pointer;
  color: var(--brand);
  list-style: none;
}
.extra-fields > summary::-webkit-details-marker { display: none; }
.extra-fields > summary::before { content: "＋ "; }
.extra-fields[open] > summary::before { content: "− "; }

.day-list { max-height: 520px; overflow-y: auto; }
.day-row {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .625rem 1.125rem;
  border-bottom: 1px solid var(--border);
}
.day-row:last-child { border-bottom: 0; }
.day-row:hover { background: var(--brand-tint); }
.day-row .time { min-width: 42px; }
.day-row .toggle-btn { font-size: 1.15rem; line-height: 1; }

/* --- Rapor merkezi kartları -------------------------------------------- */
.report-card { color: var(--text); transition: border-color .15s ease, box-shadow .15s ease; }
.report-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); color: var(--text); }
.report-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-btn);
  background: var(--brand-tint);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.table-app.table-sm > tbody > tr > td { padding: .35rem .5rem; font-size: .8125rem; }
.table-app.table-sm > thead > tr > th { padding: .4rem .5rem; }

/* --- Randevu sonuçlandırma (satır içi) --------------------------------- */
.resolve-actions { display: flex; flex-wrap: wrap; gap: .25rem; }
.btn-resolve {
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .75rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-btn);
}
.btn-resolve i { font-size: .85rem; }
.btn-resolve.chip-completed { color: var(--st-completed); background: var(--st-completed-bg); }
.btn-resolve.chip-no-show   { color: var(--st-no-show);   background: var(--st-no-show-bg); }
.btn-resolve.chip-postponed { color: var(--st-postponed); background: var(--st-postponed-bg); }
.btn-resolve.chip-cancelled { color: var(--st-cancelled); background: var(--st-cancelled-bg); }
.btn-resolve:hover { border-color: currentColor; }
.btn-resolve::before { content: none; }

.resolve-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .625rem;
}

/* Kare, küçük simge butonu (ör. satırdaki "Durumu değiştir") */
.btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  line-height: 1;
  color: var(--text-muted);
}
.btn-icon-sm:hover { color: var(--brand); border-color: var(--brand); }
