/* ═══════════════════════════════════════════════════════════
   NIHONGO GAKUIN — SHARED MOBILE-APP DESIGN SYSTEM
   Drop this in every page: <link rel="stylesheet" href="mobile-app.css">
   (or ../mobile-app.css from subdirectories)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Noto+Sans+JP:wght@400;700&display=swap');

/* ─── TOKENS ───────────────────────────────────────────── */
:root {
  --pri:        #ff4b4b;
  --pri-dk:     #e03c3c;
  --pri-lt:     #fff0f0;
  --gold:       #ffc800;
  --gold-dk:    #e6b400;
  --green:      #58cc02;
  --green-dk:   #4aab02;
  --blue:       #1cb0f6;
  --blue-dk:    #0097db;
  --purple:     #ce82ff;
  --purple-dk:  #a560d4;
  --orange:     #ff9600;
  --orange-dk:  #e07800;
  --bg:         #f7f7f7;
  --card:       #ffffff;
  --txt:        #1a1a1a;
  --txt-mid:    #4b4b4b;
  --txt-lt:     #777;
  --border:     #e5e5e5;
  --shad:       0 4px 16px rgba(0,0,0,.08);
  --shad-btn:   0 5px 0;
  --r-btn:      14px;
  --r-card:     20px;
  --r-pill:     999px;
  --nav-h:      68px;
  --header-h:   64px;
}

/* ─── RESET ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ─── LAYOUT ───────────────────────────────────────────── */
.ng-wrap {
  width: 100%;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 16px);
}
.ng-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}
/* Page inner content (below header) */
.ng-body { padding: 24px 0 40px; }

/* ─── TOP NAV BAR ──────────────────────────────────────── */
.ng-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.ng-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 16px;
}
.ng-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.ng-logo-icon {
  width: 38px; height: 38px;
  background: var(--pri);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 3px 0 var(--pri-dk);
  flex-shrink: 0;
}
.ng-logo-text {
  font-size: 1rem;
  font-weight: 900;
  color: var(--txt);
  line-height: 1.1;
}
.ng-logo-text small {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--pri);
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: .04em;
}
/* Desktop nav links */
.ng-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.ng-nav-links a {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--txt-mid);
  padding: 7px 14px;
  border-radius: 10px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.ng-nav-links a:hover { background: var(--bg); color: var(--pri); }
.ng-nav-links a.active { background: var(--pri-lt); color: var(--pri); }
/* Right actions */
.ng-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* Hamburger */
.ng-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  background: var(--bg);
  border: 2px solid var(--border);
}
.ng-hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--txt);
  border-radius: 2px;
  transition: all .25s;
}
.ng-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ng-hamburger.open span:nth-child(2) { opacity: 0; }
.ng-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
/* Mobile dropdown */
.ng-mobile-menu {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  z-index: 199;
  padding: 8px 0 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.ng-mobile-menu.open { display: block; }
.ng-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--txt-mid);
  border-bottom: 1px solid var(--bg);
  transition: background .15s;
}
.ng-mobile-menu a:hover, .ng-mobile-menu a.active { background: var(--pri-lt); color: var(--pri); }
.ng-mobile-menu a i { width: 22px; text-align: center; }

