/* ==========================================================================
   ilge Academy — Canlı katman: hareket ölçeği, kişisel pano, hızlı arama,
   kutlama, mobil alt menü. Hareketler prefers-reduced-motion ile kapanır.
   ========================================================================== */

:root {
  /* Hareket ölçeği (transitions.dev motion tokens) */
  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: ease-in-out;
  --ease-out: ease-out;
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);
  --distance-micro: 4px;
  --distance-base: 8px;
  --distance-medium: 12px;
  --blur-medium: 3px;

  /* Modal (hızlı arama paleti) */
  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-scale: 0.96;
  --modal-scale-close: 0.96;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Başarı işareti */
  --check-opacity-dur: 500ms;
  --check-rotate-dur: 500ms;
  --check-rotate-from: 80deg;
  --check-bob-dur: 500ms;
  --check-y-amount: 40px;
  --check-blur-dur: 500ms;
  --check-blur-from: 10px;
  --check-path-dur: 500ms;
  --check-path-delay: 80ms;
  --check-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-opacity: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-rotate: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-bob: cubic-bezier(0.34, 1.35, 0.64, 1);
  --check-ease-path: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------------ Giriş hareketi (kartlar kademeli belirir) */
.js .reveal { opacity: 0; transform: translateY(var(--distance-medium)); filter: blur(var(--blur-medium)); }
.js .reveal.is-in {
  opacity: 1; transform: none; filter: none;
  transition:
    opacity var(--duration-very-slow) var(--ease-smooth-out),
    transform var(--duration-very-slow) var(--ease-smooth-out),
    filter var(--duration-very-slow) var(--ease-smooth-out);
  transition-delay: calc(var(--i, 0) * var(--duration-stagger) * 1.5);
}

/* Kart üzerine gelince: hafif yükselme + kapak yakınlaşması */
.course-card .cover > svg, .course-card .cover > img { transition: transform var(--duration-slow) var(--ease-smooth-out); }
.course-card:hover .cover > svg, .course-card:hover .cover > img { transform: scale(1.04); }
.card-mini[href], a.card-mini { transition: transform var(--duration-fast) var(--ease-smooth-out), box-shadow var(--duration-fast) var(--ease-smooth-out), border-color var(--duration-fast); }
a.card-mini:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* Kategori rengi */
.cat[style*="--cat-h"] { color: hsl(var(--cat-h) 60% 32%); display: inline-flex; align-items: center; gap: 6px; }
.cat[style*="--cat-h"]::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--cat-h) 65% 50%); }

/* İlerleme çubukları ve halkalar dolarak gelir */
.progress > span { transform-origin: left center; animation: progress-grow 900ms var(--ease-smooth-out) both; }
@keyframes progress-grow { from { transform: scaleX(0); } }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
.ring, .score-ring { animation: ring-fill 1100ms var(--ease-smooth-out) both; }
@keyframes ring-fill { from { --p: 0; } }

/* Birincil düğme: basınca yaylanma */
.btn-primary { transition: background var(--duration-quick), border-color var(--duration-quick), transform var(--duration-quick) var(--ease-smooth-out), box-shadow var(--duration-fast) var(--ease-smooth-out); }
.btn-primary:hover { box-shadow: 0 10px 24px -10px rgba(var(--brand-rgb),  .9); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px) scale(.99); }

/* ------------------------------------------------------------------ Üst bar: seri rozeti */
.streak-chip { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px 0 10px; border-radius: 99px; border: 1px solid var(--border); background: #fff; font-weight: 800; font-size: 13.5px; color: var(--muted); margin-right: 4px; transition: border-color var(--duration-quick), background var(--duration-quick); }
.streak-chip .flame { filter: grayscale(1); opacity: .6; font-size: 15px; }
.streak-chip.is-lit { background: #FFF6E8; border-color: #F7D9A8; color: #9A5B00; }
.streak-chip.is-lit .flame { filter: none; opacity: 1; animation: flame 2.4s var(--ease-in-out) infinite; display: inline-block; transform-origin: 50% 90%; }
.streak-chip:hover { border-color: var(--border-strong); }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.12) rotate(3deg); } }
.search kbd { font-size: 10.5px; }

