/**
 * app.css — Gelir-Gider Defteri üye arayüzü + tanıtım giydirmesi.
 *
 * Kurallar:
 *  - Tüm arayüz stilleri #defter-app kapsamındadır; başka sayfaya sızmaz.
 *  - Tanıtım (promo) sayfası #defter-app taşımadığı için yalnızca
 *    `.dft-mock*` yardımcıları kapsam dışındadır (bu dosya yalnızca bu
 *    uygulamanın sayfalarında yüklenir).
 *  - Renkler panelin verdiği --brand ile uyumludur; gelir/gider renkleri
 *    tema değişkenlerinden (--green, --red) türetilir.
 *  - Mobil önce: temel tek kolon, 720px üzerinde ızgara düzenleri açılır.
 */

/* -------------------------------------------------------------------------
 |  Kapsam ve yerel değişkenler
 * ------------------------------------------------------------------------- */

#defter-app {
  display: block;
  --dft-income: var(--green, #6bd59b);
  --dft-expense: var(--red, #ef6c72);
  --dft-line: var(--line, rgba(255, 255, 255, .1));
  --dft-panel: var(--panel, #181d28);
  --dft-panel-2: var(--panel-2, #1f2531);
  --dft-muted: var(--muted, #8e97a6);
  --dft-text: var(--text, #f3f5f9);
  --dft-radius: 14px;
}

#defter-app *,
#defter-app *::before,
#defter-app *::after {
  box-sizing: border-box;
}

#defter-app :focus-visible {
  outline: 2px solid var(--brand, var(--accent, #efa448));
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 |  Başlık
 * ------------------------------------------------------------------------- */

.dft-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.dft-eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand, var(--accent, #efa448));
}

.dft-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.dft-lead {
  margin: 0;
  max-width: 64ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--dft-muted);
}

.dft-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* -------------------------------------------------------------------------
 |  Durum bildirimi
 * ------------------------------------------------------------------------- */

.dft-status {
  display: block;
  margin: 0 0 16px;
  padding: 11px 14px;
  border: 1px solid var(--dft-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .03);
  font-size: 13px;
  line-height: 1.55;
  color: var(--dft-text);
}

.dft-status:focus {
  outline: none;
}

.dft-status--ok {
  border-color: rgba(107, 213, 155, .4);
  background: rgba(107, 213, 155, .1);
  color: #b9ecd0;
}

.dft-status--error {
  border-color: rgba(239, 108, 114, .42);
  background: rgba(239, 108, 114, .12);
  color: #f7c3c5;
}

.dft-status--info {
  border-color: color-mix(in srgb, var(--brand, #efa448) 40%, transparent);
  background: color-mix(in srgb, var(--brand, #efa448) 10%, transparent);
  color: var(--dft-text);
}

/* -------------------------------------------------------------------------
 |  Özet kartları + kullanım çubuğu
 * ------------------------------------------------------------------------- */

.dft-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.dft-card {
  position: relative;
  padding: 15px 16px 16px;
  border: 1px solid var(--dft-line);
  border-radius: var(--dft-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 60%), var(--dft-panel);
  overflow: hidden;
}

.dft-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--dft-line-strong, rgba(255, 255, 255, .18));
}

.dft-card--income::before { background: var(--dft-income); }
.dft-card--expense::before { background: var(--dft-expense); }
.dft-card--net::before { background: var(--brand, var(--accent, #efa448)); }

.dft-card-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dft-muted);
}

.dft-card-value {
  display: block;
  font-size: clamp(19px, 2.6vw, 24px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.dft-card--income .dft-card-value { color: #a9e7c5; }
.dft-card--expense .dft-card-value { color: #f3b3b6; }
.dft-card-value.is-negative { color: #f3b3b6 !important; }

.dft-usage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
}

.dft-usage-text {
  font-size: 12.5px;
  color: var(--dft-muted);
}

.dft-usage-text b {
  color: var(--dft-text);
  font-variant-numeric: tabular-nums;
}

.dft-usage-bar {
  position: relative;
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}

.dft-usage-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--brand, var(--accent, #efa448));
  transition: width .35s ease;
}

/* -------------------------------------------------------------------------
 |  Paneller
 * ------------------------------------------------------------------------- */

.dft-panel {
  margin-bottom: 20px;
  padding: 18px 16px;
  border: 1px solid var(--dft-line);
  border-radius: var(--dft-radius);
  background: var(--dft-panel);
}

#defter-app .dft-panel[hidden] {
  display: none;
}

.dft-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.dft-panel-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.015em;
}

.dft-panel-head .dft-panel-title {
  margin-bottom: 0;
}

.dft-muted {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--dft-muted);
}

.dft-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--dft-muted);
}

/* -------------------------------------------------------------------------
 |  Filtreler
 * ------------------------------------------------------------------------- */

.dft-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.dft-chip {
  padding: 7px 13px;
  border: 1px solid var(--dft-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--dft-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.dft-chip:hover {
  color: var(--dft-text);
  border-color: rgba(255, 255, 255, .24);
}

.dft-chip.is-active {
  color: var(--brand, var(--accent, #efa448));
  border-color: color-mix(in srgb, var(--brand, #efa448) 45%, transparent);
  background: color-mix(in srgb, var(--brand, #efa448) 12%, transparent);
}

.dft-filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dft-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dft-field > span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--dft-muted);
}

#defter-app .dft-field input,
#defter-app .dft-field select,
#defter-app .dft-field textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--dft-line);
  border-radius: 10px;
  background: rgba(0, 0, 0, .22);
  color: var(--dft-text);
  font-size: 13.5px;
  line-height: 1.4;
}

#defter-app .dft-field input::placeholder,
#defter-app .dft-field textarea::placeholder {
  color: var(--muted-2, #636c79);
}

#defter-app .dft-field input[type="color"] {
  padding: 4px;
  height: 40px;
  cursor: pointer;
}

#defter-app .dft-field textarea {
  resize: vertical;
}

/* -------------------------------------------------------------------------
 |  Kayıt formu
 * ------------------------------------------------------------------------- */

.dft-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  margin-top: 14px;
}

.dft-kind-toggle {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.dft-kind {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dft-kind input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dft-kind span {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--dft-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  color: var(--dft-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.dft-kind input:checked + span {
  color: var(--dft-text);
  border-color: color-mix(in srgb, var(--brand, #efa448) 50%, transparent);
  background: color-mix(in srgb, var(--brand, #efa448) 12%, transparent);
}

.dft-kind input:focus-visible + span {
  outline: 2px solid var(--brand, var(--accent, #efa448));
  outline-offset: 2px;
}

.dft-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
}

/* -------------------------------------------------------------------------
 |  Kayıt listesi
 * ------------------------------------------------------------------------- */

.dft-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dft-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "badge main amount"
    "actions actions actions";
  align-items: center;
  gap: 10px 12px;
  padding: 12px 13px;
  border: 1px solid var(--dft-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}

.dft-item--income { box-shadow: inset 3px 0 0 var(--dft-income); }
.dft-item--expense { box-shadow: inset 3px 0 0 var(--dft-expense); }

.dft-badge {
  grid-area: badge;
  align-self: start;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dft-item--income .dft-badge {
  color: #a9e7c5;
  border: 1px solid rgba(107, 213, 155, .35);
  background: rgba(107, 213, 155, .1);
}

.dft-item--expense .dft-badge {
  color: #f3b3b6;
  border: 1px solid rgba(239, 108, 114, .35);
  background: rgba(239, 108, 114, .1);
}

.dft-item-main {
  grid-area: main;
  min-width: 0;
}

.dft-item-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
}

.dft-item-cat {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--dft-text);
  overflow-wrap: anywhere;
}

.dft-item-cat.has-color::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 3px;
  background: var(--cat-color, var(--dft-muted));
}

.dft-item-date {
  font-size: 12px;
  color: var(--dft-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dft-item-note {
  margin: 5px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--dft-muted);
  overflow-wrap: anywhere;
}

.dft-item-amount {
  grid-area: amount;
  justify-self: end;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dft-item--income .dft-item-amount { color: #a9e7c5; }
.dft-item--expense .dft-item-amount { color: #f3b3b6; }

.dft-item-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dft-empty {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px dashed var(--dft-line);
  border-radius: 12px;
  color: var(--dft-muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

#defter-app .dft-empty[hidden] {
  display: none;
}

.dft-more {
  margin-top: 14px;
  text-align: center;
}

#defter-app .dft-more [hidden] {
  display: none;
}

/* -------------------------------------------------------------------------
 |  Küçük düğmeler (liste ve kategori satırları)
 * ------------------------------------------------------------------------- */

.dft-mini {
  padding: 5px 11px;
  border: 1px solid var(--dft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
  color: var(--dft-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.dft-mini:hover {
  color: var(--dft-text);
  border-color: rgba(255, 255, 255, .26);
  background: rgba(255, 255, 255, .06);
}

.dft-mini--danger:hover {
  color: #f7c3c5;
  border-color: rgba(239, 108, 114, .5);
  background: rgba(239, 108, 114, .12);
}

/* -------------------------------------------------------------------------
 |  Kategori kırılımı çubukları
 * ------------------------------------------------------------------------- */

.dft-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.dft-bars-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label net"
    "track track";
  align-items: center;
  gap: 5px 10px;
}

.dft-bars-label {
  grid-area: label;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dft-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dft-bars-net {
  grid-area: net;
  font-size: 12.5px;
  color: var(--dft-muted);
  font-variant-numeric: tabular-nums;
}

.dft-bars-track {
  grid-area: track;
  display: flex;
  gap: 3px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}

.dft-bars-bar {
  flex: none;
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .35s ease;
}

.dft-bars-bar--expense { background: var(--dft-expense); }
.dft-bars-bar--income { background: var(--dft-income); }

/* -------------------------------------------------------------------------
 |  Kategori yönetimi
 * ------------------------------------------------------------------------- */

.dft-cat-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0 16px;
}

.dft-cat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.dft-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.dft-cat-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--dft-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .02);
}

.dft-cat-item.is-archived {
  opacity: .62;
}

.dft-cat-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 4px;
  background: var(--dft-muted);
}

.dft-cat-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.dft-cat-copy strong {
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.dft-cat-copy small {
  font-size: 11.5px;
  color: var(--dft-muted);
}

.dft-cat-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex: none;
}

.dft-cat-empty {
  padding: 14px;
  border: 1px dashed var(--dft-line);
  border-radius: 11px;
  color: var(--dft-muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* -------------------------------------------------------------------------
 |  Meşgul durumu
 * ------------------------------------------------------------------------- */

.dft.is-busy {
  cursor: progress;
}

.dft.is-busy .dft-panel,
.dft.is-busy .dft-summary {
  opacity: .82;
  transition: opacity .2s ease;
}

/* -------------------------------------------------------------------------
 |  Tanıtım sayfası: örnek görünüm panelleri (kapsam dışı yardımcılar)
 * ------------------------------------------------------------------------- */

.dft-mock-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 8px;
}

.dft-mock {
  padding: 16px;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  border-radius: 14px;
  background: var(--panel, #181d28);
}

.dft-mock figcaption {
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted, #8e97a6);
}

.dft-mock svg {
  display: block;
  width: 100%;
  height: auto;
}

/* -------------------------------------------------------------------------
 |  Duyarlı düzen
 * ------------------------------------------------------------------------- */

@media (min-width: 720px) {
  .dft-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
  }

  .dft-head-actions {
    flex: none;
  }

  .dft-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dft-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dft-field--wide {
    grid-column: 1 / -1;
  }

  .dft-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dft-cat-form {
    grid-template-columns: 150px minmax(0, 1fr) 90px auto;
    align-items: end;
  }

  .dft-item {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "badge main amount actions";
    align-items: center;
  }

  .dft-item-actions {
    opacity: .35;
    transition: opacity .18s ease;
  }

  .dft-item:hover .dft-item-actions,
  .dft-item:focus-within .dft-item-actions {
    opacity: 1;
  }

  .dft-bars-row {
    grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
    grid-template-areas: "label track net";
  }

  .dft-mock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .dft-filter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .dft-field--wide {
    grid-column: span 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #defter-app *,
  #defter-app *::before,
  #defter-app *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}