/* ─── PROGRESS STRIP (below topbar on student pages) ──── */
.ng-progress-strip {
  background: var(--card);
  border-bottom: 2px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ng-progress-strip .ng-container { display: flex; align-items: center; gap: 14px; }
.ng-progress-label { font-size: 0.72rem; font-weight: 800; color: var(--txt-lt); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.ng-pbar-track { flex: 1; height: 13px; background: var(--border); border-radius: var(--r-pill); overflow: hidden; }
.ng-pbar-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--green), #78e000); box-shadow: inset 0 2px 0 rgba(255,255,255,.35); transition: width 1s cubic-bezier(.22,1,.36,1); }
.ng-pbar-pct { font-size: 0.75rem; font-weight: 800; color: var(--green-dk); white-space: nowrap; }
.ng-streak { display: flex; align-items: center; gap: 5px; background: var(--gold); color: #7a4a00; font-weight: 800; font-size: 0.8rem; padding: 5px 11px; border-radius: var(--r-pill); box-shadow: 0 3px 0 var(--gold-dk); white-space: nowrap; }

/* ─── BOTTOM NAV (mobile) ──────────────────────────────── */
.ng-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--card);
  border-top: 2px solid var(--border);
  display: none;
  z-index: 300;
}
.ng-bottom-nav-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.ng-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--txt-lt);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: color .15s;
  border: none;
  background: none;
  cursor: pointer;
  padding-bottom: 4px;
}
.ng-nav-btn i { font-size: 1.25rem; transition: transform .15s; }
.ng-nav-btn:active i { transform: scale(.88); }
.ng-nav-btn.active { color: var(--pri); }
.ng-nav-btn.active i { filter: drop-shadow(0 2px 4px rgba(255,75,75,.4)); }
/* Centre FAB */
.ng-nav-fab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  margin-top: -14px;
  text-decoration: none;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--txt-lt);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ng-nav-fab {
  width: 50px; height: 50px;
  background: var(--pri);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.25rem;
  box-shadow: 0 4px 0 var(--pri-dk), 0 6px 14px rgba(255,75,75,.4);
  border: 3px solid var(--card);
  transition: transform .15s;
}
.ng-nav-fab-wrap:active .ng-nav-fab { transform: translateY(3px); box-shadow: 0 1px 0 var(--pri-dk); }

/* ─── BUTTONS ──────────────────────────────────────────── */
.ng-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-btn);
  font-family: inherit; font-size: .9rem; font-weight: 800;
  text-decoration: none; border: none; cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .12s;
  letter-spacing: .01em; user-select: none; min-height: 48px;
  white-space: nowrap;
}
.ng-btn:active { transform: translateY(3px); box-shadow: none !important; }
.ng-btn-primary { background: var(--pri); color: white; box-shadow: var(--shad-btn) var(--pri-dk); }
.ng-btn-primary:hover { background: #e83a3a; }
.ng-btn-green   { background: var(--green); color: white; box-shadow: var(--shad-btn) var(--green-dk); }
.ng-btn-blue    { background: var(--blue);  color: white; box-shadow: var(--shad-btn) var(--blue-dk); }
.ng-btn-gold    { background: var(--gold);  color: #7a4a00; box-shadow: var(--shad-btn) var(--gold-dk); }
.ng-btn-ghost   { background: var(--card);  color: var(--pri); box-shadow: 0 3px 0 var(--border); border: 2px solid var(--border); }
.ng-btn-ghost:hover { border-color: var(--pri); }
.ng-btn-sm { padding: 8px 16px; font-size: .78rem; min-height: 36px; border-radius: 10px; }
.ng-btn-full { width: 100%; }

/* ─── CARDS ────────────────────────────────────────────── */
.ng-card {
  background: var(--card);
  border-radius: var(--r-card);
  border: 2px solid var(--border);
  box-shadow: var(--shad);
  padding: 20px;
  margin-bottom: 16px;
}
.ng-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.ng-card-title {
  font-size: 1rem; font-weight: 900; color: var(--txt);
  display: flex; align-items: center; gap: 8px;
}
.ng-card-title i { color: var(--pri); font-size: .95rem; }

/* ─── STAT CHIPS ───────────────────────────────────────── */
.ng-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.ng-stat-chip {
  background: var(--card);
  border-radius: 16px;
  border: 2px solid var(--border);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shad);
}
.ng-stat-chip-num { font-size: 1.5rem; font-weight: 900; color: var(--pri); line-height: 1.1; margin-bottom: 4px; }
.ng-stat-chip-lbl { font-size: 0.65rem; font-weight: 700; color: var(--txt-lt); text-transform: uppercase; letter-spacing: .05em; }

/* ─── PAGE HERO ────────────────────────────────────────── */
.ng-page-hero {
  background: linear-gradient(135deg, var(--pri), #ff7f00);
  color: white;
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
}
.ng-page-hero::before {
  content: attr(data-kanji);
  position: absolute; right: -10px; top: -15px;
  font-size: 8rem; font-family: 'Noto Sans JP', sans-serif; font-weight: 700;
  color: rgba(255,255,255,.1); line-height: 1; pointer-events: none;
}
.ng-page-hero h1 { font-size: clamp(1.2rem, 4vw, 1.8rem); font-weight: 900; margin-bottom: 6px; position: relative; }
.ng-page-hero p  { font-size: 0.88rem; opacity: .9; position: relative; }

/* ─── SECTION HEADER ───────────────────────────────────── */
.ng-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; margin-top: 24px;
}
.ng-section-head h2 { font-size: 1rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.ng-section-head h2 i { color: var(--pri); }
.ng-section-head a { font-size: .75rem; font-weight: 800; color: var(--blue); text-decoration: none; text-transform: uppercase; letter-spacing: .04em; }

/* ─── LIST ROWS ────────────────────────────────────────── */
.ng-list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.ng-list-row:last-child { border-bottom: none; padding-bottom: 0; }
.ng-list-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.ng-list-body { flex: 1; min-width: 0; }
.ng-list-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--txt-lt); margin-bottom: 2px; }
.ng-list-value { font-size: .9rem; font-weight: 700; color: var(--txt); }