/* ------------------------------------------------------------------ Hızlı arama paleti */
.palette-overlay { position: fixed; inset: 0; background: rgba(var(--ink-rgb),  .45); backdrop-filter: blur(2px); z-index: 80; opacity: 0; transition: opacity var(--modal-open-dur) var(--modal-ease); }
.palette-overlay.is-open { opacity: 1; }
.palette { position: fixed; z-index: 81; left: 50%; top: 12vh; width: min(640px, calc(100vw - 24px)); margin-left: calc(min(640px, calc(100vw - 24px)) / -2);
  background: #fff; border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(var(--ink-rgb),  .45), 0 0 0 1px var(--border); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-input .i { color: var(--dark-green); width: 20px; height: 20px; }
.palette-input input { flex: 1; border: 0; font-size: 17px; font-weight: 600; background: none; min-width: 0; }
.palette-input input:focus { outline: none; box-shadow: none; }
.palette kbd, .palette-foot kbd { font: 700 11px var(--font-body); color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface-2); }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--text); }
.palette-item .ibox { width: 34px; height: 34px; border-radius: 10px; }
.palette-item .t { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.palette-item .s { font-size: 12.5px; color: var(--muted); }
.palette-item .go { margin-left: auto; color: var(--subtle); opacity: 0; transition: opacity var(--duration-quick); }
.palette-item.is-active { background: var(--tint); }
.palette-item.is-active .go { opacity: 1; }
.palette-item mark { background: #FFF1C2; color: inherit; border-radius: 3px; padding: 0 1px; }
.palette-empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }

.t-modal {
  transform-origin: center;
  transform: scale(var(--modal-scale));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-open-dur) var(--modal-ease),
    opacity   var(--modal-open-dur) var(--modal-ease);
  will-change: transform, opacity;
}
.t-modal.is-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}
.t-modal.is-closing {
  transform: scale(var(--modal-scale-close));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--modal-close-dur) var(--modal-ease),
    opacity   var(--modal-close-dur) var(--modal-ease);
}

@media (prefers-reduced-motion: reduce) {
  .t-modal { transition: none !important; }
}

/* ------------------------------------------------------------------ Kutlama */
.celebrate { position: fixed; inset: 0; z-index: 95; pointer-events: none; display: grid; place-items: center; }
.celebrate .t-success-check svg { width: 96px; height: 96px; filter: drop-shadow(0 16px 30px rgba(var(--brand-rgb),  .45)); }
.celebrate.is-leaving { opacity: 0; transition: opacity var(--duration-medium) var(--ease-smooth-out); }
.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; opacity: 0;
  animation: confetti-burst 1100ms var(--ease-smooth-out) forwards; animation-delay: calc(var(--d) * 1ms); }
@keyframes confetti-burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

/* Başarı işareti (transitions.dev success check) */
.t-success-check {
  display: inline-block;
  transform-origin: center;
  opacity: 0;
  will-change: transform, opacity, filter;
}
.t-success-check svg { display: block; overflow: visible; }
.t-success-check svg path {
  stroke-dasharray: 29;
  stroke-dashoffset: 29;
}
.t-success-check[data-state="in"] {
  animation:
    t-check-fade   var(--check-opacity-dur) var(--check-ease-opacity) forwards,
    t-check-rotate var(--check-rotate-dur)  var(--check-ease-rotate)  forwards,
    t-check-blur   var(--check-blur-dur)    var(--check-ease-out)     forwards,
    t-check-bob    var(--check-bob-dur)     var(--check-ease-bob)     forwards;
}
.t-success-check[data-state="in"] svg path {
  animation: t-check-draw var(--check-path-dur) var(--check-ease-path) var(--check-path-delay, 0ms) forwards;
}
@keyframes t-check-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes t-check-rotate {
  from { transform: rotate(var(--check-rotate-from)); }
  to   { transform: rotate(0deg); }
}
@keyframes t-check-blur {
  from { filter: blur(var(--check-blur-from)); }
  to   { filter: blur(0); }
}
@keyframes t-check-bob {
  from { translate: 0 var(--check-y-amount); }
  to   { translate: 0 0; }
}
@keyframes t-check-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .t-success-check { animation: none !important; opacity: 1; }
  .t-success-check svg path { animation: none !important; stroke-dashoffset: 0 !important; }
}

/* ------------------------------------------------------------------ Kişisel pano (ana sayfa) */
.welcome { position: relative; overflow: hidden; border-radius: 26px; padding: 32px; color: #E8F6EF;
  background:
    radial-gradient(420px 260px at 92% -10%, rgba(var(--brand-rgb),  .35), transparent 70%),
    radial-gradient(360px 220px at 10% 120%, rgba(var(--brand-rgb), .12), transparent 70%),
    linear-gradient(150deg, var(--ink-4), var(--ink) 60%);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.welcome::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; border-radius: 50%; border: 1px dashed rgba(var(--brand-rgb),  .35); }
