/* ===================================================
   GrammatikDe — Design System
   Plain CSS, no framework
   =================================================== */

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2563EB;
  --blue-dark:  #1D4ED8;
  --blue-light: #EFF6FF;
  --green:      #10B981;
  --green-light:#ECFDF5;
  --red:        #EF4444;
  --red-light:  #FEF2F2;
  --yellow:     #F59E0B;
  --yellow-light:#FFFBEB;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-400:   #9CA3AF;
  --gray-600:   #4B5563;
  --gray-800:   #1F2937;
  --white:      #FFFFFF;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ----- Typography ----- */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.15; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; line-height: 1.25; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--gray-600); }

/* ----- Layout ----- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container--narrow { max-width: 720px; margin: 0 auto; padding: 0 1.25rem; }

/* ----- Navbar ----- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.navbar__logo {
  font-size: 1.3rem; font-weight: 800;
  color: var(--blue); letter-spacing: -0.5px;
}
.navbar__logo span { color: var(--gray-800); }
.navbar__nav { display: flex; gap: 0.25rem; align-items: center; }
.navbar__link {
  padding: 0.4rem 0.8rem; border-radius: var(--radius-sm);
  color: var(--gray-600); font-weight: 500; font-size: 0.9rem;
  transition: background .15s, color .15s;
}
.navbar__link:hover, .navbar__link.active {
  background: var(--blue-light); color: var(--blue);
  text-decoration: none;
}
.navbar__link--cta {
  background: var(--blue); color: var(--white) !important;
  padding: 0.4rem 1rem;
}
.navbar__link--cta:hover { background: var(--blue-dark); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.4rem; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: all .18s; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary  { background: var(--blue);  color: var(--white); border-color: var(--blue); }
.btn--primary:hover  { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn--outline  { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn--outline:hover  { background: var(--blue-light); }
.btn--success  { background: var(--green); color: var(--white); border-color: var(--green); }
.btn--danger   { background: var(--red);   color: var(--white); border-color: var(--red); }
.btn--ghost    { background: var(--gray-100); color: var(--gray-800); border-color: var(--gray-100); }
.btn--ghost:hover { background: var(--gray-200); border-color: var(--gray-200); }
.btn--lg { padding: 0.85rem 2rem; font-size: 1.05rem; border-radius: var(--radius-md); }
.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ----- Cards ----- */
.card {
  background: var(--white); border-radius: var(--radius-md);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
  padding: 1.5rem; transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card--clickable { cursor: pointer; }
.card--clickable:hover { transform: translateY(-3px); }

/* ----- Badge ----- */
.badge {
  display: inline-block; padding: 0.2rem 0.65rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: .3px; text-transform: uppercase;
}
.badge--blue   { background: var(--blue-light);   color: var(--blue); }
.badge--green  { background: var(--green-light);  color: var(--green); }
.badge--red    { background: var(--red-light);    color: var(--red); }
.badge--yellow { background: var(--yellow-light); color: var(--yellow); }
.badge--gray   { background: var(--gray-100);     color: var(--gray-600); }

/* ----- Progress Bar ----- */
.progress-bar {
  height: 8px; background: var(--gray-200); border-radius: 99px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%; border-radius: 99px;
  background: var(--blue); transition: width .5s ease;
}
.progress-bar__fill--green  { background: var(--green); }
.progress-bar__fill--red    { background: var(--red); }
.progress-bar__fill--yellow { background: var(--yellow); }

/* ----- Hero Section ----- */
.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
  border-bottom: 1px solid var(--gray-200);
}
.hero__inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3rem; align-items: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--blue-light); color: var(--blue);
  padding: 0.3rem 0.8rem; border-radius: 99px;
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 1rem;
}
.hero__title { margin-bottom: 1rem; }
.hero__title span { color: var(--blue); }
.hero__desc { font-size: 1.05rem; margin-bottom: 1.75rem; }
.hero__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero__visual {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 1.75rem;
  border: 1px solid var(--gray-200);
}
.hero__stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin-top: 1.25rem;
}
.hero__stat { text-align: center; }
.hero__stat-number {
  font-size: 1.6rem; font-weight: 800; color: var(--blue); display: block;
}
.hero__stat-label { font-size: 0.78rem; color: var(--gray-400); font-weight: 500; }

