/* MT Exam Studio — app.css (global + Burmese typography)
   Design tokens now live in tokens.css (loaded before this file). */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* Background lives on body (NOT html) so body's background propagates to the
   canvas and the negative-z-index aurora/grid pseudo-elements paint above it. */
body { background-color: var(--color-bg); }

/* Smooth fade-in when switching language */
@keyframes mt-lang-fade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
body.lang-switching [data-i18n],
body.lang-switching [data-i18n-placeholder],
body.lang-switching [data-i18n-title] {
  animation: mt-lang-fade var(--duration-slow) var(--ease) both;
}
@media (prefers-reduced-motion: reduce) {
  body.lang-switching [data-i18n],
  body.lang-switching [data-i18n-placeholder],
  body.lang-switching [data-i18n-title] {
    animation: none;
  }
}

/* Reveal-on-scroll ("appear") — hidden only when JS reveal is active */
html.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s var(--ease-enter), transform .55s var(--ease-enter);
  will-change: opacity, transform;
}
html.js-reveal [data-reveal].revealed {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html.js-reveal [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

input::placeholder, textarea::placeholder { color: var(--color-text-muted); }

a { color: var(--color-primary); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.mt-hidden { display: none !important; }

/* Boot loader — shown until the app is ready (body.mt-ready) */
#bootLoader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  transition: opacity .3s ease;
}
body.mt-ready #bootLoader { opacity: 0; pointer-events: none; }
.boot-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: boot-spin .8s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ===== Button system — exactly three levels =====
   Primary (emerald filled) · Secondary (white + green border) · Tertiary (text-only) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 35px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              transform .1s var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--color-primary-dark); box-shadow: 0 2px 10px rgba(22,138,74,.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* Secondary — calm outline */
.btn.secondary {
  background: var(--color-surface);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-border-strong);
}
.btn.secondary:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }

/* Tertiary — text only */
.btn.ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn.ghost:hover { background: var(--color-primary-pale); color: var(--color-primary-dark); }

.btn.danger { background: var(--color-error-bg); color: var(--color-error); border-color: transparent; }
.btn.danger:hover { background: #FFE3E3; color: var(--color-error); }

/* Sizes */
.btn.sm { height: 34px; padding: 0 12px; font-size: .82rem; border-radius: 10px; }
.btn.lg { height: 52px; padding: 0 24px; font-size: 1rem; }
.btn.icon { width: 40px; height: 40px; padding: 0; font-size: 1rem; }
.btn-ok { background: var(--color-primary); color: #fff; }
.btn-ok:hover { background: var(--color-primary-dark); }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--spacing);
  transition: transform var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(15,50,30,.09); }

/* Badges / pills */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .74rem;
  font-weight: 600;
}
.badge.ok { background: var(--color-ok-bg); color: var(--color-ok); }
.badge.warn { background: var(--color-warn-bg); color: var(--color-warn); }
.badge.err { background: var(--color-error-bg); color: var(--color-error); }
.badge.info { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge.neutral { background: var(--color-bg); color: var(--color-text-muted); }

/* Form fields */
.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .82rem;
  margin-bottom: 3px;
  color: var(--color-text);
}
.field .hint { font-size: .78rem; color: var(--color-text-muted); margin-top: 3px; }

.input, .select, .textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font-size: .95rem;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; }

/* Field label row + per-field hide button */
.field-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.btn-hide-field {
  border: 1px solid var(--color-error);
  cursor: pointer;
  font-size: .72rem;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 20px;
  color: var(--color-error);
  background: var(--color-error-bg);
  transition: color .15s, background .15s, border-color .15s;
  flex-shrink: 0;
}
.btn-hide-field:hover { opacity: .85; }
.btn-hide-field.hidden {
  color: var(--color-ok);
  background: var(--color-ok-bg);
  border-color: var(--color-ok);
}
.field-hidden .input,
.field-hidden .select,
.field-hidden .field-label-row label {
  text-decoration: line-through;
  color: #999;
  opacity: .7;
}

.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .input, .input-group .select { flex: 1; }

/* Utilities */
.mt-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mt-row > .field { min-width: 0; }
.mt-col { display: flex; flex-direction: column; gap: 8px; }
.mt-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mt-grow { flex: 1; }
.mt-muted { color: var(--color-text-muted); }
.mt-error { color: var(--color-error); }
.mt-ok { color: var(--color-ok); }
.mt-center { text-align: center; }
.mt-mt-0 { margin-top: 0; }
.mt-mb-0 { margin-bottom: 0; }
.mt-mb { margin-bottom: var(--spacing); }
.mt-mt { margin-top: var(--spacing); }
.mt-mr { margin-right: 8px; }
.mt-ml { margin-left: 8px; }
.mt-small { font-size: .82rem; }
.mt-bold { font-weight: 700; }
.mt-right { text-align: right; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ccd4; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #aab4bd; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 640px) {
  .btn:not(.sm) { height: 46px; }
  .btn.sm { height: 38px; }
}

@media (max-width: 900px) {
  html { font-size: 15px; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
}

/* ===== Landing / App mode toggle ===== */
body.seo-mode .app-shell,
body:not(.seo-mode) .seo-section { display: none; }
body.seo-mode .logo { cursor: pointer; }

/* Smooth page transitions — fade-in from bottom to top */

/* Landing → App: outgoing landing fades out + slides down */
body.seo-mode .seo-section.transitioning-out {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease, visibility 0s 300ms;
}

/* Landing → App: incoming app fades in + slides up from below */
body.seo-mode .app-shell.transitioning-in {
  display: block;
  opacity: 1;
  transform: none;
  transition: opacity 400ms ease, transform 400ms ease;
}

/* App → Landing: outgoing app fades out + slides down */
body:not(.seo-mode) .app-shell.transitioning-out {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease, visibility 0s 300ms;
}

/* App → Landing: incoming landing fades in + slides up from below */
body:not(.seo-mode) .seo-section.transitioning-in {
  display: block;
  opacity: 1;
  transform: none;
  transition: opacity 400ms ease, transform 400ms ease;
}

/* Block interaction during any page transition */
body.transitioning { pointer-events: none; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  body.seo-mode .seo-section.transitioning-out,
  body.seo-mode .app-shell.transitioning-in,
  body:not(.seo-mode) .app-shell.transitioning-out,
  body:not(.seo-mode) .seo-section.transitioning-in {
    transition: none;
  }
}