/* ─── BADGES & PILLS ───────────────────────────────────── */
.ng-badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 800;
  padding: 3px 9px; border-radius: var(--r-pill);
  text-transform: uppercase; letter-spacing: .04em;
}
.ng-badge-red    { background: var(--pri); color: white; }
.ng-badge-green  { background: var(--green); color: white; }
.ng-badge-blue   { background: var(--blue); color: white; }
.ng-badge-gold   { background: var(--gold); color: #7a4a00; }
.ng-badge-gray   { background: var(--border); color: var(--txt-lt); }
.ng-badge-orange { background: var(--orange); color: white; }

/* ─── TABLE ────────────────────────────────────────────── */
.ng-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; border: 2px solid var(--border); }
.ng-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.ng-table th { background: var(--bg); padding: 11px 16px; text-align: left; font-size: .78rem; font-weight: 800; color: var(--txt-lt); text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--border); }
.ng-table td { padding: 13px 16px; border-bottom: 1px solid var(--bg); font-size: .875rem; vertical-align: middle; }
.ng-table tr:last-child td { border-bottom: none; }
.ng-table tr:hover td { background: #fafafa; }

/* ─── FORM ─────────────────────────────────────────────── */
.ng-form-group { margin-bottom: 16px; }
.ng-label { display: block; font-size: .78rem; font-weight: 800; color: var(--txt-mid); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.ng-input {
  width: 100%; padding: 13px 16px;
  border: 2px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: .9rem; font-weight: 600;
  color: var(--txt); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.ng-input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(255,75,75,.15); }
.ng-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23777' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }

/* ─── PROFILE AVATAR ───────────────────────────────────── */
.ng-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 900; color: white;
  background: var(--pri); box-shadow: 0 5px 0 var(--pri-dk);
  flex-shrink: 0;
}
.ng-avatar-sm { width: 44px; height: 44px; font-size: 1.1rem; box-shadow: 0 3px 0 var(--pri-dk); }

/* ─── ACTIVITY FEED ────────────────────────────────────── */
.ng-activity { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ng-activity:last-child { border-bottom: none; }
.ng-activity-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: .85rem; flex-shrink: 0; }
.ng-activity-body { flex: 1; }
.ng-activity-title { font-size: .875rem; font-weight: 700; color: var(--txt); margin-bottom: 3px; }
.ng-activity-time  { font-size: .72rem; color: var(--txt-lt); }

/* ─── LESSON / COURSE CARDS ────────────────────────────── */
.ng-lesson-card {
  background: var(--card); border-radius: var(--r-card);
  padding: 15px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shad); border: 2px solid var(--border);
  text-decoration: none; color: inherit;
  transition: transform .15s, border-color .15s;
  margin-bottom: 10px;
}
.ng-lesson-card:hover { transform: translateY(-2px); border-color: var(--pri); }
.ng-lesson-card:active { transform: scale(.98); }
.ng-lesson-icon { width: 52px; height: 52px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.ng-lesson-body { flex: 1; min-width: 0; }
.ng-lesson-label { font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--txt-lt); margin-bottom: 3px; }
.ng-lesson-title { font-size: .95rem; font-weight: 800; margin-bottom: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ng-lesson-pbar  { height: 8px; background: var(--border); border-radius: var(--r-pill); overflow: hidden; }
.ng-lesson-pfill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--green), #78e000); }
.ng-lesson-arrow { color: var(--border); font-size: .9rem; flex-shrink: 0; }