/* ----- Level Grid ----- */
.levels { padding: 4rem 0; }
.levels__header { text-align: center; margin-bottom: 2.5rem; }
.levels__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem;
}
.level-card {
  border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  text-align: center; position: relative; overflow: hidden;
  border: 2px solid transparent; transition: all .2s;
}
.level-card--active {
  background: var(--white); border-color: var(--blue);
  box-shadow: var(--shadow-md); cursor: pointer;
}
.level-card--active:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.level-card--locked {
  background: var(--gray-100); border-color: var(--gray-200);
  opacity: .6; cursor: not-allowed;
}
.level-card__icon {
  font-size: 2.5rem; margin-bottom: 0.75rem; display: block;
}
.level-card__name {
  font-size: 1.5rem; font-weight: 800;
  color: var(--blue); margin-bottom: 0.25rem;
}
.level-card--locked .level-card__name { color: var(--gray-400); }
.level-card__desc { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 1rem; }
.level-card__progress { margin-top: 1rem; }
.level-card__lock {
  position: absolute; top: 1rem; right: 1rem;
  font-size: 1.1rem; color: var(--gray-400);
}
.level-card__actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

/* ----- Features ----- */
.features { padding: 4rem 0; background: var(--white); }
.features__grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem;
  margin-top: 2.5rem;
}
.feature { text-align: center; padding: 1.5rem; }
.feature__icon {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 1rem;
}
.feature__icon--blue   { background: var(--blue-light); }
.feature__icon--green  { background: var(--green-light); }
.feature__icon--yellow { background: var(--yellow-light); }
.feature__title { margin-bottom: 0.5rem; }
.feature__desc { font-size: 0.9rem; }

/* ----- Section header ----- */
.section-header { margin-bottom: 2rem; }
.section-header__title { margin-bottom: 0.5rem; }
.section-header__desc { font-size: 0.95rem; }

/* ----- Topic Grid (Exercises) ----- */
.topic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.topic-card {
  border-radius: var(--radius-md); padding: 1.5rem;
  background: var(--white); border: 2px solid var(--gray-200);
  cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.topic-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.topic-card--active { border-color: var(--blue); background: var(--blue-light); }
.topic-card__header { display: flex; align-items: center; gap: 0.75rem; }
.topic-card__icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--blue-light); display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.topic-card__name { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.topic-card__sub  { font-size: 0.8rem; color: var(--gray-400); }
.topic-card__stats {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem;
}
.topic-card__score { font-weight: 700; color: var(--green); }
.topic-card__score--low { color: var(--red); }
.topic-card__score--mid { color: var(--yellow); }

/* ----- Exercise Area ----- */
.exercise-area { margin-top: 2rem; }
.exercise-panel {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-md);
  overflow: hidden;
}
.exercise-panel__header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50);
}
.exercise-panel__body { padding: 2rem 1.75rem; }

