/* Günlük Brief — kayıt ve ayarlar sayfası
   Apple'ın sistem diline yakın: SF Pro (sistem fontu), gruplanmış listeler, tek vurgu rengi. */

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-muted: #f5f5f7;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --separator: rgba(0, 0, 0, 0.1);
    --control: #e8e8ed;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, 0.1);
    --danger: #e30000;
    --success: #1d8a3a;
    --focus: rgba(0, 113, 227, 0.35);
    --bar-bg: rgba(245, 245, 247, 0.8);
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}

/* Koyu tema: kullanıcı "Koyu" seçtiyse ya da "Otomatik"te sistem koyu moddaysa */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-muted: #2c2c2e;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #86868b;
    --separator: rgba(255, 255, 255, 0.12);
    --control: #2c2c2e;
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --danger: #ff453a;
    --success: #30d158;
    --focus: rgba(41, 151, 255, 0.45);
    --bar-bg: rgba(0, 0, 0, 0.72);
    --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #000000;
        --surface: #1c1c1e;
        --surface-muted: #2c2c2e;
        --text: #f5f5f7;
        --text-secondary: #a1a1a6;
        --text-tertiary: #86868b;
        --separator: rgba(255, 255, 255, 0.12);
        --control: #2c2c2e;
        --accent: #2997ff;
        --accent-hover: #47a6ff;
        --accent-soft: rgba(41, 151, 255, 0.16);
        --danger: #ff453a;
        --success: #30d158;
        --focus: rgba(41, 151, 255, 0.45);
        --bar-bg: rgba(0, 0, 0, 0.72);
        --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.5);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 max(20px, env(safe-area-inset-right)) 140px max(20px, env(safe-area-inset-left));
}

/* ---- Üst kısım ---- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 0 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--text);
    color: var(--bg);
    font-family: "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", serif;
    font-size: 18px;
    line-height: 1;
}

/* Tema seçici: Otomatik / Açık / Koyu */
.theme-switch {
    display: flex;
    padding: 2px;
    border-radius: 9px;
    background: var(--control);
}

.theme-switch button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-switch button svg { width: 15px; height: 15px; }

.theme-switch button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-thumb);
}

.theme-switch button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.hero { padding: 56px 0 36px; }

.hero h1 {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
    font-size: clamp(34px, 7vw, 48px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.hero p {
    margin: 14px 0 0;
    max-width: 30em;
    font-size: 19px;
    line-height: 1.42;
    color: var(--text-secondary);
}

.hero p.hero-aside {
    margin-top: 10px;
    font-size: 14px;
    font-style: italic;
    font-weight: 400;
    color: #1e3a8a; /* lacivert */
}

/* Koyu zeminde lacivert okunmaz; aynı rengin açık tonu kullanılır */
:root[data-theme="dark"] .hero p.hero-aside { color: #93b4f5; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .hero p.hero-aside { color: #93b4f5; }
}

.schedule {
    display: flex;
    gap: 24px;
    margin-top: 28px;
    font-size: 14px;
    color: var(--text-secondary);
}

.schedule strong {
    display: block;
    font-size: 21px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* ---- Bölümler (iOS gruplanmış liste) ---- */

.section { margin-top: 36px; scroll-margin-top: 16px; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 4px 8px;
}

.section-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-meta {
    font-size: 14px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.section-note {
    margin: 0 4px 12px;
    font-size: 15px;
    color: var(--text-secondary);
}

.group {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 50px;
    padding: 0 16px;
    position: relative;
}

.row + .row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 1px;
    background: var(--separator);
    transform: scaleY(0.5);
    transform-origin: top;
}

.row label {
    flex: 0 0 124px;
    padding-right: 12px;
    font-size: 17px;
}

.row input {
    flex: 1;
    min-width: 0;
    height: 50px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    letter-spacing: inherit;
}

.row input::placeholder,
.field textarea::placeholder,
.add-row input::placeholder { color: var(--text-tertiary); }

.row:focus-within { background: var(--surface-muted); }

/* ---- Zorunlu alanlar ve hatalar ---- */

.required { color: var(--danger); font-weight: 600; }

.row.invalid {
    box-shadow: inset 0 0 0 2px var(--danger);
    border-radius: var(--radius-md);
}

.row.invalid label { color: var(--danger); }

.row.invalid::before,
.row.invalid + .row::before { display: none; }

.field-error {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    color: var(--danger);
}

.row .field-error {
    flex: 1 0 100%;
    margin: -6px 0 12px;
}

.section-error { margin: 0 4px 12px; font-size: 14px; }

.topic-box { border-radius: var(--radius-md); }

.section.invalid .topic-box {
    outline: 2px solid var(--danger);
    outline-offset: 8px;
}

.section.invalid .section-title { color: var(--danger); }

.row-hint {
    margin: 8px 16px 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ---- Segmented control ---- */

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    padding: 2px;
    border-radius: 9px;
    background: var(--control);
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented label {
    position: relative;
    z-index: 1;
    padding: 7px 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 7px;
    transition: color 0.2s ease;
}

.segmented .thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc(50% - 2px);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: var(--shadow-thumb);
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.segmented input:nth-of-type(2):checked ~ .thumb { transform: translateX(100%); }

.segmented input:focus-visible + label { box-shadow: 0 0 0 4px var(--focus); }

/* ---- Konu çipleri ---- */

.topic-group + .topic-group { margin-top: 20px; }

.topic-group-title {
    margin: 0 4px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--separator);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.chip:hover { border-color: var(--text-tertiary); }

.chip:active { transform: scale(0.96); }

.chip:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }

.chip svg {
    width: 12px;
    height: 12px;
    flex: none;
    display: none;
}

.chip[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.chip[aria-pressed="true"] svg { display: block; }

.chip.ghost {
    border-style: dashed;
    color: var(--text-secondary);
}

.chip.removable svg { display: block; }

/* ---- Ekleme satırı (özel konu, portföy) ---- */

.add-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.add-row input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: 0;
}

.add-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }

/* ---- Metin alanı ---- */

.field textarea {
    display: block;
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.45;
    resize: vertical;
    outline: 0;
}

.field textarea:focus { box-shadow: 0 0 0 4px var(--focus); }

.counter {
    margin: 6px 4px 0;
    text-align: right;
    font-size: 13px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.suggestions-label {
    margin: 14px 4px 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ---- Butonlar ---- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 980px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.18s ease, opacity 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.button:hover { background: var(--accent-hover); }

.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }

.button:disabled { opacity: 0.4; cursor: default; }

.button.secondary {
    background: var(--control);
    color: var(--text);
}

.button.danger { background: var(--danger); }

.button.small { height: 36px; padding: 0 16px; font-size: 15px; }

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}

.link-button.danger { color: var(--danger); }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.button.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Alt çubuk ---- */

.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--separator);
    z-index: 20; /* dil seçicinin etiketleri gibi konumlu öğeler çubuğun üstüne çıkmasın */
}

