/* AnGeldi web arayüzü — tek tasarım sistemi. Renkler logodaki ahududu tonundan türetilir;
   uygulamadaki lib/theme/app_colors.dart ile aynı palet. */

:root {
  color-scheme: light;
  --brand: #C2255C;
  --brand-strong: #A01B4A;
  --brand-soft: #FBE9F0;
  --brand-ink: #7A1238;
  --gold: #D9912B;
  --gold-soft: #FCF1DD;
  --gold-ink: #7A4D0B;
  --ink: #1D1B2A;
  --ink-2: #4B4759;
  --muted: #7B7788;
  --bg: #FAF7F5;
  --surface: #FFFFFF;
  --surface-2: #F4EFEC;
  --line: #E9E2DD;
  --ok: #1B8A6B;
  --ok-soft: #E3F4EE;
  --danger: #C93B3B;
  --danger-soft: #FBE9E9;
  --shadow: 0 1px 2px rgb(29 27 42 / .05), 0 8px 24px -12px rgb(29 27 42 / .12);
  --radius: 14px;
  --radius-sm: 10px;
  --side-w: 248px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #F06595;
  --brand-strong: #F783AC;
  --brand-soft: #3A1B29;
  --brand-ink: #FFC2D6;
  --gold: #F0B24F;
  --gold-soft: #3A2C14;
  --gold-ink: #FFDFA6;
  --ink: #F3F0F6;
  --ink-2: #C9C4D4;
  --muted: #9993A8;
  --bg: #14121B;
  --surface: #1D1A26;
  --surface-2: #262231;
  --line: #322D3F;
  --ok: #4CC9A4;
  --ok-soft: #173229;
  --danger: #F07A7A;
  --danger-soft: #3A1C1C;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Kabuk */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; background: url(../img/logo.png?v=2) left center / auto 100% no-repeat; flex: none; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-link i { font-size: 18px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); }
.nav-label { margin: 16px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-foot { margin-top: auto; display: grid; gap: 4px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); margin-top: 8px; }
.side-user-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .btn-primary { margin: 6px 0 10px; }

.main { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 60px; }
.container { max-width: 1040px; margin: 0 auto; }
.container.narrow { max-width: 720px; }

.topbar { display: none; }
.tabbar { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 96px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20;
    padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; font-size: 17px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; inset: auto 0 0 0; z-index: 20;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tab { display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); }
  .tab i { font-size: 20px; }
  .tab[aria-current="page"] { color: var(--brand); }
  .tab-add { justify-self: center; display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: var(--shadow); }
  .tab-add i { font-size: 24px; }
}