.welcome h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.02em; color: #fff; line-height: 1.15; }
.welcome .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s var(--ease-in-out) 600ms 2; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
.welcome p { color: rgba(255, 255, 255, 0.85); }
.welcome-stats { display: flex; gap: 12px; position: relative; z-index: 1; flex-wrap: wrap; }
.wstat { min-width: 118px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.wstat .k { font-size: 12px; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.wstat .v { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: #fff; margin-top: 2px; display: flex; align-items: baseline; gap: 6px; }
.wstat .v small { font-family: var(--font-body); font-size: 12px; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.week-dots { display: flex; gap: 6px; margin-top: 10px; }
.week-dots span { display: grid; justify-items: center; gap: 4px; font-size: 10.5px; color: rgba(255, 255, 255, 0.70); font-weight: 700; }
.week-dots i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); font-style: normal; font-size: 12px; }
.week-dots i.on { background: var(--primary-green); border-color: var(--primary-green); color: #fff; }
.week-dots i.today { box-shadow: 0 0 0 3px rgba(var(--brand-rgb),  .3); }

.continue-card { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; overflow: hidden; }
.continue-card .cover { aspect-ratio: auto; height: 100%; min-height: 180px; }
.continue-card .body { padding: 24px; display: grid; gap: 10px; align-content: center; }
.play-fab { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .95); display: grid; place-items: center; color: var(--dark-green); box-shadow: var(--shadow-lg); transition: transform var(--duration-fast) var(--ease-bounce); }
.continue-card:hover .play-fab { transform: scale(1.08); }
.play-fab .i { width: 26px; height: 26px; fill: currentColor; margin-left: 3px; }

.todo li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.todo li + li { border-top: 1px dashed var(--border); }
.todo .when { margin-left: auto; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.todo .when.urgent { color: var(--warning); }
.countdown { font-variant-numeric: tabular-nums; }

.onboard li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.onboard .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; color: transparent; }
.onboard li.done .tick { background: var(--primary-green); border-color: var(--primary-green); color: #fff; }
.onboard li.done a { color: var(--muted); text-decoration: line-through; }
.onboard .tick .i { width: 13px; height: 13px; stroke-width: 3; }

.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-grid a { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: 16px; background: #fff; border: 1px solid var(--border); font-weight: 700; font-size: 14px; transition: transform var(--duration-fast) var(--ease-smooth-out), box-shadow var(--duration-fast), border-color var(--duration-fast); }
.quick-grid a:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.quick-grid .n { font-family: var(--font-display); font-size: 22px; font-weight: 600; }

/* ------------------------------------------------------------------ Mobil alt menü */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 34;
    background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; border-radius: 12px;
    font: 700 11px var(--font-body); color: var(--muted); cursor: pointer; min-height: 48px;
  }
  .bottom-nav .i { width: 22px; height: 22px; }
  .bottom-nav .is-active { color: var(--dark-green); background: var(--tint); }
  .has-bottom-nav .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .has-bottom-nav .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .has-bottom-nav .topbar .icon-btn.menu-btn { display: none; }
  .hide-md { display: none; }
  .streak-chip { padding: 0 10px; }
  .welcome { grid-template-columns: minmax(0, 1fr); padding: 24px 20px; }
  .continue-card { grid-template-columns: minmax(0, 1fr); }
  .continue-card .cover { min-height: 150px; aspect-ratio: 16 / 7; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .palette { top: 8px; max-height: calc(100vh - 16px); border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; filter: none; }
  .progress > span, .ring, .score-ring, .streak-chip .flame, .welcome .wave, .confetti i { animation: none !important; }
}

.user-btn .name, .user-btn .role { white-space: nowrap; }

@media (max-width: 768px) {
  .welcome-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
  .wstat { min-width: 0; padding: 12px; }
  .wstat .v { font-size: 20px; }
  .wstat .k { font-size: 11px; }
  .week-dots { gap: 4px; }
}

/* Öğrenci Paneli bölüm kısayolları (home-user) */
.student-quick a { align-content: start; font-size: 13.5px; line-height: 1.35; }
.student-quick .chip { font-size: 11px; }
@media (max-width: 1100px) { .student-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .student-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
