/* ==========================================================================
   Diyetisyencim — Uygulama Kabuğu (DYT_Shell)
   Tema bağımsız; marka renkleri #dyt-shell üzerindeki inline değişkenlerden.
   ========================================================================== */

:root {
    --dyt-shell-w: 260px;
    --dyt-topbar-h: 60px;
    --dyt-bottomnav-h: 60px;
    --dyt-border: #e2e8f0;
    --dyt-bg: #f6f8fa;
    --dyt-surface: #ffffff;
    --dyt-text: #212121;
    --dyt-muted: #64748b;
    --dyt-danger: #dc2626;
}

/* ── Dark tema (UI-002): body.dyt-dark altında değişkenler ─────────── */
body.dyt-dark {
    --dyt-border: #2a3040;
    --dyt-bg: #0f1218;
    --dyt-surface: #171b24;
    --dyt-surface-2: #1d222e;
    --dyt-text: #e6eaf2;
    --dyt-muted: #8b94a7;
    --dyt-danger: #f87171;
    background: var(--dyt-bg);
    color: var(--dyt-text);
}
body.dyt-dark .dyt-shell,
body.dyt-dark .dyt-sidebar,
body.dyt-dark .dyt-topbar,
body.dyt-dark .dyt-bottom-nav,
body.dyt-dark .dyt-main,
body.dyt-dark .dyt-card,
body.dyt-dark .dyt-table,
body.dyt-dark .dyt-table th,
body.dyt-dark .dyt-table td {
    background: var(--dyt-surface);
    color: var(--dyt-text);
    border-color: var(--dyt-border);
}
body.dyt-dark .dyt-nav-item,
body.dyt-dark .dyt-nav-group,
body.dyt-dark .dyt-brand,
body.dyt-dark .dyt-topbar-title,
body.dyt-dark .dyt-user-name,
body.dyt-dark .dyt-user-role {
    color: var(--dyt-text);
}
body.dyt-dark .dyt-nav-item:hover { background: var(--dyt-surface-2); }
body.dyt-dark .dyt-muted { color: var(--dyt-muted); }
body.dyt-dark input,
body.dyt-dark select,
body.dyt-dark textarea {
    background: var(--dyt-surface-2);
    color: var(--dyt-text);
    border-color: var(--dyt-border);
}
body.dyt-dark .dyt-alert { border-color: var(--dyt-border); }
/* AUDIT-004: ikon butonları ve ghost buton dark uyumu */
body.dyt-dark .dyt-icon-btn { color: var(--dyt-muted); }
body.dyt-dark .dyt-icon-btn:hover {
    background: var(--dyt-surface-2);
    color: var(--dyt-text);
}
body.dyt-dark .dyt-btn-ghost {
    color: var(--dyt-text);
    border-color: var(--dyt-border);
}
body.dyt-dark .dyt-btn-ghost:hover {
    background: var(--dyt-surface-2);
    color: var(--dyt-text);
}

/* Tema toggle butonu görünümü */
.dyt-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--dyt-border);
    background: var(--dyt-surface);
    color: var(--dyt-text);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
}
.dyt-theme-toggle:hover { background: var(--dyt-surface-2); }

/* ── Genel kabuk düzeni ─────────────────────────────────────────────── */
.dyt-shell { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.dyt-shell * { box-sizing: border-box; }
.dyt-ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* İçerik alanını kabuğa göre kaydır — UI-001 + UI-006: hem girişli hem ziyaretçi.
   UI-006'dan beri ziyaretçi de sidebar gördüğü için ofset herkese uygulanır. */
body.dyt-app-page.dyt-shell-user .entry-content,
body.dyt-app-page.dyt-shell-user .ast-container,
body.dyt-app-page.dyt-shell-user #primary {
    padding-left: var(--dyt-shell-w);
    padding-top: var(--dyt-topbar-h);
    max-width: 100% !important;
}
body.dyt-app-page .dyt-auth-wrap,
body.dyt-app-page .dyt-panel-wrap {
    padding: 28px 24px 48px;
}

/* Panel içerik alanı topbar altında (UI-004; UI-006b: çift ofset yok —
   topbar boşluğu entry-content'ten geliyor, wrapper sadece nefes payı ekler) */