/* ------------------------------------------------------------ Başlık ve düğmeler */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
:root[data-theme="dark"] .btn-primary { color: #1D1B2A; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ------------------------------------------------------------ Kart, rozet, avatar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: clamp(16px, 2.5vw, 24px); }
.card + .card, * + .section { margin-top: 18px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2 { font-size: 17px; font-weight: 800; }
.card-title a { color: var(--brand); font-weight: 700; font-size: 13px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; flex: none; }
.badge-today { background: var(--gold); color: #2A1B02; }
.badge-soon { background: var(--gold-soft); color: var(--gold-ink); }
.badge-plain { background: var(--surface-2); color: var(--ink-2); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }

.avatar { display: grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; font-weight: 800; letter-spacing: .02em; color: #fff; }
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.avatar-md { width: 46px; height: 46px; font-size: 15px; }
.avatar-lg { width: 96px; height: 96px; font-size: 30px; }
.tone-0 { background: #C2255C; } .tone-1 { background: #9C4A1A; } .tone-2 { background: #2F6F8F; } .tone-3 { background: #5B4B8A; }
.tone-4 { background: #1B7A62; } .tone-5 { background: #B26A00; } .tone-6 { background: #8A3A6B; } .tone-7 { background: #44576B; }

/* ------------------------------------------------------------ Özet kutuları */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; justify-content: space-between;
  padding: clamp(18px, 3vw, 28px); border-radius: var(--radius);
  background: var(--ink); color: #fff;
}
:root[data-theme="dark"] .hero { background: var(--surface-2); border: 1px solid var(--line); }
.hero h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; }
.hero p { color: rgb(255 255 255 / .72); margin-top: 6px; max-width: 52ch; }
.hero-today { display: grid; gap: 8px; }
.hero-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: rgb(255 255 255 / .1); font-weight: 700; }
.hero-chip:hover { background: rgb(255 255 255 / .18); }

/* ------------------------------------------------------------ Etkinlik listesi */
.event-list { display: grid; gap: 8px; }
.event-list.is-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.event-row { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.event-row:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow); }
.event-row.is-today { border-color: var(--gold); background: linear-gradient(0deg, var(--gold-soft), var(--gold-soft)) padding-box; }
.event-row[hidden] { display: none; }
.event-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 8px; border-radius: 10px; }
.event-text { display: grid; flex: 1; min-width: 0; }
.event-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-meta, .event-status { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-status { color: var(--ink-2); }
.is-grid .event-row { align-items: flex-start; }
.is-grid .event-main { flex-wrap: wrap; }
.is-grid .event-main .badge { margin-left: 58px; }
.list-count { color: var(--muted); font-size: 13px; font-weight: 600; margin: 14px 2px 10px; }

.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty i { font-size: 34px; color: var(--brand); }
.empty h2 { color: var(--ink); font-size: 18px; }

/* ------------------------------------------------------------ Filtreler */
.toolbar { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; }
@media (max-width: 760px) { .toolbar { grid-template-columns: 1fr 1fr; } .toolbar .search { grid-column: 1 / -1; } }
.search { position: relative; }
.search i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); }
.search .input { padding-left: 40px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 12px -2px 0; scrollbar-width: thin; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button, .segmented a { display: grid; place-items: center; min-width: 38px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; font-size: 13px; }
.segmented [aria-pressed="true"], .segmented [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

/* ------------------------------------------------------------ Formlar */
.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%237B7788' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.is-filled { border-color: var(--ok); background: var(--ok-soft); }
.phone-group { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding-top: 6px; }
.form-actions .right { display: flex; gap: 10px; margin-left: auto; }
.avatar-picker { display: flex; align-items: center; gap: 16px; }
.avatar-picker .avatar { border: 1px solid var(--line); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: 0; padding-top: 0; }
.switch-row strong { display: block; }
.switch-row small { color: var(--muted); }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: translate .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { translate: 20px 0; }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-weight: 600; }
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-info { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); font-weight: 500; }
.alert ul { margin: 0; padding-left: 18px; }

/* ------------------------------------------------------------ Detay */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.detail-head h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; }
.detail-head .who { flex: 1; min-width: 200px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.countdown { display: grid; justify-items: center; align-content: center; min-width: 132px; padding: 14px 18px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-ink); }
.countdown.is-today { background: var(--gold); color: #2A1B02; }
.countdown b { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 12px; font-weight: 700; margin-top: 4px; }
.kv { display: grid; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.kv dd small { display: block; font-weight: 500; color: var(--muted); max-width: 34ch; margin-left: auto; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0 14px; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.mini-stats div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.mini-stats b { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.zodiac { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.zodiac:first-of-type { border-top: 0; padding-top: 0; }
.zodiac-symbol { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--surface-2); font-size: 24px; }
.zodiac h3 { font-size: 15px; font-weight: 800; }
.zodiac p { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.notes { white-space: pre-wrap; color: var(--ink-2); }

/* ------------------------------------------------------------ Takvim */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-head h2 { font-size: 20px; font-weight: 800; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { position: relative; min-height: 92px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; align-content: start; gap: 4px; }
.cal-day.is-empty { background: transparent; border-color: transparent; }
.cal-day.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-num { font-weight: 700; font-size: 13px; }
.cal-day.is-today .cal-num { color: var(--brand); }
.cal-item { display: block; padding: 2px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 11.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.is-famous { background: var(--surface-2); color: var(--ink-2); }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 600; }
@media (max-width: 700px) {
  .cal { gap: 3px; }
  .cal-day { min-height: 52px; padding: 5px; justify-items: center; }
  .cal-item, .cal-more { display: none; }
  .cal-day.has-items::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
}

/* ------------------------------------------------------------ Keşfet */
.people-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.person-card { display: flex; gap: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.person-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow); }
.person-card img, .person-card .avatar { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.person-card h3 { font-size: 15px; font-weight: 800; }
.person-card p { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .3); max-width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(20 18 27 / .55); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px; }
.dialog-body h2 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
