/* =================================================================
   XOON — Premium Light Tasarım Sistemi
   Zemin: krem-beyaz #FAFAF8, Yüzey: #FFFFFF, Metin: ink #14151A,
   Vurgu: elektrik turuncu-kırmızı #FF4D2E
   Renkler config/config.php üzerinden header.php'de :root'a enjekte edilir.
   ================================================================= */

:root{
  --bg: var(--brand-bg, #FAFAF8);
  --surface: var(--brand-surface, #FFFFFF);
  --surface-2: #F2F1ED;
  --border: #E8E7E1;
  --ink: var(--brand-ink, #14151A);
  --text: var(--brand-ink, #14151A);
  --text-muted: var(--brand-muted, #8A8D93);
  --accent: var(--brand-accent, #FF4D2E);
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(255,77,46,0.10);
  --accent-2: var(--brand-accent-2, #14151A);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shell-max: 460px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-card: 0 1px 2px rgba(20,21,26,0.04), 0 10px 30px -12px rgba(20,21,26,0.08);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4{ font-family: var(--font-display); margin:0; letter-spacing:-0.01em; }
p{ margin:0; }
a{ color:inherit; text-decoration:none; }
button{ font-family: inherit; }
::selection{ background: var(--accent); color: #fff; }

/* =================================================================
   MOBİL (varsayılan): tam ekran, çerçevesiz — gerçek bir mobil
   uygulama gibi edge-to-edge. Sidebar gizli, alt navigasyon aktif.
   ================================================================= */
.layout{ display:flex; min-height:100vh; background: var(--bg); }
.sidebar{ display:none; }

.app-shell{
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  display:flex;
  flex-direction:column;
}
.app-shell--auth{
  min-height: 100vh;
  align-items: stretch;
}

/* =================================================================
   MASAÜSTÜ (≥ 900px): klasik/premium bir web uygulaması — sol sabit
   sidebar navigasyon + normal genişlikte okunabilir içerik sütunu.
   Telefon çerçevesi / bezel YOK.
   ================================================================= */
@media (min-width: 900px){
  body{ background: var(--bg); }

  .layout{
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
  }

  .sidebar{
    display:flex;
    flex-direction:column;
    width: 248px;
    flex-shrink:0;
    padding: 26px 18px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top:0;
    height: 100vh;
  }
  .sidebar__brand{ display:flex; align-items:center; gap:11px; padding: 6px 10px 26px; }
  .sidebar__appname{ font-size:15px; font-weight:700; font-family: var(--font-display); }
  .sidebar__city{ font-size:11.5px; color: var(--text-muted); margin-top:1px; }
  .sidebar__nav{ display:flex; flex-direction:column; gap:3px; flex:1; }
  .sidebar__link{
    display:flex; align-items:center; gap:12px;
    padding: 11px 12px; border-radius: 12px;
    font-size:13.5px; font-weight:600; color: var(--text-muted);
  }
  .sidebar__link:hover{ background: var(--surface-2); color: var(--ink); }
  .sidebar__link.is-active{ background: var(--ink); color:#fff; }
  .sidebar__user{
    display:flex; align-items:center; gap:10px;
    padding: 12px 10px 6px; border-top:1px solid var(--border); margin-top:10px;
  }
  .avatar-sm{
    width:32px; height:32px; border-radius:9px; flex-shrink:0;
    background: var(--accent); color:#fff;
    display:flex; align-items:center; justify-content:center;
    font-family: var(--font-display); font-weight:700; font-size:13px;
  }
  .sidebar__user-info{ flex:1; min-width:0; }
  .sidebar__user-name{ font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .sidebar__user-meta{ font-size:10.5px; color: var(--text-muted); font-family: var(--font-mono); }

  .app-shell{ flex:1; min-height:100vh; background: var(--bg); }
  .app-shell--auth{
    max-width: 460px;
    margin: 0 auto;
    min-height: 100vh;
    justify-content:center;
    display:flex;
  }

  /* Masaüstünde marka/kullanıcı bilgisi sidebar'da olduğu için üst bar gizlenir */
  .app-topbar{ display:none; }
  /* Masaüstünde alt navigasyon yerine sidebar kullanılır */
  .bottom-nav{ display:none; }

  .app-content{
    width: 100%;
    flex: none;
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 40px 64px !important;
  }
  .app-content--full{ padding:0 !important; max-width:none; }

  /* Masaüstünde giriş/kayıt ekranı sayfanın ortasında bir kart gibi görünür */
  .app-shell--auth .app-content--full{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:100vh;
    flex: none;
  }
  .app-shell--auth .auth-screen{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 44px 40px 36px;
    min-height: auto;
    width: 100%;
  }
}

/* ---------- TOPBAR ---------- */
.app-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 22px 22px 8px;
  flex-shrink:0;
}
.app-topbar__brand{ display:flex; align-items:center; gap:11px; }
.brand-mark{
  width:38px; height:38px; border-radius:11px;
  background: var(--ink);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display); font-weight:700; font-size:16px;
}
.app-topbar__appname{ font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color: var(--accent); }
.app-topbar__greeting{ font-family: var(--font-display); font-weight:600; font-size:14.5px; margin-top:1px; }
.icon-btn{
  width:38px; height:38px; border-radius:11px;
  display:flex; align-items:center; justify-content:center;
  background: var(--surface); color: var(--text-muted);
  border:1px solid var(--border);
  transition: color .15s, border-color .15s;
}
.icon-btn:hover{ color:var(--ink); border-color:#d8d6ce; }

/* ---------- CONTENT AREA ---------- */
.app-content{
  flex:1;
  overflow-y:auto;
  padding: 18px 20px 116px;
  -webkit-overflow-scrolling: touch;
}
.app-content--full{ padding: 0; }
.app-content::-webkit-scrollbar{ width:0; }

/* ---------- BOTTOM NAV ---------- */
.bottom-nav{
  position: sticky;
  bottom:0; left:0; right:0;
  display:flex;
  background: rgba(250,250,248,0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
  flex-shrink:0;
}
.bottom-nav__item{
  flex:1;
  display:flex; flex-direction:column; align-items:center; gap:4px;
  color: var(--text-muted);
  font-size:10.5px; font-weight:600;
  padding:6px 0;
  border-radius:14px;
}
.bottom-nav__item.is-active{ color: var(--accent); }
.bottom-nav__item--fab svg{
  background: var(--ink); color:#fff; padding:7px; border-radius:12px; box-sizing:content-box;
}
.bottom-nav__item--fab.is-active svg{ background: var(--accent); }

/* ---------- TYPOGRAPHY HELPERS ---------- */
.eyebrow{ font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color: var(--accent); }
.h1{ font-size:25px; font-weight:700; line-height:1.15; }
.h2{ font-size:18px; font-weight:600; }
.muted{ color: var(--text-muted); font-size:13.5px; line-height:1.5; }
.mono{ font-family: var(--font-mono); }

/* ---------- CARD ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.card + .card{ margin-top:14px; }
.card-dark{ background: var(--ink); color:#fff; border:none; }
.card-dark .muted{ color: rgba(255,255,255,0.6); }

/* ---------- BUTTONS ---------- */
.btn{
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%;
  padding: 15px 20px;
  border-radius: 16px;
  border:none;
  font-family: var(--font-display);
  font-weight:600; font-size:14.5px;
  cursor:pointer;
  transition: transform .12s ease, opacity .15s ease, box-shadow .15s ease;
}
.btn:active{ transform: scale(0.97); }
.btn-primary{
  background: var(--accent); color: #fff;
  box-shadow: 0 12px 24px -10px rgba(255,77,46,0.45);
}
.btn-primary:hover{ opacity:.93; }
.btn-primary[disabled]{ opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-dark{ background: var(--ink); color:#fff; }
.btn-ghost{ background: var(--surface); color: var(--text); border:1px solid var(--border); }
.btn-text{ background:none; color: var(--accent); width:auto; padding:10px; }
.btn-sm{ padding:10px 14px; font-size:12.5px; width:auto; }

/* ---------- FORMS ---------- */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12.5px; font-weight:600; color:var(--text-muted); margin-bottom:7px; }
.field input, .field select, .field textarea{
  width:100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size:15px;
  padding: 13px 15px;
  border-radius: 14px;
  outline:none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color: var(--accent); }
.field-row{ display:flex; gap:12px; }
.field-row .field{ flex:1; }

.alert{
  background: rgba(255,77,46,0.08);
  border: 1px solid rgba(255,77,46,0.3);
  color: #C7391E;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-success{ background: rgba(30,160,90,0.08); border: 1px solid rgba(30,160,90,0.3); color: #1E8A50; }

/* ---------- AUTH SCREENS ---------- */
.auth-screen{ min-height: 100%; display:flex; flex-direction:column; padding: 44px 26px 32px; }
.auth-logo{
  width:52px; height:52px; border-radius:15px;
  background: var(--ink);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display); font-weight:700; font-size:20px;
  margin-bottom: 20px;
}
.auth-foot{ margin-top:auto; text-align:center; font-size:13.5px; color:var(--text-muted); padding-top:24px; }
.auth-foot a{ color: var(--accent); font-weight:600; }

/* ---------- BODY TYPE SELECTOR ---------- */
.bodytype-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; }
.bodytype-card{
  position:relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px 12px;
  text-align:center;
  cursor:pointer;
  color: var(--text-muted);
  transition: border-color .15s, background .15s;
}
.bodytype-card svg{ width:44px; height:58px; }
.bodytype-card span{ display:block; margin-top:8px; font-size:11.5px; font-weight:600; }
.bodytype-card input{ position:absolute; opacity:0; pointer-events:none; }
.bodytype-card.is-selected{ border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.bodytype-card.is-selected span{ color: var(--accent); }

/* ---------- PILLS ---------- */
.pill-group{ display:flex; flex-wrap:wrap; gap:8px; }
.pill{
  border:1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size:12.5px; font-weight:600;
  padding: 10px 15px;
  border-radius: 100px;
  cursor:pointer;
}
.pill input{ display:none; }
.pill.is-selected{ border-color:var(--accent); color:#fff; background: var(--accent); }

/* ---------- DASHBOARD STATS ---------- */
.stat-row{ display:flex; gap:10px; }
.stat-box{
  flex:1;
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  box-shadow: var(--shadow-card);
}
.stat-box .v{ font-family: var(--font-mono); font-size:19px; font-weight:700; }
.stat-box .l{ font-size:10.5px; color:var(--text-muted); margin-top:2px; }

.streak-card{
  border-radius: var(--radius-lg);
  background: var(--ink);
  color:#fff;
  padding: 20px;
  display:flex; align-items:center; gap:16px;
  position:relative; overflow:hidden;
}
.streak-card::after{
  content:"";
  position:absolute; right:-30px; top:-30px;
  width:140px; height:140px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,77,46,0.35), transparent 70%);
}
.streak-flame{
  width:52px; height:52px; border-radius:16px;
  background: var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:24px; flex-shrink:0;
}
.streak-card .v{ font-family: var(--font-mono); font-size:26px; font-weight:700; }
.streak-card .l{ font-size:12px; color: rgba(255,255,255,0.65); }

.week-row{ display:flex; justify-content:space-between; margin-top:14px; }
.week-day{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.week-day .d{ font-size:10.5px; color: var(--text-muted); font-weight:600; }
.week-dot{
  width:30px; height:30px; border-radius:50%;
  background: var(--surface-2);
  border:1.5px solid var(--border);
  display:flex; align-items:center; justify-content:center;
}
.week-dot.is-done{ background: var(--accent); border-color: var(--accent); }
.week-dot.is-today{ border-color: var(--ink); border-width:2px; }
.week-dot svg{ color:#fff; }

/* ---------- PLAN HERO ---------- */
.plan-hero{
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.exercise-row{ display:flex; align-items:center; gap:12px; padding: 13px 0; border-bottom: 1px solid var(--border); cursor:pointer; }
.exercise-row:last-child{ border-bottom:none; }
.exercise-row__num{
  width:28px; height:28px; flex-shrink:0; border-radius:9px;
  background: var(--surface-2);
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-mono); font-size:11.5px; font-weight:700; color: var(--accent);
}
.exercise-row__name{ font-weight:600; font-size:14px; }
.exercise-row__meta{ font-size:11.5px; color:var(--text-muted); margin-top:2px; }
.exercise-row__sets{ margin-left:auto; font-family: var(--font-mono); font-size:12.5px; color:var(--text); text-align:right; white-space:nowrap; }
.exercise-row__chev{ color: var(--text-muted); flex-shrink:0; transition: transform .2s; }
.exercise-row.is-open .exercise-row__chev{ transform: rotate(90deg); }

/* ---------- EXERCISE DETAIL ---------- */
.exercise-detail{ display:none; padding: 4px 0 18px 40px; border-bottom: 1px solid var(--border); }
.exercise-detail.is-open{ display:block; }
.exercise-flip{ width:100%; aspect-ratio: 4/3; border-radius: 14px; overflow:hidden; background: var(--surface-2); position:relative; margin-bottom:12px; }
.exercise-flip img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition: opacity .5s ease-in-out; }
.exercise-flip img.is-visible{ opacity:1; }
.exercise-flip__badge{
  position:absolute; top:8px; right:8px; z-index:2;
  background: rgba(20,21,26,0.65); color:#fff; font-size:9.5px; font-weight:700;
  padding:3px 8px; border-radius:100px; letter-spacing:.04em; text-transform:uppercase;
}
.exercise-detail h4{ font-size:12px; font-weight:700; margin-bottom:6px; color: var(--text-muted); text-transform:uppercase; letter-spacing:.05em; }
.exercise-detail ol, .exercise-detail ul{ margin:0 0 14px; padding-left:18px; }
.exercise-detail li{ font-size:13px; line-height:1.6; margin-bottom:4px; }
.exercise-detail .tip-box{ background: var(--accent-soft); border-radius:12px; padding:10px 12px; font-size:12.5px; color:var(--ink); }

/* ---------- FEEDBACK ---------- */
.feedback-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-top:12px; }
.feedback-btn{
  border:1.5px solid var(--border); background: var(--surface);
  border-radius:12px; padding:10px 8px; font-size:11.5px; font-weight:600;
  display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer;
  color: var(--text);
}
.feedback-btn span.emoji{ font-size:18px; }
.feedback-btn.is-selected{ border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.feedback-btn.is-done{ opacity:.55; pointer-events:none; }

/* ---------- CHECK-IN ---------- */
.checkin-tabs{ display:flex; gap:8px; margin-bottom:16px; background: var(--surface-2); padding:4px; border-radius:14px; }
.checkin-tab{ flex:1; text-align:center; padding:10px; border-radius:11px; font-size:13px; font-weight:600; color: var(--text-muted); cursor:pointer; }
.checkin-tab.is-active{ background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

.qr-frame{ background:#fff; border-radius:20px; padding:18px; display:flex; align-items:center; justify-content:center; border: 1px solid var(--border); }
.qr-frame img{ width:100%; max-width:220px; display:block; }

.member-card{
  border-radius: 20px;
  background: linear-gradient(135deg, var(--ink), #2c2e35 55%, var(--accent) 140%);
  color:#fff; padding: 22px; position:relative; overflow:hidden;
  aspect-ratio: 1.586/1; display:flex; flex-direction:column; justify-content:space-between;
}
.member-card::after{
  content:""; position:absolute; right:-40px; bottom:-40px; width:160px; height:160px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,77,46,0.4), transparent 70%);
}
.member-card__top{ display:flex; justify-content:space-between; align-items:flex-start; }
.member-card__chip{ width:36px; height:26px; border-radius:6px; background: rgba(255,255,255,0.25); }
.member-card__brand{ font-family: var(--font-display); font-weight:700; font-size:16px; letter-spacing:.02em; }
.member-card__name{ font-size:15px; font-weight:600; }
.member-card__no{ font-family: var(--font-mono); font-size:12.5px; letter-spacing:.06em; color: rgba(255,255,255,0.75); }

.checkin-result{ text-align:center; padding: 30px 10px 10px; }
.checkin-result__icon{ width:64px; height:64px; border-radius:50%; background: var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; margin:0 auto 14px; }

.attendance-item{ display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.attendance-item:last-child{ border-bottom:none; }
.attendance-item__icon{ width:36px; height:36px; border-radius:10px; background: var(--surface-2); display:flex; align-items:center; justify-content:center; color: var(--accent); flex-shrink:0; }
.attendance-item__date{ font-weight:600; font-size:13.5px; }
.attendance-item__meta{ font-size:11.5px; color: var(--text-muted); }

/* ---------- BESLENME ---------- */
.macro-bar{ display:flex; height:10px; border-radius:100px; overflow:hidden; background: var(--surface-2); margin-top:10px; }
.macro-bar span{ height:100%; }
.macro-legend{ display:flex; gap:14px; margin-top:10px; flex-wrap:wrap; }
.macro-legend-item{ display:flex; align-items:center; gap:6px; font-size:11.5px; color: var(--text-muted); }
.macro-dot{ width:8px; height:8px; border-radius:50%; }

.meal-card{ display:flex; gap:12px; padding:14px 0; border-bottom:1px solid var(--border); }
.meal-card:last-child{ border-bottom:none; }
.meal-card__time{ width:52px; flex-shrink:0; font-family: var(--font-mono); font-size:12px; color: var(--text-muted); padding-top:2px; }
.meal-card__name{ font-weight:600; font-size:14.5px; }
.meal-card__cal{ font-family: var(--font-mono); font-size:11.5px; color: var(--accent); margin-top:2px; }
.meal-card ul{ margin:8px 0 0; padding-left:16px; }
.meal-card li{ font-size:12.5px; color: var(--text); line-height:1.5; margin-bottom:2px; }

/* ---------- GENEL ---------- */
.empty-state{ text-align:center; padding: 40px 20px; color: var(--text-muted); }
.empty-state svg{ margin-bottom:14px; opacity:.5; }

.spinner{ width:16px; height:16px; border-radius:50%; border: 2.5px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin{ to{ transform: rotate(360deg); } }

.source-tag{
  display:inline-flex; align-items:center; gap:5px;
  font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  padding: 4px 9px; border-radius:100px;
  background: var(--surface-2); color: var(--text-muted);
  border:1px solid var(--border);
}
.source-tag.is-ai{ color: var(--accent); border-color: rgba(255,77,46,0.3); background: var(--accent-soft); }

.section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.section-head a{ font-size:12px; font-weight:600; color: var(--accent); }

.tag-row{ display:flex; gap:6px; flex-wrap:wrap; }
.tag{ font-size:10.5px; font-weight:600; color: var(--text-muted); background: var(--surface-2); padding:4px 9px; border-radius:100px; }

/* ---------- MASAÜSTÜ KESİN ÖVERRIDE (cascade sırası garantisi) ---------- */
@media (min-width: 900px){
  .app-topbar{ display:none !important; }
  .bottom-nav{ display:none !important; }
}
