/* ═══════════════════════════════════════════════════════
   design.css — AuthSpace shared design system
   Single source of truth for tokens, fonts and the
   components that must look identical on every page
   (currently: the mobile bottom bar).
   Loaded by index.php directly and by every other page
   through theme.css.
═══════════════════════════════════════════════════════ */
@import url('vendor/fonts/fonts.css');

/* Smooth cross-document navigation (Chrome/Edge — no-op elsewhere) */
@view-transition {
  navigation: auto;
}

/* ── Tokens: dark is the default, body.light overrides ── */
:root {
  --bg:        #090c14;
  --surf:      #111420;
  --surf2:     #171b28;
  --surf3:     #1d2235;
  --border:    rgba(110,160,255,.10);
  --border2:   rgba(110,160,255,.22);
  --accent:    #3b82f6;
  --accent2:   #7c5ef5;
  --accent3:   #1fd4a4;
  --gold:      #f5c842;
  --danger:    #e05555;
  --text:      #dde2f2;
  --muted:     #8a90aa;   /* ≥4.5:1 σε όλες τις επιφάνειες (WCAG AA) */
  --muted2:    #3e4258;

  --fh: 'Syne', sans-serif;
  --fb: 'DM Sans', sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}
body.light {
  --bg:      #edf0f9;
  --surf:    #ffffff;
  --surf2:   #f3f5fc;
  --surf3:   #e7eaf5;
  --border:  rgba(79,142,247,.12);
  --border2: rgba(79,142,247,.28);
  --text:    #1a1d2e;
  --muted:   #5b6280;   /* ≥4.5:1 σε όλες τις επιφάνειες (WCAG AA) */
  --muted2:  #9aa1be;
  --accent:  #2d6bd8;
  --gold:    #8f6a08;
  --accent3: #087a5e;
}
/* Aliases: every page, whatever naming it grew up with, reads the same tokens.
   Declared on body too so that body.light re-resolves them (a var() on :root would stay dark). */
:root, body {
  --primary:          var(--accent);
  --primary-contrast: #ffffff;
  --auth-blue:        var(--accent);
  --success:          var(--accent3);
  --warning:          var(--gold);
  --info:             var(--accent);
  --surface:          var(--surf);
  --surface-alt:      var(--surf2);
  --card-bg:          var(--surf);
  --navbar-bg:        var(--surf);
  --navbar-text:      var(--text);
  --shadow:           rgba(0,0,0,.35);
  --card-shadow:      0 10px 30px rgba(0,0,0,.35);
  --nav-h:            56px;
}
body.light {
  --shadow:      rgba(31,45,90,.12);
  --card-shadow: 0 10px 30px rgba(31,45,90,.10);
}

/* ═══════════════════════════════════════════
   BASE — identical on every page
═══════════════════════════════════════════ */
html { font-size: 15px; }
body {
  font-family: var(--fb);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
h1,h2,h3,h4,h5,h6,.navbar-brand { font-family: var(--fh); }
a { color: var(--accent); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; }
body.dark { color-scheme: dark; }

/* ═══════════════════════════════════════════
   APP TOP BAR — the same header on every page (see topbar.php)
═══════════════════════════════════════════ */
.app-topbar {
  position: sticky; top: 0; z-index: 300;
  height: var(--nav-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--surf); border-bottom: .5px solid var(--border);
  font-family: var(--fb);
}
.app-topbar a { text-decoration: none; }
.tb-logo { display: flex; align-items: center; flex-shrink: 0; }
.tb-logo img { height: 30px; width: auto; display: block; }
.tb-title {
  margin: 0; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--fh); font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-title i { color: var(--accent); font-size: 18px; flex-shrink: 0; }
.tb-title span { overflow: hidden; text-overflow: ellipsis; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tb-btn, .tb-icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 20px;
  background: var(--surf2); border: .5px solid var(--border);
  color: var(--muted); font-family: var(--fh); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: color .2s, border-color .2s, background .2s;
}
.tb-icon { width: 34px; padding: 0; border-radius: 50%; }
.tb-btn:hover, .tb-icon:hover { color: var(--accent); border-color: var(--accent); background: rgba(79,142,247,.08); }
.tb-btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.tb-btn.primary:hover { opacity: .88; color: #fff; }
.tb-btn svg, .tb-icon svg { width: 16px; height: 16px; flex-shrink: 0; }
.tb-theme .sun { display: none; }
body.light .tb-theme .sun { display: block; }
body.light .tb-theme .moon { display: none; }
@media (max-width: 520px) { .tb-logo { display: none; } }
@media (max-width: 768px) {
  .app-topbar { padding: 0 10px; gap: 8px; }
  .tb-btn .tb-lbl { display: none; }
  .tb-btn { padding: 0; width: 34px; border-radius: 50%; }
  .tb-btn.has-text { width: auto; padding: 0 12px; border-radius: 20px; }
  .tb-btn.has-text .tb-lbl { display: inline; }
}

/* ═══════════════════════════════════════════
   MOBILE BOTTOM NAV — shared by every page
   (Αρχική / Κοινότητα / Updates / Μηνύματα / Εγώ)
═══════════════════════════════════════════ */
#mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px; background: var(--surf);
  border-top: .5px solid var(--border);
  z-index: 400;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  view-transition-name: mobile-nav;
}
.mob-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 9px; line-height: 1.2; font-family: var(--fh); font-weight: 600;
  color: var(--muted); cursor: pointer; height: 60px; padding: 0; transition: color .15s;
  text-decoration: none; border: none; background: transparent;
}
.mob-nav-item i { font-size: 20px; line-height: 1; }
.mob-nav-item.active,
.mob-nav-item:hover { color: var(--accent); }