/* ----- Question Card ----- */
.question-card { max-width: 680px; margin: 0 auto; }
.question-card__number {
  font-size: 0.82rem; color: var(--gray-400); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 0.5rem;
}
.question-card__text {
  font-size: 1.15rem; font-weight: 600; color: var(--gray-800);
  margin-bottom: 1.5rem; line-height: 1.5;
}
.question-card__text em {
  font-style: normal; color: var(--blue); font-weight: 700;
}
.options-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.option {
  padding: 0.85rem 1.1rem; border-radius: var(--radius-md);
  border: 2px solid var(--gray-200); background: var(--white);
  cursor: pointer; font-size: 0.95rem; font-weight: 500;
  color: var(--gray-800); transition: all .15s; text-align: left;
  display: flex; align-items: center; gap: 0.6rem;
}
.option:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-light); }
.option--selected   { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.option--correct    { border-color: var(--green) !important; background: var(--green-light) !important; color: var(--green) !important; }
.option--wrong      { border-color: var(--red)   !important; background: var(--red-light)   !important; color: var(--red)   !important; }
.option:disabled    { cursor: default; }
.option__letter {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-600);
  font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.option--selected .option__letter { background: var(--blue); color: var(--white); }
.option--correct  .option__letter { background: var(--green); color: var(--white); }
.option--wrong    .option__letter { background: var(--red); color: var(--white); }

.explanation {
  padding: 1rem 1.25rem; border-radius: var(--radius-md);
  border-left: 4px solid var(--blue); background: var(--blue-light);
  font-size: 0.9rem; margin-bottom: 1.25rem; line-height: 1.55;
}
.explanation--correct { border-color: var(--green); background: var(--green-light); }
.explanation--wrong   { border-color: var(--red);   background: var(--red-light); }
.explanation__icon { font-weight: 700; margin-right: 0.3rem; }

/* ----- Exam Specific ----- */
.exam-header {
  background: var(--blue); color: var(--white);
  padding: 1rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.exam-header__title { font-size: 1rem; font-weight: 700; }
.exam-timer {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.exam-timer--warning { color: var(--yellow); animation: pulse 1s infinite; }
.exam-timer--danger  { color: #FCA5A5; animation: pulse .5s infinite; }
.exam-progress-info { font-size: 0.85rem; opacity: .85; }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.5; } }

.exam-intro {
  max-width: 600px; margin: 0 auto; padding: 3rem 1.25rem;
  text-align: center;
}
.exam-intro__icon { font-size: 4rem; margin-bottom: 1rem; }
.exam-intro__title { margin-bottom: 0.75rem; }
.exam-intro__desc { margin-bottom: 1.5rem; }
.exam-intro__info {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1rem; margin: 1.5rem 0 2rem;
}
.exam-intro__info-item {
  background: var(--gray-50); border-radius: var(--radius-md);
  padding: 1rem; border: 1px solid var(--gray-200);
}
.exam-intro__info-value { font-size: 1.3rem; font-weight: 800; color: var(--blue); display: block; }
.exam-intro__info-label { font-size: 0.78rem; color: var(--gray-400); }

/* ----- Results ----- */
.results-hero {
  padding: 3rem 0;
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
  border-bottom: 1px solid var(--gray-200);
}
.results-hero__inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 1.25rem;
}
.score-circle {
  width: 140px; height: 140px; border-radius: 50%;
  border: 8px solid var(--blue); display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  background: var(--white); box-shadow: var(--shadow-lg);
}
.score-circle--pass { border-color: var(--green); }
.score-circle--fail { border-color: var(--red); }
.score-circle__number {
  font-size: 2.5rem; font-weight: 900; color: var(--blue); line-height: 1;
}
.score-circle--pass .score-circle__number { color: var(--green); }
.score-circle--fail .score-circle__number { color: var(--red); }
.score-circle__label { font-size: 0.75rem; color: var(--gray-400); font-weight: 600; }

.results-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; padding: 2.5rem 0;
}
.topic-result {
  background: var(--white); border-radius: var(--radius-md);
  border: 1px solid var(--gray-200); padding: 1.25rem;
}
.topic-result__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.topic-result__name { font-weight: 700; font-size: 0.95rem; }
.topic-result__score { font-size: 1.1rem; font-weight: 800; }
.topic-result__score--good   { color: var(--green); }
.topic-result__score--medium { color: var(--yellow); }
.topic-result__score--bad    { color: var(--red); }

.weakness-list { display: flex; flex-direction: column; gap: 1rem; }
.weakness-item {
  border-radius: var(--radius-md); padding: 1.25rem;
  border: 2px solid var(--red-light); background: var(--red-light);
  display: flex; align-items: flex-start; gap: 1rem;
}
.weakness-item--medium {
  border-color: var(--yellow-light); background: var(--yellow-light);
}
.weakness-item__icon { font-size: 1.5rem; flex-shrink: 0; }
.weakness-item__body { flex: 1; }
.weakness-item__title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.3rem; }
.weakness-item__desc { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 0.75rem; }

