/* ===== Kids Coding Hub — بوابة الطلبة ===== */
/* الألوان: هوية KCH — كحلي، برتقالي، أصفر، أزرق */

:root {
  --navy: #0E2A6E;
  --navy-soft: #17347F;
  --blue: #0B3FD0;
  --blue-bright: #1E7BE8;
  --orange: #F1591F;
  --orange-light: #FF7A1A;
  --yellow: #FFCE2E;
  --green: #12A66A;
  --cream: #FFF8F2;
  --card: #FFFFFF;
  --ink: #14224A;
  --muted: #6B7699;
  --line: #E9EDF7;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(14, 42, 110, 0.09);
}

* { box-sizing: border-box; }

/* أي عنصر عليه hidden يختفي مهما كان الـ display بتاعه */
[hidden] { display: none !important; }

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

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 110% -10%, rgba(30, 123, 232, 0.13), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(241, 89, 31, 0.10), transparent 60%);
  background-attachment: fixed;
}

.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ===== عناصر عامة ===== */

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  box-shadow: 0 8px 18px rgba(241, 89, 31, 0.28);
  font-size: 1.05rem;
  padding: 16px 20px;
}

.btn-primary:hover { box-shadow: 0 10px 24px rgba(241, 89, 31, 0.36); }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--line);
  padding: 10px 16px;
  font-weight: 700;
}

.btn-ghost:hover { border-color: var(--navy); }

.btn-wa {
  background: var(--green);
  color: #fff;
  padding: 12px 18px;
  font-weight: 700;
}

.tiny {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 14px 0 0;
}

.field-error {
  color: #D63A1B;
  font-size: 0.88rem;
  font-weight: 700;
  margin: 8px 0 0;
}

/* ===== شاشة الترحيب ===== */

#screen-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.welcome-card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px 22px 26px;
  width: 100%;
  max-width: 460px;
  text-align: center;
  border: 1px solid var(--line);
}

.hero-logo {
  width: 148px;
  height: 148px;
  border-radius: 28px;
  display: block;
  margin: 0 auto 16px;
  box-shadow: 0 10px 26px rgba(11, 63, 208, 0.22);
}

.brand {
  font-size: 1.7rem;
  margin: 0;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: -0.3px;
}

.tagline {
  margin: 6px 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.latin { direction: ltr; display: inline-block; font-weight: 700; color: var(--blue); }

.name-form { text-align: right; }

.name-form label,
.hw-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 0.95rem;
}

input[type="text"],
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #FBFCFF;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 4px rgba(30, 123, 232, 0.14);
  background: #fff;
}

.name-form input { margin-bottom: 6px; }
.name-form .btn-primary { margin-top: 16px; }

/* ===== التوب بار ===== */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.topbar-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: 0 0 auto;
}

.topbar-text { flex: 1 1 auto; min-width: 0; }

.hello {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hello strong { color: var(--yellow); }

.sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
  direction: ltr;
  text-align: right;
}

.topbar .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  padding: 8px 14px;
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.topbar .btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.12); }

/* ===== كارت التقدم ===== */

.progress-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 24px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

#hw-count { color: var(--orange); }

.bar {
  height: 10px;
  background: #EEF1F9;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
  transition: width 0.4s ease;
}

.progress-note {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== قائمة السيشنات ===== */

.section-title {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 0 0 12px;
  font-weight: 800;
}

.week-sep {
  grid-column: 1 / -1;
  margin: 14px 4px 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.week-sep:first-child { margin-top: 0; }

.session-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 620px) {
  .session-list { grid-template-columns: 1fr 1fr; }
}

.session-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: right;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(14, 42, 110, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.session-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 4px;
  background: var(--orange);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.session-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(14, 42, 110, 0.12);
  border-color: #D7DEF0;
}

.session-card:hover::after { opacity: 1; }

.session-card.done { background: #F4FBF7; border-color: #CFEEDF; }

.num {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  font-family: inherit;
}

.session-card.done .num { background: linear-gradient(135deg, var(--green), #1FC183); }

.card-text { flex: 1 1 auto; min-width: 0; }

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-status {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  background: #F1F4FB;
  color: var(--muted);
}

.chip-status.done { background: #E1F7EC; color: var(--green); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 28px;
}

/* ===== شاشة السيشن ===== */

.topbar-session {
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-bottom: 14px;
  color: var(--navy);
}

.topbar-session .btn-ghost {
  color: var(--navy);
  border-color: var(--line);
  background: #fff;
}

.topbar-session .btn-ghost:hover { border-color: var(--navy); background: #fff; }

.crumb {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.session-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 20px 24px;
}

.session-kicker {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: 0.2px;
}

.session-title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.35;
  color: var(--navy);
  font-weight: 800;
}

.session-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
}

.block-title {
  font-size: 0.95rem;
  color: var(--navy);
  font-weight: 800;
  margin: 22px 0 10px;
}

.block-text {
  margin: 0;
  color: #33406B;
  font-size: 0.98rem;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.chips li {
  background: #EEF4FF;
  color: var(--blue);
  border: 1px solid #DCE7FF;
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* ===== كارت الواجب ===== */

.hw-card {
  margin-top: 24px;
  background: linear-gradient(180deg, #FFFDF8, #FFF6EC);
  border: 1.5px dashed #F6C79F;
  border-radius: 18px;
  padding: 16px 16px 18px;
}

.hw-title { margin-top: 0; color: var(--orange); }

.hw-form { margin-top: 14px; }

.hw-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.hw-actions .btn-primary { width: auto; flex: 1 1 auto; }

.counter {
  font-size: 0.78rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.saved-box {
  margin-top: 14px;
  background: #F2FBF6;
  border: 1.5px solid #C9EBD9;
  border-radius: 16px;
  padding: 16px;
}

.saved-title {
  margin: 0;
  color: var(--green);
  font-weight: 800;
  font-size: 1.05rem;
}

.saved-when {
  margin: 4px 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.saved-text {
  margin: 0;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.92rem;
  color: var(--ink);
  max-height: 240px;
  overflow: auto;
}

.saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.saved-actions .btn { flex: 1 1 auto; }

@media (min-width: 620px) {
  .saved-actions .btn { flex: 0 0 auto; }
}