@media (max-width: 768px) {
  #mobile-nav { display: grid; }
  body { padding-bottom: 64px; }
}

/* ═══════════════════════════════════════
   Προσβασιμότητα
═══════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; top: -48px; left: 12px; z-index: 10000;
  background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 0 0 var(--r-md) var(--r-md);
  font: 600 13px var(--fh); text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 0; color: #fff; }
/* ορατό focus για πληκτρολόγιο σε όλα τα διαδραστικά στοιχεία */
:where(a, button, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
/* μεγαλύτεροι στόχοι αφής σε κινητά (44px) */
@media (pointer: coarse) {
  .tb-icon { width: 44px; height: 44px; }
  .tb-btn { height: 44px; }
  .mob-nav-item { min-width: 44px; }
}
.mob-nav-item { font-size: 10px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}

/* ═══════════════════════════════════════
   Καταστάσεις φόρτωσης / κενού
═══════════════════════════════════════ */
.skeleton { position: relative; overflow: hidden; background: var(--surf2); border-radius: var(--r-md); min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(128,140,180,.16), transparent); animation: skel 1.2s infinite; }
@keyframes skel { to { transform: translateX(100%); } }
.empty-state { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 13px; }
.empty-state i { display: block; font-size: 30px; margin-bottom: 8px; opacity: .6; }
.empty-state b { display: block; color: var(--text); font: 700 14px var(--fh); margin-bottom: 4px; }
.empty-state a { color: var(--accent); font-weight: 600; }
.spin { display: inline-block; animation: spin360 1s linear infinite; }
@keyframes spin360 { to { transform: rotate(360deg); } }

