/* ==========================================================
   monPass — mobile webview stylesheet
   Brand tokens derived from the monPass + NGARAGO logos
   ========================================================== */
:root{
  --mp-navy:        #0c1a3d;   /* "mon" wordmark ink */
  --mp-blue-deep:   #123a9c;
  --mp-blue:        #1e6fe0;
  --mp-blue-light:  #2fa8ec;
  --mp-purple:      #7b2ff2;
  --mp-purple-light:#9b4bff;
  --mp-teal:        #1fae8e;   /* NGARAGO wave accent */
  --mp-bg:          #f5f7fb;
  --mp-surface:     #ffffff;
  --mp-border:      #e3e8f2;
  --mp-text:        #16213e;
  --mp-text-mute:   #66708a;
  --mp-success:     #1fae6a;
  --mp-danger:      #e0435c;
  --mp-radius-lg:   22px;
  --mp-radius-md:   16px;
  --mp-radius-sm:   10px;
  --mp-shadow:      0 8px 24px rgba(18, 58, 156, 0.10);
  --mp-grad-brand:  linear-gradient(135deg, var(--mp-blue-light) 0%, var(--mp-blue) 45%, var(--mp-purple) 100%);
  --mp-grad-check:  linear-gradient(135deg, var(--mp-blue) 0%, var(--mp-purple-light) 100%);
  --mp-max-width:   480px;
  --mp-safe-top:    env(safe-area-inset-top, 0px);
  --mp-safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{ box-sizing: border-box; }
html,body{
  margin:0; padding:0; height:100%;
  background: var(--mp-bg);
  color: var(--mp-text);
  font-family: 'Poppins','Segoe UI',system-ui,-apple-system,sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
h1,h2,h3,h4{ font-family:'Poppins',sans-serif; font-weight:700; margin:0 0 8px; color:var(--mp-navy); }
p{ margin:0 0 12px; line-height:1.55; }
a{ color:var(--mp-blue); text-decoration:none; }
button, input, select, textarea{ font-family:inherit; font-size:16px; }
img{ max-width:100%; display:block; }

.mp-app{
  max-width: var(--mp-max-width);
  margin:0 auto;
  min-height:100vh;
  background: var(--mp-bg);
  display:flex;
  flex-direction:column;
  position:relative;
}

/* ---------- Top bar ---------- */
.mp-topbar{
  padding: calc(14px + var(--mp-safe-top)) 18px 14px;
  display:flex; align-items:center; gap:10px;
  background: var(--mp-surface);
  border-bottom:1px solid var(--mp-border);
  position:sticky; top:0; z-index:20;
}
.mp-topbar .mp-back{
  width:36px; height:36px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: var(--mp-bg); color:var(--mp-navy); border:none; font-size:18px;
}
.mp-topbar h1{ font-size:17px; margin:0; flex:1; }
.mp-topbar .mp-lang-pill{
  font-size:12px; font-weight:600; color:var(--mp-blue-deep);
  background:#eaf1ff; padding:5px 10px; border-radius:20px; border:none;
}

/* ---------- Brand hero ---------- */
.mp-hero{
  text-align:center; padding: 34px 24px 22px;
}
.mp-hero img.mp-logo{ width:112px; margin:0 auto 14px; }
.mp-hero h1{ font-size:26px; }
.mp-hero .mp-tagline{ color:var(--mp-text-mute); font-size:14px; }

/* ---------- Content area ---------- */
.mp-content{ flex:1; padding: 16px 18px calc(24px + var(--mp-safe-bottom)); }

/* ---------- Cards ---------- */
.mp-card{
  background: var(--mp-surface);
  border-radius: var(--mp-radius-md);
  box-shadow: var(--mp-shadow);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--mp-border);
}
.mp-card.mp-flat{ box-shadow:none; }

/* ---------- Grid tiles (langue / classes) ---------- */
.mp-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.mp-tile{
  background: var(--mp-surface); border:1.5px solid var(--mp-border);
  border-radius: var(--mp-radius-md); padding:18px 12px; text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  cursor:pointer; transition: transform .12s ease, border-color .12s ease;
}
.mp-tile:active{ transform: scale(0.97); }
.mp-tile.mp-selected{ border-color: var(--mp-blue); background:#f2f7ff; }
.mp-tile .mp-tile-emoji{ font-size:30px; }
.mp-tile .mp-tile-label{ font-weight:600; font-size:14px; }

/* ---------- List rows (classes, subjects, lessons) ---------- */
.mp-list{ display:flex; flex-direction:column; gap:10px; }
.mp-row{
  background: var(--mp-surface); border:1px solid var(--mp-border);
  border-radius: var(--mp-radius-md); padding:14px 14px;
  display:flex; align-items:center; gap:12px;
  box-shadow: var(--mp-shadow);
}
.mp-row .mp-row-icon{
  width:42px; height:42px; border-radius:12px; flex-shrink:0;
  background: var(--mp-grad-brand); color:#fff; font-size:18px;
  display:flex; align-items:center; justify-content:center; font-weight:700;
}
.mp-row .mp-row-body{ flex:1; min-width:0; }
.mp-row .mp-row-title{ font-weight:600; font-size:15px; color:var(--mp-navy); }
.mp-row .mp-row-sub{ font-size:12.5px; color:var(--mp-text-mute); }
.mp-row.mp-locked{ opacity:0.55; }
.mp-row .mp-chevron{ color:var(--mp-text-mute); }

.mp-badge{
  font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px;
  background:#eaf1ff; color:var(--mp-blue-deep);
}
.mp-badge.mp-badge-success{ background:#e6f8ee; color:var(--mp-success); }
.mp-badge.mp-badge-lock{ background:#f0f1f5; color:var(--mp-text-mute); }

/* ---------- Buttons ---------- */
.mp-btn{
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding:14px 18px; border-radius: var(--mp-radius-sm);
  border:none; font-weight:700; font-size:15.5px; cursor:pointer;
  background: var(--mp-grad-brand); color:#fff;
  box-shadow: 0 6px 16px rgba(30,111,224,0.30);
}
.mp-btn:active{ transform: scale(0.98); }
.mp-btn.mp-btn-outline{
  background:transparent; color:var(--mp-blue-deep); border:1.5px solid var(--mp-blue);
  box-shadow:none;
}
.mp-btn.mp-btn-ghost{
  background:transparent; color:var(--mp-text-mute); box-shadow:none;
}
.mp-btn.mp-btn-danger{ background:var(--mp-danger); box-shadow:0 6px 16px rgba(224,67,92,.25); }
.mp-btn.mp-btn-sm{ padding:9px 14px; font-size:13.5px; width:auto; }
.mp-btn:disabled{ opacity:0.5; }

/* ---------- Forms ---------- */
.mp-field{ margin-bottom:14px; }
.mp-field label{ display:block; font-size:13px; font-weight:600; color:var(--mp-navy); margin-bottom:6px; }
.mp-field input[type=text],
.mp-field input[type=email],
.mp-field input[type=password],
.mp-field input[type=number],
.mp-field input[type=date],
.mp-field select,
.mp-field textarea{
  width:100%; padding:12px 14px; border-radius: var(--mp-radius-sm);
  border:1.5px solid var(--mp-border); background:#fbfcfe; color:var(--mp-text);
}
.mp-field textarea{ min-height:90px; resize:vertical; }
.mp-field input:focus, .mp-field select:focus, .mp-field textarea:focus{
  outline:none; border-color: var(--mp-blue);
}
.mp-hint{ font-size:12px; color:var(--mp-text-mute); margin-top:6px; }
.mp-alert{ padding:12px 14px; border-radius: var(--mp-radius-sm); font-size:13.5px; margin-bottom:14px; }
.mp-alert-error{ background:#fdeced; color:var(--mp-danger); }
.mp-alert-success{ background:#e6f8ee; color:var(--mp-success); }

/* ---------- Bottom nav ---------- */
.mp-bottomnav{
  position:sticky; bottom:0; left:0; right:0;
  background: var(--mp-surface); border-top:1px solid var(--mp-border);
  display:flex; padding: 8px 6px calc(8px + var(--mp-safe-bottom));
  z-index:20;
}
.mp-bottomnav a{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
  font-size:11px; color:var(--mp-text-mute); padding:6px 0;
}
.mp-bottomnav a.active{ color:var(--mp-blue); font-weight:700; }
.mp-bottomnav .mp-nav-icon{ font-size:19px; }

/* ---------- Lesson content blocks ---------- */
.mp-block{ margin-bottom:18px; }
.mp-block img{ border-radius: var(--mp-radius-md); }
.mp-block video{ width:100%; border-radius: var(--mp-radius-md); }
.mp-block audio{ width:100%; }
.mp-block-caption{ font-size:12px; color:var(--mp-text-mute); margin-top:6px; text-align:center; }
.mp-block-chart{ background:#fbfcfe; border-radius:var(--mp-radius-md); padding:10px; border:1px solid var(--mp-border); }

/* ---------- Quiz ---------- */
.mp-quiz-progress{
  height:6px; border-radius:6px; background:var(--mp-border); overflow:hidden; margin-bottom:18px;
}
.mp-quiz-progress-bar{ height:100%; background: var(--mp-grad-brand); transition: width .25s ease; }
.mp-quiz-qcounter{ font-size:12.5px; color:var(--mp-text-mute); font-weight:600; margin-bottom:6px; }
.mp-quiz-question{ font-size:18px; font-weight:700; color:var(--mp-navy); margin-bottom:18px; }
.mp-choice{
  display:block; width:100%; text-align:left; padding:14px 16px; margin-bottom:10px;
  border-radius: var(--mp-radius-sm); border:1.5px solid var(--mp-border); background:#fff;
  font-size:14.5px; color:var(--mp-text);
}
.mp-choice.mp-choice-selected{ border-color:var(--mp-blue); background:#f2f7ff; font-weight:600; }
.mp-choice.mp-choice-correct{ border-color: var(--mp-success); background:#e6f8ee; }
.mp-choice.mp-choice-wrong{ border-color: var(--mp-danger); background:#fdeced; }

.mp-method-switch{ display:flex; gap:8px; margin-bottom:16px; }
.mp-method-switch button{
  flex:1; padding:9px; border-radius:20px; border:1.5px solid var(--mp-border);
  background:#fff; font-size:12.5px; font-weight:600; color:var(--mp-text-mute);
}
.mp-method-switch button.active{ background: var(--mp-grad-brand); color:#fff; border-color:transparent; }

.mp-mic-btn{
  width:84px; height:84px; border-radius:50%; margin:20px auto; display:flex;
  align-items:center; justify-content:center; font-size:32px; color:#fff;
  background: var(--mp-grad-check); border:none; box-shadow:0 8px 20px rgba(123,47,242,.35);
}
.mp-mic-btn.mp-listening{ animation: mp-pulse 1.1s infinite; }
@keyframes mp-pulse{
  0%{ box-shadow:0 0 0 0 rgba(123,47,242,.45); }
  70%{ box-shadow:0 0 0 18px rgba(123,47,242,0); }
  100%{ box-shadow:0 0 0 0 rgba(123,47,242,0); }
}
.mp-transcript{ text-align:center; min-height:24px; font-weight:600; color:var(--mp-navy); margin-bottom:10px; }

/* ---------- Result screen ---------- */
.mp-result{ text-align:center; padding: 30px 10px; }
.mp-result-ring{
  width:150px; height:150px; border-radius:50%; margin:0 auto 20px;
  display:flex; align-items:center; justify-content:center; flex-direction:column;
  background: conic-gradient(var(--mp-blue) calc(var(--pct,50) * 1%), var(--mp-border) 0);
  position:relative;
}
.mp-result-ring::before{
  content:''; position:absolute; inset:10px; border-radius:50%; background:#fff;
}
.mp-result-ring .mp-result-score{ position:relative; font-size:30px; font-weight:800; color:var(--mp-navy); }
.mp-result-ring .mp-result-total{ position:relative; font-size:12px; color:var(--mp-text-mute); }

/* ---------- Admin table ---------- */
.mp-admin-table{ width:100%; border-collapse: collapse; font-size:13.5px; }
.mp-admin-table th, .mp-admin-table td{ padding:10px 8px; border-bottom:1px solid var(--mp-border); text-align:left; }
.mp-admin-table th{ color:var(--mp-text-mute); font-weight:600; font-size:12px; text-transform:uppercase; }

.mp-fab{
  position:fixed; bottom:calc(80px + var(--mp-safe-bottom)); right: max(18px, calc((100vw - var(--mp-max-width))/2 + 18px));
  width:54px; height:54px; border-radius:50%; background: var(--mp-grad-brand); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:26px; border:none;
  box-shadow:0 8px 20px rgba(30,111,224,.4); z-index:25;
}

.mp-footer-credit{ text-align:center; font-size:11.5px; color:var(--mp-text-mute); padding:14px 0; }
.mp-footer-credit img{ height:16px; display:inline-block; vertical-align:middle; margin-right:5px; }

@media (min-width: 481px){
  body{ background: linear-gradient(180deg,#eef2fb,#e4e9f8); }
  .mp-app{ min-height:100vh; box-shadow: 0 0 60px rgba(18,58,156,0.12); }
}