.action-bar-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.action-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.action-summary strong { color: var(--text); font-weight: 600; }

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

/* ---- Bildirim kartları ---- */

.notice {
    margin-top: 24px;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: var(--surface);
}

.notice h2 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 600;
}

.notice p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.notice .notice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.notice.accent { box-shadow: inset 0 0 0 1px var(--accent); }

.notice.danger { box-shadow: inset 0 0 0 1px var(--danger); }

/* ---- Başarı ekranı ---- */

.done {
    padding: 96px 0 40px;
    text-align: center;
}

.done svg {
    width: 64px;
    height: 64px;
    color: var(--success);
}

.done svg circle,
.done svg path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw 0.7s ease forwards;
}

.done svg path { animation-delay: 0.3s; }

@keyframes draw { to { stroke-dashoffset: 0; } }

.done h1 {
    margin: 24px 0 8px;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.done p {
    margin: 0 auto;
    overflow-wrap: anywhere;
    max-width: 26em;
    font-size: 19px;
    color: var(--text-secondary);
}

/* ---- Bildirim balonu ---- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 104px;
    z-index: 30;
    padding: 10px 18px;
    border-radius: 980px;
    background: var(--text);
    color: var(--bg);
    font-size: 15px;
    text-align: center;
    width: max-content;
    max-width: calc(100% - 32px);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 24px;
    margin-top: 48px;
}

/* ".hero p" ve ".done p" seçicilerini ezebilmek için aynı özgüllükte yazılır */
.hero p.schedule-hint {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

.done p.done-actions { margin-top: 24px; }

.fine-print {
    margin: 40px 4px 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

.loading-state {
    padding: 120px 0;
    text-align: center;
    color: var(--text-secondary);
}

[hidden] { display: none !important; }

/* ---- Telefon ---- */
@media (max-width: 480px) {
    body { font-size: 16px; }
    .page {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: 180px;
    }
    .hero { padding: 36px 0 28px; }
    .hero p { font-size: 17px; }
    .schedule { gap: 20px; margin-top: 22px; }
    .section { margin-top: 30px; }
    .section-title { font-size: 20px; }
    .row { padding: 0 14px; }
    .row label { flex-basis: 114px; padding-right: 8px; font-size: 16px; }
    .row input { font-size: 16px; }
    .row + .row::before { left: 14px; }
    .chip { height: 34px; padding: 0 12px; font-size: 14px; }
    .add-row .button { flex: none; }
    .section.invalid .topic-box { outline-offset: 6px; }
    .action-bar { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
    .action-bar-inner { flex-direction: column; align-items: stretch; gap: 8px; }
    .action-summary { display: none; }
    .form-error { text-align: center; }
    .action-bar .button { width: 100%; }
    .toast { bottom: 96px; }
    .done { padding-top: 64px; }
    .done h1 { font-size: 28px; }
    .done p { font-size: 17px; }
    .notice { padding: 16px; }
}

/* Çok dar ekranlar (ör. iPhone SE 1. nesil): etiket üstte, alan altta */
@media (max-width: 360px) {
    .row { padding-top: 8px; }
    .row label { flex-basis: 100%; font-size: 13px; color: var(--text-secondary); }
    .row input { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .done svg circle, .done svg path { stroke-dashoffset: 0; }
}