body.dyt-app-page.dyt-shell-user .dyt-panel-wrap {
    padding-top: 28px;
    padding-bottom: 64px;
}
body.dyt-app-page.dyt-shell-user .dyt-main-content,
body.dyt-app-page.dyt-shell-user .dyt-list-wrap {
    padding-top: 16px;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.dyt-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--dyt-shell-w);
    background: var(--dyt-surface);
    border-right: 1px solid var(--dyt-border);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transition: transform .22s ease;
}
.dyt-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--dyt-border);
    text-decoration: none;
    color: var(--dyt-text);
    font-weight: 700;
    font-size: 17px;
}
.dyt-brand-mark {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--dyt-primary);
    color: #fff;
}
.dyt-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.dyt-nav-group {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dyt-muted);
    padding: 14px 10px 6px;
}
.dyt-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
.dyt-nav-item:hover { background: #f1f5f9; color: var(--dyt-primary-dark); }
.dyt-nav-item.active {
    background: var(--dyt-primary);
    color: #fff;
    font-weight: 600;
}
.dyt-sidebar-foot {
    padding: 12px 14px;
    border-top: 1px solid var(--dyt-border);
}
.dyt-site-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px;
    color: var(--dyt-muted);
    text-decoration: none;
}
.dyt-site-link:hover { color: var(--dyt-primary-dark); }