/* ----- Empty State ----- */
.empty-state {
  text-align: center; padding: 3rem 1.25rem; color: var(--gray-400);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state__title { font-size: 1.1rem; font-weight: 600; color: var(--gray-600); }
.empty-state__desc { font-size: 0.9rem; }

/* ----- Page Header (inner pages) ----- */
.page-header {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 2rem 0;
}
.page-header__breadcrumb {
  font-size: 0.82rem; color: var(--gray-400);
  margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.page-header__title { margin-bottom: 0.25rem; }
.page-header__desc { font-size: 0.95rem; }

/* ----- Two-col layout ----- */
.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 1.75rem; padding: 2rem 0; }
.sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* ----- Misc ----- */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
.text-center { text-align: center; }
.text-small { font-size: 0.85rem; }
.text-muted  { color: var(--gray-400); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ----- Footer ----- */
.footer {
  background: var(--gray-800); color: var(--gray-400);
  padding: 2.5rem 0; margin-top: 4rem;
}
.footer__inner {
  display: flex; align-items: center; justify-content: space-between;
}
.footer__logo { font-size: 1.1rem; font-weight: 800; color: var(--white); }
.footer__text { font-size: 0.85rem; }

/* ----- Animations ----- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .4s ease forwards; }
.delay-1 { animation-delay: .1s; opacity: 0; }
.delay-2 { animation-delay: .2s; opacity: 0; }
.delay-3 { animation-delay: .3s; opacity: 0; }

/* ----- Language Switcher ----- */
.lang-switcher { position:relative; }
.lang-btn {
  background:none; border:1px solid var(--gray-200); border-radius:var(--radius-sm);
  padding:.28rem .6rem; cursor:pointer; font-size:.82rem; color:var(--gray-600);
  font-family:var(--font); transition:border-color .15s; white-space:nowrap;
}
.lang-btn:hover { border-color:var(--blue); color:var(--blue); }
.lang-menu {
  display:none; position:absolute; right:0; top:calc(100% + .4rem);
  background:var(--white); border:1px solid var(--gray-200);
  border-radius:var(--radius-md); box-shadow:0 8px 24px rgba(0,0,0,.12);
  min-width:160px; z-index:200; overflow:hidden;
}
.lang-menu button {
  display:block; width:100%; text-align:left; padding:.5rem .85rem;
  background:none; border:none; cursor:pointer; font-size:.85rem;
  color:var(--gray-700); font-family:var(--font); transition:background .1s;
}
.lang-menu button:hover { background:var(--gray-50); }
.lang-menu button.active { color:var(--blue); font-weight:700; background:var(--blue-light); }

/* ----- RTL support (Arabic) ----- */
[dir="rtl"] .lang-menu { right:auto; left:0; }
[dir="rtl"] .lang-menu button { text-align:right; }
[dir="rtl"] .navbar__nav { flex-direction:row-reverse; }
[dir="rtl"] .navbar__inner { flex-direction:row-reverse; }
[dir="rtl"] .topic-card__header { flex-direction:row-reverse; }
[dir="rtl"] .topic-card__stats { flex-direction:row-reverse; }
[dir="rtl"] .exercise-panel__header { flex-direction:row-reverse; }
[dir="rtl"] .option { flex-direction:row-reverse; text-align:right; }
[dir="rtl"] .footer__inner { flex-direction:row-reverse; }
[dir="rtl"] .page-header__breadcrumb { direction:rtl; }

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .hero__inner        { grid-template-columns: 1fr; }
  .hero__visual       { display: none; }
  .levels__grid       { grid-template-columns: repeat(2, 1fr); }
  .features__grid     { grid-template-columns: 1fr 1fr; }
  .results-grid       { grid-template-columns: 1fr; }
  .two-col            { grid-template-columns: 1fr; }
  .sidebar            { display: none; }
}
@media (max-width: 600px) {
  .levels__grid       { grid-template-columns: 1fr; }
  .features__grid     { grid-template-columns: 1fr; }
  .options-grid       { grid-template-columns: 1fr; }
  .exam-intro__info   { grid-template-columns: 1fr; }
  .hero__stats        { grid-template-columns: 1fr 1fr; }
  .footer__inner      { flex-direction: column; gap: 1rem; text-align: center; }
}
