/* ============================================================
   GODDY TABI — BASE & RESET
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--regular);
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; outline: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }

/* ── App root ── */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Auth screens fill the whole app before shell loads */
#app > .screen {
  flex: 1;
}

/* ── Screen system ── */
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}
.screen.active { display: flex; flex-direction: column; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, #EEF1F8 25%, #E4E8F2 50%, #EEF1F8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Spinner ── */
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--navy);
  border-radius: var(--r-full);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: white;
  padding: 12px 20px;
  border-radius: var(--r-2xl);
  font-size: var(--text-sm);
  font-weight: var(--semibold);
  /* Was "nowrap" with no width limit — fine for short messages like
     "Profile updated!", but any longer message (several already exist,
     e.g. the notifications-blocked toast, and more were added for
     Spotlight's new specific upload errors) just ran off both edges of
     the screen on a phone instead of wrapping, making it unreadable.
     Capping the width and allowing wrap fixes every toast in the app,
     not just the new ones. */
  white-space: normal;
  max-width: min(92vw, 420px);
  text-align: center;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: all var(--base);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber); }

/* A "new notification arrived" toast — tap it and go straight to what
   it's about, instead of just announcing that something happened and
   leaving a parent/teacher to separately figure out what to do next. */
.toast--tappable {
  pointer-events: auto;
  cursor: pointer;
}

/* ── Dialog ── */
.dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--base);
}
.dialog-backdrop.open { opacity: 1; pointer-events: all; }
.dialog {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--s6);
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.92);
  transition: transform var(--spring);
}
.dialog-backdrop.open .dialog { transform: scale(1); }
.dialog__title { font-size: var(--text-md); font-weight: var(--bold); margin-bottom: var(--s2); }
.dialog__body  { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--s5); line-height: 1.6; }
.dialog__actions { display: flex; gap: var(--s3); }
.dialog__actions .btn { flex: 1; }

/* ── Utility ── */
.hidden { display: none !important; }
.flex   { display: flex; }
.col    { flex-direction: column; }
.center { align-items: center; justify-content: center; }
.gap-2  { gap: var(--s2); }
.gap-3  { gap: var(--s3); }
.gap-4  { gap: var(--s4); }
.mt-3   { margin-top: var(--s3); }
.mt-4   { margin-top: var(--s4); }
.mt-5   { margin-top: var(--s5); }
.w-full { width: 100%; }