.dyt-sidebar-backdrop { display: none; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.dyt-topbar {
    position: fixed;
    top: 0; left: var(--dyt-shell-w); right: 0;
    height: var(--dyt-topbar-h);
    background: var(--dyt-surface);
    border-bottom: 1px solid var(--dyt-border);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    z-index: 1000;
}
.dyt-hamburger { display: none; }
.dyt-topbar-title {
    font-size: 16px; font-weight: 700; color: var(--dyt-text);
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dyt-topbar-right { display: flex; align-items: center; gap: 8px; }
.dyt-icon-btn {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px;
    background: transparent; color: #475569;
    cursor: pointer; text-decoration: none;
    transition: background .15s ease;
}
.dyt-icon-btn:hover { background: #f1f5f9; color: var(--dyt-primary-dark); }

.dyt-user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 6px 5px 8px;
    margin-left: 6px;
    border: 1px solid var(--dyt-border);
    border-radius: 999px;
    background: #fbfcfd;
}
.dyt-user-avatar {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--dyt-primary);
    color: #fff; font-weight: 700; font-size: 14px;
}
.dyt-user-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.dyt-user-name { font-size: 13px; font-weight: 600; color: var(--dyt-text); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dyt-user-role { font-size: 11px; color: var(--dyt-muted); }

/* ── Mobil alt nav ──────────────────────────────────────────────────── */
.dyt-bottom-nav { display: none; }

/* ── Public topbar (ziyaretçi) ──────────────────────────────────────── */
.dyt-public-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--dyt-topbar-h);
    background: var(--dyt-surface);
    border-bottom: 1px solid var(--dyt-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}
.dyt-public-nav { display: flex; align-items: center; gap: 8px; }

/* Butonlar */
.dyt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    background: var(--dyt-primary, #2E7D32);
    color: #fff;
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease;
}
.dyt-btn:hover { background: var(--dyt-primary-dark, #1B5E20); color: #fff; }
.dyt-btn-ghost {
    background: transparent;
    color: #334155;
    border: 1px solid var(--dyt-border);
}
.dyt-btn-ghost:hover { background: #f1f5f9; color: var(--dyt-text); }

/* ── Guest shell (UI-006): ziyaretçi topbar butonları + pill ───────── */
.dyt-topbar-login,
.dyt-topbar-register { padding: 7px 14px; font-size: 13px; white-space: nowrap; }
.dyt-guest-pill { margin-left: 0; cursor: default; }
.dyt-guest-pill .dyt-user-avatar { background: var(--dyt-muted); }
.dyt-guest-pill .dyt-user-name { font-size: 12px; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 782px) {
    .dyt-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0,0,0,.25);
    }
    body.dyt-shell-open .dyt-sidebar { transform: translateX(0); }
    .dyt-sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(15,23,42,.45);
        z-index: 1000;
        opacity: 0; pointer-events: none;
        transition: opacity .2s ease;
    }
    body.dyt-shell-open .dyt-sidebar-backdrop { opacity: 1; pointer-events: auto; }

    .dyt-hamburger { display: inline-flex; }
    .dyt-topbar { left: 0; padding: 0 12px; }
    .dyt-topbar-title { font-size: 14px; }
    .dyt-user-meta { display: none; }
    .dyt-user-chip { border: none; background: transparent; padding: 0; }

    /* Guest shell (UI-006): topbar butonları mobilde gizli — sidebar içi
       menü + alt nav'daki Giriş/Kayıt yeterli, taşma olmasın. */
    .dyt-topbar-login,
    .dyt-topbar-register { display: none; }

    .dyt-bottom-nav {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0;
        height: var(--dyt-bottomnav-h);
        background: var(--dyt-surface);
        border-top: 1px solid var(--dyt-border);
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .dyt-bottom-item {
        flex: 1;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        font-size: 10.5px;
        color: var(--dyt-muted);
        text-decoration: none;
    }
    .dyt-bottom-item.active { color: var(--dyt-primary); font-weight: 600; }

    body.dyt-app-page.dyt-shell-user .entry-content,
    body.dyt-app-page.dyt-shell-user .ast-container,
    body.dyt-app-page.dyt-shell-user #primary {
        padding-left: 0;
        padding-top: var(--dyt-topbar-h);
        padding-bottom: calc(var(--dyt-bottomnav-h) + 12px);
    }
    body.dyt-app-page .dyt-auth-wrap,
    body.dyt-app-page .dyt-panel-wrap { padding: 20px 14px 40px; }
}

/* ── Bildirim kutusu (S14) ─────────────────────────────────────────── */
.dyt-notif-wrap { position: relative; }
.dyt-icon-btn { position: relative; }
.dyt-notif-count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    background: var(--dyt-danger, #dc2626);
    color: #fff;
    font-size: 11px; font-weight: 700;
}
.dyt-notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: -70px;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: var(--dyt-surface, #fff);
    border: 1px solid var(--dyt-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .16);
    overflow: hidden;
    z-index: 1100;
}
.dyt-notif-wrap.open .dyt-notif-dropdown { display: block; }
.dyt-notif-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--dyt-border, #e2e8f0);
    font-weight: 700; font-size: 14px;
}
.dyt-notif-markall button {
    border: none; background: none;
    color: var(--dyt-primary, #2E7D32);
    font-size: 12px; font-weight: 600;
    cursor: pointer; padding: 0;
}
.dyt-notif-markall button:hover { text-decoration: underline; }
.dyt-notif-body { max-height: 300px; overflow-y: auto; }
.dyt-notif-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: var(--dyt-text, #212121);
}
.dyt-notif-item:hover { background: #f8fafc; }
.dyt-notif-item.unread { background: #f0fdf4; }
.dyt-notif-item .dyt-notif-tag {
    display: inline-block;
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--dyt-primary, #2E7D32);
    margin-bottom: 2px;
}
.dyt-notif-item .dyt-notif-text {
    display: block;
    font-size: 13px; line-height: 1.35;
}
.dyt-notif-item time {
    display: block;
    font-size: 11px; color: var(--dyt-muted, #64748b);
    margin-top: 3px;
}
.dyt-notif-empty { padding: 20px 14px; font-size: 13px; color: var(--dyt-muted, #64748b); text-align: center; }
.dyt-notif-all {
    display: block;
    text-align: center;
    padding: 10px 14px;
    font-size: 13px; font-weight: 600;
    color: var(--dyt-primary, #2E7D32);
    text-decoration: none;
    border-top: 1px solid var(--dyt-border, #e2e8f0);
}
.dyt-notif-all:hover { background: #f8fafc; }

@media (max-width: 782px) {
    .dyt-notif-dropdown {
        right: 0;
        width: min(320px, calc(100vw - 24px));
    }
}

/* ── P7: plan çipi (sidebar) ────────────────────────────────────── */
.dyt-plan-chip { display: inline-flex; align-items: center; gap: 6px; width: 100%; margin-bottom: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(46,125,50,.1); color: #1B5E20; font-size: 12px; font-weight: 700; text-decoration: none; box-sizing: border-box; }
.dyt-plan-chip::before { content: '✦'; }