/* Κάρτα «Επόμενο μάθημα» (next_class.js) */
.next-class { display: flex; align-items: center; gap: 12px; background: var(--surf); border: .5px solid var(--border2); border-left: 3px solid var(--accent);
  border-radius: var(--r-lg); padding: 12px 14px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.next-class > i { font-size: 20px; color: var(--accent); flex-shrink: 0; }
.next-class > div { min-width: 0; flex: 1; }
.next-class b { display: block; color: var(--text); font: 700 13px var(--fh); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-class > div > span { display: block; margin-top: 1px; }
.next-class .nc-time { font: 700 11px var(--fh); color: var(--accent3); background: rgba(31,212,164,.1); border-radius: 20px; padding: 4px 10px; white-space: nowrap; }
.next-class.live { border-left-color: var(--accent3); }
.next-class.exam { border-left-color: var(--danger); }
.next-class.exam > i { color: var(--danger); }
.next-class.muted { border-left-color: var(--border2); }
.next-class.muted > i { color: var(--muted); }
.next-class .nc-link { font: 600 11.5px var(--fh); color: var(--accent); background: none; border: .5px solid var(--border2); border-radius: 20px; padding: 4px 12px; text-decoration: none; cursor: pointer; white-space: nowrap; }

/* ═══════════════════════════════════════
   Gamification toasts
═══════════════════════════════════════ */
#gmToasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; width: min(420px, calc(100vw - 24px)); }
@media (max-width: 768px) { #gmToasts { bottom: 88px; } }
.gm-toast { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; max-width: 100%;
  background: var(--surf3); color: var(--text); border-radius: 18px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 14px 40px rgba(0,0,0,.4); opacity: 0; transform: translateY(14px) scale(.96); transition: opacity .3s, transform .35s cubic-bezier(.34,1.56,.64,1); }
.gm-toast.in { opacity: 1; transform: none; }
.gm-toast b { display: block; font: 700 13.5px var(--fh); }
.gm-toast div span { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.gm-xp-pill { font: 800 14px var(--fh); color: #fff; padding: 4px 12px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.gm-t-label { color: var(--muted); font-size: 12.5px; }
.gm-toast.xp { padding: 7px 14px 7px 8px; border-radius: 999px; }
.gm-toast.big { padding: 14px 20px; border: 1.5px solid color-mix(in srgb, var(--gold) 60%, transparent); box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 4px color-mix(in srgb, var(--gold) 12%, transparent); }
.gm-ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 800 18px var(--fh); font-size: 21px; color: #fff; }
.gm-ic.ok { background: var(--accent3); }
.gm-ic.fire { background: linear-gradient(135deg, #ff9a3c, #e05555); }
.gm-ic.lvl { background: linear-gradient(135deg, var(--accent), var(--accent2)); font-size: 20px; }
.gm-ic.tier1 { background: linear-gradient(135deg, #cd7f32, #a65f1c); }
.gm-ic.tier2 { background: linear-gradient(135deg, #b8c2d6, #7d8aa6); }
.gm-ic.tier3 { background: linear-gradient(135deg, #f5c842, #d99a1b); }
.gm-confetti { position: absolute; top: -8px; width: 7px; height: 11px; border-radius: 2px; opacity: 0; animation: gmFall 1.5s ease-out forwards; }
@keyframes gmFall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), 190px) rotate(var(--rot)); } }

/* ═══════════════════════════════════════
   Ανταμοιβές: αποκλειστικά dark themes (html[data-skin]), περιγράμματα avatar, εικονίδια ονόματος
═══════════════════════════════════════ */
html[data-skin="midnight"] body:not(.light) { --bg:#05070f; --surf:#0b1020; --surf2:#111830; --surf3:#18213f; --accent:#6aa2ff; --accent2:#8e7bff; --border:rgba(255,255,255,.07); --border2:rgba(255,255,255,.16); }
html[data-skin="forest"]   body:not(.light) { --bg:#0b110c; --surf:#121b14; --surf2:#19251b; --surf3:#223127; --accent:#7bd389; --accent2:#1fd4a4; --border:rgba(255,255,255,.07); --border2:rgba(255,255,255,.16); }
html[data-skin="aurora"]   body:not(.light) { --bg:#06120f; --surf:#0c1c18; --surf2:#12261f; --surf3:#1a3329; --accent:#1fd4a4; --accent2:#3b82f6; --border:rgba(255,255,255,.07); --border2:rgba(255,255,255,.16); }
html[data-skin="ember"]    body:not(.light) { --bg:#130a08; --surf:#1c100d; --surf2:#26160f; --surf3:#321d14; --accent:#ff7a3d; --accent2:#e05555; --border:rgba(255,255,255,.07); --border2:rgba(255,255,255,.16); }
html[data-skin="sakura"]   body:not(.light) { --bg:#140a12; --surf:#1d1019; --surf2:#271622; --surf3:#331d2d; --accent:#ff6fa5; --accent2:#a06bff; --border:rgba(255,255,255,.07); --border2:rgba(255,255,255,.16); }

.ring-green  { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #1fd4a4 !important; }
.ring-purple { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #a06bff !important; }
.ring-pink   { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #ff6fa5 !important; }
.ring-gold   { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #f5c842, 0 0 14px rgba(245,200,66,.45) !important; }
.ring-flame  { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #ff7a3d, 0 0 14px rgba(255,122,61,.55) !important; animation: ringFlame 1.4s ease-in-out infinite; }
.ring-rainbow { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #a06bff, 0 0 14px rgba(160,107,255,.5) !important; animation: ringRainbow 4s linear infinite; }
@keyframes ringFlame { 0%,100% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #ff7a3d, 0 0 10px rgba(255,122,61,.45); } 50% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #f5c842, 0 0 20px rgba(255,90,40,.75); } }
@keyframes ringRainbow { 0% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #ff5d5d, 0 0 14px rgba(255,93,93,.5); } 25% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #f5c842, 0 0 14px rgba(245,200,66,.5); }
  50% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #1fd4a4, 0 0 14px rgba(31,212,164,.5); } 75% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #3b82f6, 0 0 14px rgba(59,130,246,.5); } 100% { box-shadow: 0 0 0 2px var(--surf), 0 0 0 4.5px #ff5d5d, 0 0 14px rgba(255,93,93,.5); } }
.avatar-ring[class*="ring-"] { background: transparent !important; }
.name-ic { font-size: .95em; vertical-align: -.1em; margin-left: 3px; }
