/* ============================
   Mandarly Demo - Stylesheet
   Style inspiration: Cambly
   ============================ */

:root {
  --color-primary: #ff6b35;
  --color-primary-dark: #e8551f;
  --color-primary-light: #fff1ea;
  --color-accent: #2c3e50;
  --color-bg: #ffffff;
  --color-bg-soft: #fff8f2;
  --color-text: #1a1a1a;
  --color-text-soft: #6b7280;
  --color-border: #e5e7eb;
  --color-success: #10b981;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 24px 64px rgba(255, 107, 53, 0.18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --container: 1180px;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================
   Demo banner
   ============================ */
.demo-banner {
  background: linear-gradient(90deg, var(--color-primary), #ff8c42);
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
}

/* ============================
   Navbar
   ============================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: white;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  box-shadow: var(--shadow-md);
}

.brand-name {
  letter-spacing: -0.5px;
}

.brand.small { font-size: 16px; }
.brand.small .brand-logo { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }

.nav-links {
  display: flex;
  gap: 32px;
  margin-left: auto;
  margin-right: auto;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-soft);
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--color-text); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-soft);
  transition: all 0.2s;
}

.lang-toggle:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ============================
   Buttons
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-ghost {
  color: var(--color-text);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.btn-outline {
  background: white;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============================
   Hero
   ============================ */
.hero {
  background: var(--color-bg-soft);
  padding: 80px 0 100px;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero-text h1 {
  font-size: 56px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0 0 24px;
  color: var(--color-accent);
}

.hero-sub {
  font-size: 18px;
  color: var(--color-text-soft);
  margin: 0 0 36px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.stat strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
}

.stat span {
  font-size: 13px;
  color: var(--color-text-soft);
}

/* Hero illustration */
.hero-visual {
  position: relative;
  height: 480px;
}

.hero-card-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-illustration {
  position: absolute;
  inset: 40px 20px 40px 20px;
  background: linear-gradient(135deg, #ffd9c2, #ffefe5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.ill-frame {
  flex: 1;
  background: #1f2937;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.ill-video {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 35% 40%, #fcd9c0 0%, #f0a87b 30%, transparent 60%),
    radial-gradient(circle at 70% 65%, #c4a08a 0%, #8a6850 25%, transparent 50%),
    linear-gradient(135deg, #2d3a45, #1a2330);
}

.ill-video::after {
  content: '';
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 100px;
  height: 70px;
  background: #4a5568;
  border-radius: 8px;
  border: 2px solid white;
  background-image: radial-gradient(circle at 40% 35%, #ddc5b1 0%, #b89880 40%, #4a5568 65%);
}

.ill-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 16px;
}

.ill-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-sm);
}

.ill-btn.red { background: #ef4444; }

.floating-card {
  position: absolute;
  background: white;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
  animation: float 6s ease-in-out infinite;
}

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}
.dot.green { background: var(--color-success); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }

.card-1 { top: 20px; left: -10px; animation-delay: 0s; }
.card-2 { top: 50%; right: -20px; animation-delay: -2s; }
.card-3 { bottom: 30px; left: 30px; animation-delay: -4s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ============================
   Sections shared
   ============================ */
section {
  padding: 80px 0;
}

.section-head {
  text-align: center;
  margin-bottom: 48px;
}

.section-head h2 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 0 0 12px;
  color: var(--color-accent);
}

.section-head p {
  color: var(--color-text-soft);
  font-size: 17px;
  margin: 0;
}

/* ============================
   Teachers grid
   ============================ */
.teachers { background: white; }

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.teacher-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.teacher-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.teacher-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #ffd9c2, #ffeae0);
}

.teacher-avatar {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.teacher-online {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.95);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 6px;
}
.teacher-online::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.teacher-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.teacher-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.teacher-name {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}

.teacher-rating {
  font-size: 14px;
  color: var(--color-text-soft);
  white-space: nowrap;
}

.teacher-rating strong { color: var(--color-text); }

.teacher-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.teacher-tag {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.teacher-bio {
  color: var(--color-text-soft);
  font-size: 14px;
  margin: 0;
  flex: 1;
}

.teacher-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.teacher-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}
.teacher-price small { color: var(--color-text-soft); font-weight: 500; font-size: 13px; }

/* ============================
   How section
   ============================ */
.how { background: var(--color-bg-soft); }

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.step {
  background: white;
  padding: 36px 28px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.step-num {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 22px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.step h3 {
  font-size: 20px;
  margin: 0 0 8px;
  font-weight: 700;
}

.step p {
  color: var(--color-text-soft);
  margin: 0;
  font-size: 15px;
}

/* ============================
   Pricing
   ============================ */
.pricing { background: white; }

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.price-card {
  position: relative;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: all 0.3s;
}

.price-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.price-card.featured {
  border: 2px solid var(--color-primary);
  background: linear-gradient(180deg, var(--color-primary-light) 0%, white 50%);
  transform: scale(1.03);
}

.badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  padding: 4px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.price-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.price {
  font-size: 18px;
  color: var(--color-text-soft);
  margin: 0 0 4px;
}

.price strong {
  font-size: 44px;
  color: var(--color-primary);
  font-weight: 800;
  letter-spacing: -1px;
}

.price-card > p {
  color: var(--color-text-soft);
  margin: 0 0 20px;
  font-size: 14px;
}

.price-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-card li {
  font-size: 14px;
  color: var(--color-text);
}

.pricing-note {
  text-align: center;
  color: var(--color-text-soft);
  font-size: 13px;
  margin: 0;
}

/* ============================
   Footer
   ============================ */
.footer {
  background: var(--color-accent);
  color: rgba(255, 255, 255, 0.7);
  padding: 48px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer .brand { color: white; }
.footer .brand-logo { background: var(--color-primary); }

.footer-tag {
  margin: 8px 0 0;
  font-size: 14px;
}

.footer-meta {
  text-align: right;
  font-size: 13px;
}

.footer-meta p { margin: 4px 0; }

/* ============================
   Classroom page
   ============================ */
.classroom-body {
  background: #f5f5f7;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.classroom-top {
  background: white;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  flex-shrink: 0;
}

.classroom-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.role-tag {
  background: var(--color-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.teacher-meta {
  font-size: 14px;
  color: var(--color-text-soft);
  font-weight: 500;
}

.classroom-actions {
  display: flex;
  gap: 8px;
}

/* Pre-join */
.prejoin {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.prejoin-card {
  background: white;
  max-width: 640px;
  width: 100%;
  padding: 48px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.prejoin-card h2 {
  font-size: 28px;
  margin: 0 0 12px;
  text-align: center;
  color: var(--color-accent);
}

.prejoin-sub {
  text-align: center;
  color: var(--color-text-soft);
  margin: 0 0 32px;
  font-size: 15px;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.role-btn {
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.role-btn:hover {
  border-color: var(--color-primary-light);
  background: var(--color-primary-light);
}

.role-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.role-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.role-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.role-desc {
  font-size: 12px;
  color: var(--color-text-soft);
}

.prejoin-tips {
  background: var(--color-bg-soft);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.prejoin-tips h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--color-accent);
}

.prejoin-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prejoin-tips li {
  font-size: 13px;
  color: var(--color-text-soft);
}

.prejoin-foot {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-soft);
  margin: 16px 0 0;
}

/* Stage */
.stage {
  display: none;
  flex: 1;
  position: relative;
  background: #000;
  min-height: 0;
}

.stage.is-active {
  display: flex;
  flex-direction: column;
}

.stage.is-active iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  border: 0;
  display: block;
  min-height: 0;
}

.prejoin[hidden] {
  display: none;
}

.stage-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #1a1a1a;
  color: white;
  z-index: 1;
}

.stage-loader p {
  margin-top: 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 107, 53, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-text h1 { font-size: 40px; }
  .hero-visual { height: 360px; }
  .teacher-grid, .price-grid, .how-steps { grid-template-columns: 1fr; }
  .price-card.featured { transform: scale(1); }
  .nav-links { display: none; }
  .section-head h2 { font-size: 30px; }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .hero { padding: 48px 0 64px; }
  .hero-text h1 { font-size: 32px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-stats { gap: 24px; }
  .stat strong { font-size: 22px; }
  section { padding: 56px 0; }
  .prejoin-card { padding: 28px 20px; }
  .role-switch { grid-template-columns: 1fr; }
  .classroom-top { flex-direction: column; height: auto; gap: 8px; padding: 12px; }
  .classroom-meta { order: -1; }
}
