/* FitApp PWA - koyu, mor, cam efektli tema */
:root {
    --bg: #0b0a12;
    --surface: rgba(255, 255, 255, .045);
    --surface-2: rgba(255, 255, 255, .07);
    --line: rgba(255, 255, 255, .08);
    --text: #f4f2ff;
    --muted: #9b97b3;
    --p1: #a78bfa;
    --p2: #7c3aed;
    --grad: linear-gradient(135deg, #a78bfa 0%, #7c3aed 55%, #5b21b6 100%);
    --ok: #34d399;
    --bad: #fb7185;
    --blue: #38bdf8;
    --amber: #fbbf24;
    --pink: #f472b6;
    --r: 22px;
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: var(--text);
    min-height: 100vh;
    padding: env(safe-area-inset-top) 0 calc(110px + env(safe-area-inset-bottom));
    overflow-x: hidden;
}
.muted { color: var(--muted) !important; }
h1, h2 { font-weight: 800; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 1.55rem; }

.bg-blob { position: fixed; border-radius: 50%; filter: blur(80px); opacity: .35; z-index: -1; pointer-events: none; }
.b1 { width: 320px; height: 320px; background: #7c3aed; top: -120px; right: -100px; }
.b2 { width: 260px; height: 260px; background: #db2777; bottom: 80px; left: -140px; opacity: .18; }

#app { max-width: 560px; margin: 0 auto; padding: 18px 16px 0; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.glass {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

/* ---------------- Ust bar */
.top { display: flex; justify-content: space-between; align-items: flex-end; margin: 6px 0 18px; gap: 12px; }
.date-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.date-nav span { font-size: .8rem; font-weight: 600; padding: 0 6px; white-space: nowrap; }
.date-nav button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: .75rem; }

/* ---------------- Hero (kalori halkasi) */
.hero {
    background: var(--grad);
    border-radius: 28px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 20px 50px -18px rgba(124, 58, 237, .65);
    position: relative;
    overflow: hidden;
}
.hero::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); top: -90px; right: -70px; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: 0 0 132px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: rgba(255, 255, 255, .18); }
.ring-fg { stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.ring-sub { font-size: .72rem; opacity: .85; margin-top: 3px; }
.hero-side { flex: 1; display: flex; flex-direction: column; gap: 8px; z-index: 1; }
.hero-stat { display: flex; justify-content: space-between; align-items: center; background: rgba(0, 0, 0, .16); border-radius: 14px; padding: 8px 12px; font-size: .8rem; }
.hero-stat span { opacity: .85; }
.hero-stat span i { width: 16px; }
.hero-stat b { font-size: .95rem; }

/* ---------------- Makrolar */
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.macro-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.mlabel { font-size: .72rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.mval { font-size: .8rem; color: var(--muted); margin: 4px 0 8px; }
.mval b { color: var(--text); font-size: 1.05rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.p, .bar i.p { background: #f472b6; }
.dot.c, .bar i.c { background: #fbbf24; }
.dot.f, .bar i.f { background: #38bdf8; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .6s ease; }

/* ---------------- Su */
.water { padding: 14px; }
.glasses { display: flex; gap: 3px; margin-top: 6px; overflow: hidden; }
.glasses i { font-size: .82rem; color: rgba(255, 255, 255, .12); transition: color .3s; }
.glasses i.on { color: var(--blue); }

.icon-tile { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px; display: grid; place-items: center; font-size: 1.05rem; }
.icon-tile.purple { background: rgba(167, 139, 250, .16); color: var(--p1); }
.icon-tile.blue { background: rgba(56, 189, 248, .15); color: var(--blue); }
.icon-tile.pink { background: rgba(244, 114, 182, .15); color: var(--pink); }
.icon-tile.amber { background: rgba(251, 191, 36, .15); color: var(--amber); }
.icon-tile.green { background: rgba(52, 211, 153, .15); color: var(--ok); }

.round-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: var(--grad); flex: 0 0 auto; transition: transform .15s; }
.round-btn:active { transform: scale(.9); }
.round-btn.blue { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.round-btn.ghost { background: var(--surface-2); color: var(--muted); }
.round-btn.sm { width: 34px; height: 34px; font-size: .8rem; }

/* ---------------- Bolum basligi */
.sec-title { display: flex; justify-content: space-between; align-items: center; margin: 24px 4px 10px; }
.sec-title span { font-weight: 700; font-size: 1.05rem; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: .78rem; font-weight: 600; }

/* ---------------- Antrenman karti */
.workout-card { padding: 16px; position: relative; overflow: hidden; }
.workout-card.done { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .06); }
.wc-head { display: flex; align-items: center; gap: 12px; }
.wc-title { font-weight: 700; font-size: 1.05rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-size: .7rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip i { margin-right: 3px; }
.done-btn { width: 100%; margin-top: 14px; border: 0; border-radius: 16px; padding: 12px; font-weight: 700; color: #fff; background: var(--grad); transition: transform .15s; }
.done-btn:active { transform: scale(.98); }
.done .done-btn { background: rgba(52, 211, 153, .18); color: var(--ok); }
.ex-toggle { background: none; border: 0; color: var(--p1); font-size: .8rem; font-weight: 600; padding: 10px 0 0; }
.ex-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.ex-row { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 16px; background: rgba(255, 255, 255, .03); }
.ex-img { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; background: #1b1830; flex: 0 0 54px; display: grid; place-items: center; color: var(--muted); }
.ex-name { font-weight: 600; font-size: .88rem; }
.ex-meta { font-size: .75rem; color: var(--muted); }
.ex-num { margin-left: auto; font-size: .7rem; color: var(--muted); align-self: flex-start; }

.rest-card { padding: 22px; text-align: center; }
.rest-card i { font-size: 1.8rem; color: var(--p1); margin-bottom: 6px; }

/* ---------------- Ogun kartlari */
.meal { display: flex; gap: 12px; align-items: center; padding: 14px; margin-bottom: 10px; transition: background .2s, border-color .2s; }
.meal.done { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .06); }
.meal-body { flex: 1; min-width: 0; }
.meal-top { display: flex; align-items: center; gap: 8px; }
.meal-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-time { font-size: .7rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.meal-kcal { font-weight: 700; font-size: .85rem; color: var(--p1); }
.mchips { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.mchip { font-size: .68rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.mchip.p { background: rgba(244, 114, 182, .14); color: #f9a8d4; }
.mchip.c { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.mchip.f { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.foods { font-size: .75rem; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.note { font-size: .74rem; color: var(--muted); font-style: italic; margin-top: 4px; }
.check { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); background: none; color: transparent; display: grid; place-items: center; transition: all .2s; }
.done .check { background: var(--ok); border-color: var(--ok); color: #06281c; transform: scale(1.05); }

/* ---------------- Kayitlar */
.log-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; }
.log-row + .log-row { border-top: 1px solid var(--line); }
.log-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: .8rem; flex: 0 0 32px; }
.log-label { flex: 1; font-size: .85rem; }
.pill { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pill.in { background: rgba(251, 113, 133, .14); color: var(--bad); }
.pill.out { background: rgba(52, 211, 153, .14); color: var(--ok); }
.x-btn { border: 0; background: none; color: var(--muted); padding: 4px; }
.empty { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 10px; }

.pos { color: var(--bad) !important; }
.neg { color: var(--ok) !important; }
.hero .pos, .hero .neg { color: #fff !important; }

/* ---------------- Program */
.segment { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px; margin-bottom: 14px; }
.segment button { position: relative; z-index: 1; border: 0; background: none; color: var(--muted); font-weight: 600; padding: 10px; font-size: .88rem; transition: color .2s; }
.segment button.active { color: #fff; }
.seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 12px; background: var(--grad); transition: transform .25s ease; }
.segment.d .seg-ind { transform: translateX(100%); }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.day-chips::-webkit-scrollbar { display: none; }
.day-chip { flex: 0 0 auto; width: 52px; padding: 10px 0; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: .78rem; position: relative; }
.day-chip.active { background: var(--grad); color: #fff; border-color: transparent; }
.day-chip.today::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.day-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; margin-bottom: 10px; }

/* ---------------- Istatistik */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 10px; text-align: center; }
.tile i { color: var(--p1); font-size: 1.1rem; }
.tile span { display: block; font-size: .7rem; color: var(--muted); margin: 6px 0 2px; }
.tile b { font-size: 1.15rem; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kv { display: flex; justify-content: space-between; padding: 9px 2px; font-size: .88rem; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span { color: var(--muted); }
.goal-note:not(:empty) { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(167, 139, 250, .1); color: #ddd6fe; font-size: .8rem; }

/* ---------------- Ayarlar / formlar */
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
label { font-size: .72rem; color: var(--muted); margin: 0 0 4px 2px; display: block; }
.inp, .swal2-popup .inp {
    width: 100%;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 12px;
    color: var(--text);
    font-size: .9rem;
    outline: none;
    transition: border-color .2s, background .2s;
    color-scheme: dark;
}
.inp:focus { border-color: var(--p1); background: rgba(167, 139, 250, .08); }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%239b97b3' d='M8 11 3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.inp option { background: #1a1726; }
.btn-grad { border: 0; border-radius: 16px; padding: 12px 18px; font-weight: 700; color: #fff; background: var(--grad); box-shadow: 0 10px 24px -12px rgba(124, 58, 237, .8); transition: transform .15s; }
.btn-grad:active { transform: scale(.98); }
.btn-soft { border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; font-weight: 600; color: var(--text); background: var(--surface); }
.btn-soft.danger { color: var(--bad); }

.switch { position: relative; width: 48px; height: 28px; margin: 0; flex: 0 0 48px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .12); transition: background .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--p2); }
.switch input:checked + span::before { transform: translateX(20px); }

.rem-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.rem-row + .rem-row { border-top: 1px solid var(--line); }
.rem-time { font-weight: 800; font-size: 1.05rem; min-width: 52px; }
.rem-body { flex: 1; min-width: 0; }
.badge-coach { font-size: .62rem; padding: 2px 7px; border-radius: 999px; background: rgba(167, 139, 250, .18); color: var(--p1); margin-left: 4px; }

.wd-picks { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.wd-picks input { display: none; }
.wd-picks label { margin: 0; padding: 7px 10px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); font-size: .78rem; cursor: pointer; }
.wd-picks input:checked + label { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------------- Alt menu (yuzen) */
.tabbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: min(calc(100% - 28px), 420px);
    display: flex;
    padding: 7px;
    gap: 4px;
    border-radius: 26px;
    background: rgba(22, 19, 34, .78);
    border: 1px solid rgba(255, 255, 255, .09);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .7);
    z-index: 100;
}
.tabbar button { flex: 1; border: 0; background: none; color: var(--muted); border-radius: 19px; padding: 9px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .64rem; font-weight: 600; transition: all .2s; }
.tabbar button i { font-size: 1.1rem; }
.tabbar button.active { color: #fff; background: var(--grad); box-shadow: 0 8px 20px -8px rgba(124, 58, 237, .9); }

/* ---------------- Giris */
#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.logo-badge { width: 84px; height: 84px; border-radius: 26px; background: var(--grad); display: grid; place-items: center; font-size: 2.2rem; transform: rotate(-8deg); box-shadow: 0 20px 40px -12px rgba(124, 58, 237, .8); margin-bottom: 14px; }
.logo-badge i { transform: rotate(-37deg); }
.login-wrap h1 { font-size: 2rem; }
.login-wrap p { margin-bottom: 18px; }
.field { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; margin-bottom: 10px; }
.field:focus-within { border-color: var(--p1); }
.field i { color: var(--muted); width: 16px; }
.field input { flex: 1; background: none; border: 0; outline: none; color: var(--text); padding: 14px 0; font-size: .95rem; }

/* ---------------- SweetAlert koyu tema */
.swal2-popup { background: #16131f !important; color: var(--text) !important; border: 1px solid var(--line); border-radius: 26px !important; font-family: inherit; }
.swal2-title { font-size: 1.2rem !important; color: var(--text) !important; }
.swal2-html-container { color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--grad) !important; border-radius: 14px !important; font-weight: 700; }
.swal2-styled.swal2-cancel { background: rgba(255, 255, 255, .08) !important; border-radius: 14px !important; }
.swal2-popup.swal2-toast { border-radius: 18px !important; }
.swal-form { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.swal-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.swal-seg input { display: none; }
.swal-seg label { margin: 0; text-align: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); font-size: .85rem; color: var(--muted); cursor: pointer; }
.swal-seg input:checked + label { background: var(--grad); color: #fff; border-color: transparent; }


/* ---------------- Hareket detayi (popup) */
.ex-row[data-exid] { cursor: pointer; transition: background .2s; }
.ex-row[data-exid]:active { background: rgba(167, 139, 250, .12); }
.ex-row .fa-chevron-right { color: var(--muted); font-size: .7rem; align-self: center; }
.swal2-popup.ex-pop { padding: 0 0 16px; overflow: hidden; }
.ex-pop .swal2-html-container { margin: 0; padding: 0; text-align: left; }
.exd-media { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; display: block; }
.exd-media.empty { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 2.5rem; }
.exd-body { padding: 16px 18px 0; }
.exd-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.exd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.exd-grid div { background: var(--surface-2); border-radius: 14px; padding: 8px 4px; text-align: center; }
.exd-grid b { display: block; font-size: .95rem; }
.exd-grid span { font-size: .65rem; color: var(--muted); }
.exd-facts { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: .82rem; }
.exd-facts div { display: flex; justify-content: space-between; gap: 10px; }
.exd-facts dt { color: var(--muted); font-weight: 500; }
.exd-facts dd { margin: 0; font-weight: 600; text-align: right; }
.exd-h { font-weight: 700; font-size: .9rem; margin: 14px 0 8px; }
.exd-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow: auto; }
.exd-steps li { display: flex; gap: 10px; font-size: .84rem; line-height: 1.45; }
.exd-steps li span { flex: 0 0 24px; height: 24px; border-radius: 8px; background: rgba(167, 139, 250, .18); color: var(--p1); font-weight: 700; font-size: .75rem; display: grid; place-items: center; }
.exd-warn { margin-top: 12px; font-size: .74rem; color: #fcd34d; background: rgba(251, 191, 36, .1); border-radius: 12px; padding: 8px 10px; }