/* icon colour helpers */
.ic-red    { background: var(--pri-lt);  box-shadow: 0 4px 0 #f0c0c0; }
.ic-blue   { background: #e8f7ff;        box-shadow: 0 4px 0 #b8e0f5; }
.ic-green  { background: #f0fff0;        box-shadow: 0 4px 0 #b8e8b8; }
.ic-gold   { background: #fff9e0;        box-shadow: 0 4px 0 #e8d880; }
.ic-purple { background: #f8f0ff;        box-shadow: 0 4px 0 #d8c0f0; }
.ic-orange { background: #fff5e0;        box-shadow: 0 4px 0 #f0d090; }

/* ─── ADMIN SIDEBAR LAYOUT ─────────────────────────────── */
.ng-admin-wrap { display: flex; min-height: 100vh; }
.ng-sidebar {
  width: 240px; flex-shrink: 0;
  background: #1a1a1a;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.ng-sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.ng-sidebar-brand span { font-size: .95rem; font-weight: 900; color: white; }
.ng-sidebar-brand small { display: block; font-size: .62rem; color: var(--gold); font-family: 'Noto Sans JP', sans-serif; }
.ng-sidebar-menu { list-style: none; padding: 12px 0; flex: 1; }
.ng-sidebar-menu li a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none; font-size: .875rem; font-weight: 700;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.ng-sidebar-menu li a:hover { background: rgba(255,255,255,.06); color: white; }
.ng-sidebar-menu li a.active { background: rgba(255,75,75,.15); color: var(--pri); border-left-color: var(--pri); }
.ng-sidebar-menu li a i { width: 18px; text-align: center; }
.ng-sidebar-badge { background: var(--pri); color: white; font-size: .6rem; padding: 2px 6px; border-radius: 99px; margin-left: auto; }
.ng-admin-main { flex: 1; min-width: 0; background: var(--bg); }

/* ─── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 900px) {
  .ng-stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Show hamburger, hide desktop nav */
  .ng-hamburger { display: flex; }
  .ng-nav-links { display: none; }
  /* Show bottom nav */
  .ng-bottom-nav { display: block; }
  .ng-wrap { padding-bottom: calc(var(--nav-h) + 16px); }
  /* Admin sidebar becomes a slide-in drawer */
  .ng-sidebar { position: fixed; left: -250px; top: 0; z-index: 400; height: 100vh; transition: left .28s; }
  .ng-sidebar.open { left: 0; }
  .ng-admin-main { width: 100%; }
}

@media (max-width: 480px) {
  .ng-stats-row { grid-template-columns: repeat(2, 1fr); }
  .ng-container { padding: 0 14px; }
}

/* ─── UTILITIES ────────────────────────────────────────── */
.ng-mt-0 { margin-top: 0 !important; }
.ng-mb-0 { margin-bottom: 0 !important; }
.ng-text-center { text-align: center; }
.ng-text-red    { color: var(--pri); }
.ng-text-green  { color: var(--green-dk); }
.ng-text-gray   { color: var(--txt-lt); }
.ng-flex { display: flex; align-items: center; gap: 10px; }
.ng-flex-between { display: flex; align-items: center; justify-content: space-between; }
.ng-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ng-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) {
  .ng-grid-2, .ng-grid-3 { grid-template-columns: 1fr; }
}
.ng-empty {
  text-align: center; padding: 40px 20px;
}
.ng-empty i { font-size: 3rem; color: var(--border); margin-bottom: 14px; display: block; }
.ng-empty p { color: var(--txt-lt); font-size: .9rem; margin-bottom: 18px; }

/* ─── ANIMATIONS ───────────────────────────────────────── */
@keyframes ngSlideUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
.ng-anim { animation: ngSlideUp .4s cubic-bezier(.22,1,.36,1) both; }
.ng-anim-d1 { animation-delay: .05s; }
.ng-anim-d2 { animation-delay: .10s; }
.ng-anim-d3 { animation-delay: .15s; }
.ng-anim-d4 { animation-delay: .20s; }
.ng-anim-d5 { animation-delay: .25s; }
