/* © Rafi Jerbi — כל הזכויות שמורות */
/* ===== IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&family=Fredoka+One&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
  --primary:    #FF6B6B;
  --primary-d:  #e85555;
  --secondary:  #4ECDC4;
  --secondary-d:#3bb8b0;
  --accent:     #FFE66D;
  --purple:     #A29BFE;
  --purple-d:   #8c84f0;
  --green:      #55EFC4;
  --orange:     #FDCB6E;
  --blue:       #74B9FF;
  --pink:       #FD79A8;

  --bg:         #F0F4FF;
  --bg-card:    #FFFFFF;
  --text:       #2D3436;
  --text-light: #636E72;
  --text-muted: #B2BEC3;
  --border:     #DFE6E9;
  --shadow:     rgba(0,0,0,0.08);
  --shadow-m:   rgba(0,0,0,0.15);

  --radius-s:   8px;
  --radius:     16px;
  --radius-l:   24px;
  --radius-xl:  32px;

  --font:       'Heebo', sans-serif;
  --font-title: 'Fredoka One', cursive;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5 { font-family: var(--font-title); font-weight: 400; line-height: 1.2; }
.text-sm   { font-size: 0.85rem; }
.text-muted{ color: var(--text-muted); }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section   { padding: 4rem 0; }
.page-wrap { padding: 2rem 0; }

/* ===== NAVBAR ===== */
.navbar {
  background: white;
  box-shadow: 0 2px 20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.navbar-logo {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.navbar-logo span { color: var(--secondary); }
.navbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text);
}
.navbar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.navbar-avatar:hover { transform: scale(1.1); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px var(--shadow-m); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary);   color: white; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-d); }
.btn-accent    { background: var(--accent);    color: var(--text); }
.btn-purple    { background: var(--purple);    color: white; }
.btn-outline   { background: transparent; border: 2.5px solid var(--primary); color: var(--primary); }
.btn-ghost     { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg); transform: none; box-shadow: none; }
.btn-danger    { background: #ff4757; color: white; }
.btn-sm        { padding: 0.4rem 0.9rem; font-size: 0.875rem; }
.btn-lg        { padding: 0.9rem 2rem; font-size: 1.1rem; border-radius: var(--radius-l); }
.btn-xl        { padding: 1.1rem 2.5rem; font-size: 1.25rem; border-radius: var(--radius-l); }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-l);
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px var(--shadow-m); }
.card-flat   { transform: none !important; box-shadow: 0 2px 12px var(--shadow) !important; }

/* ===== FORMS ===== */
.form-group  { margin-bottom: 1.25rem; }
.form-label  { display: block; font-weight: 700; margin-bottom: 0.5rem; font-size: 0.95rem; }
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: var(--text);
  text-align: right;
}
.form-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(78,205,196,0.2);
}
.form-input.error { border-color: var(--primary); }
.form-hint  { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.85rem; color: var(--primary); margin-top: 0.3rem; font-weight: 600; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-math       { background: #fff3e0; color: #e65100; }
.badge-language   { background: #e3f2fd; color: #1565c0; }
.badge-logic      { background: #ede7f6; color: #4527a0; }
.badge-creativity { background: #fce4ec; color: #880e4f; }
.badge-science    { background: #e8f5e9; color: #1b5e20; }
.badge-memory     { background: #e0f7fa; color: #006064; }
.badge-music      { background: #f3e5f5; color: #6a1b9a; }

.badge-age35  { background: #fff9c4; color: #f57f17; }
.badge-age68  { background: #e0f7fa; color: #00838f; }
.badge-age912 { background: #ede7f6; color: #512da8; }

/* ===== ALERTS ===== */
.alert {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.alert-error   { background: #ffe0e0; color: #c0392b; border: 2px solid #ffb3b3; }
.alert-success { background: #e0fff4; color: #0a8a4d; border: 2px solid #a0f0c8; }
.alert-info    { background: #e0eeff; color: #1a53a0; border: 2px solid #a0c0f0; }
.alert-warning { background: #fffbe0; color: #b7860b; border: 2px solid #f0df80; }

/* ===== GAME CARDS ===== */
.game-card {
  background: white;
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
  cursor: pointer;
}
.game-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 12px 40px var(--shadow-m); }
.game-card.blocked { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.5); }
.game-card.blocked:hover { transform: none; box-shadow: 0 4px 20px var(--shadow); }
.game-card.coming-soon { cursor: default; }

.game-card-thumb {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
}
.game-card-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.05);
}
.game-card-body { padding: 0.75rem 1rem 1rem; }
.game-card-title { font-family: var(--font-title); font-size: 1rem; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card-desc  { font-size: 0.8rem; color: var(--text-light); line-height: 1.4; margin-bottom: 0.5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game-card-meta  { display: flex; align-items: center; gap: 0.4rem; flex-wrap: nowrap; overflow: hidden; }

.coming-soon-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(0,0,0,0.65);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

/* ===== STARS ===== */
.stars { display: inline-flex; gap: 2px; color: var(--accent); font-size: 1.1rem; }
.star-empty { color: var(--border); }

/* ===== PROGRESS BAR ===== */
.progress-wrap { background: var(--bg); border-radius: 100px; overflow: hidden; height: 14px; }
.progress-bar  {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--secondary), var(--blue));
}
.progress-bar.warning { background: linear-gradient(90deg, var(--orange), var(--primary)); }
.progress-bar.full    { background: linear-gradient(90deg, var(--primary), #c0392b); }

/* ===== AVATAR SELECTOR ===== */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem; }
.avatar-option {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  background: var(--bg);
  transition: all 0.2s;
}
.avatar-option.selected { border-color: var(--secondary); background: rgba(78,205,196,0.1); transform: scale(1.15); }
.avatar-option:hover    { transform: scale(1.1); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0.5rem; border-bottom: 3px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: 0.7rem 1.2rem;
  border: none;
  background: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title  { font-family: var(--font-title); font-size: 1.4rem; }
.modal-close  { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; padding: 0.2rem; line-height: 1; }
.modal-close:hover { color: var(--primary); }

/* ===== LOADING ===== */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; gap: 1rem;
  color: var(--text-muted);
}

/* ===== ANIMATIONS ===== */
@keyframes bounce-in {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes wiggle {
  0%,100% { transform: rotate(0); }
  25%     { transform: rotate(-8deg); }
  75%     { transform: rotate(8deg); }
}
@keyframes sparkle {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.5; transform: scale(1.3); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes star-pop {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  70%  { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.animate-bounce-in { animation: bounce-in 0.5s cubic-bezier(.36,.07,.19,.97) forwards; }
.animate-float     { animation: float 3s ease-in-out infinite; }
.animate-wiggle    { animation: wiggle 0.5s ease-in-out; }
.animate-sparkle   { animation: sparkle 2s ease-in-out infinite; }
.animate-slide-up  { animation: slide-up 0.4s ease forwards; }
.animate-fade-in   { animation: fade-in 0.3s ease forwards; }

/* ===== CHILD DASHBOARD THEME ===== */
.theme-child {
  --bg: #F0F8FF;
}
.theme-child body { background: var(--bg); }

.child-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem 0;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  text-align: center;
  margin-bottom: 2rem;
}
.child-welcome { font-family: var(--font-title); font-size: 2rem; margin-bottom: 0.5rem; }
.child-avatar-big {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  margin: 0 auto 1rem;
  border: 4px solid rgba(255,255,255,0.6);
  animation: float 3s ease-in-out infinite;
}
.stars-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.2);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ===== TIME METER ===== */
.time-meter-card {
  background: white;
  border-radius: var(--radius-l);
  padding: 1.25rem;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 1.5rem;
}
.time-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 700;
}
.time-meter-value { font-size: 1.5rem; font-family: var(--font-title); color: var(--secondary); }
.time-meter-limit { font-size: 0.85rem; color: var(--text-muted); }

/* ===== PARENT DASHBOARD ===== */
.stat-card {
  background: white;
  border-radius: var(--radius-l);
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  text-align: center;
}
.stat-icon  { font-size: 2.5rem; margin-bottom: 0.5rem; }
.stat-value { font-family: var(--font-title); font-size: 2rem; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

.child-list-item {
  background: white;
  border-radius: var(--radius-l);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 15px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  margin-bottom: 0.75rem;
}
.child-list-item:hover { transform: translateX(-4px); box-shadow: 0 6px 25px var(--shadow-m); }
.child-list-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.child-list-info { flex: 1; }
.child-list-name { font-weight: 800; font-size: 1.05rem; }
.child-list-meta { font-size: 0.82rem; color: var(--text-muted); }
.child-list-stats { text-align: left; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .section   { padding: 2.5rem 0; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  .btn-xl { padding: 0.9rem 1.8rem; font-size: 1.1rem; }
  .navbar-logo { font-size: 1.3rem; }
}
@media (max-width: 480px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .game-card-thumb { height: 80px; font-size: 2.5rem; }
}

/* ===== UTILITIES ===== */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1   { gap: 0.5rem; }
.gap-2   { gap: 1rem; }
.gap-3   { gap: 1.5rem; }
.gap-4   { gap: 2rem; }
.grid    { display: grid; }
.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
.grid-4  { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fw-black { font-weight: 900; }
.hidden { display: none !important; }
.sr-only { position: absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

/* ===== CONTROLS PAGE ===== */
.control-section {
  background: white;
  border-radius: var(--radius-l);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 15px var(--shadow);
}
.control-section-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}
.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg);
  margin-bottom: 0.6rem;
  gap: 1rem;
}
.toggle-card label { font-weight: 600; flex: 1; cursor: pointer; }
.toggle {
  position: relative;
  width: 52px; height: 28px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 100px;
  transition: 0.3s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  right: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--secondary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(-24px); }

/* ===== INVITE CODE ===== */
.invite-code-display {
  font-family: 'Courier New', monospace;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--purple);
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f5f3ff, #ede7f6);
  border-radius: var(--radius-l);
  border: 3px dashed var(--purple);
  margin: 1rem 0;
  cursor: pointer;
  transition: all 0.2s;
}
.invite-code-display:hover { background: linear-gradient(135deg, #ede7f6, #d1c4e9); }

/* ===== PAGE TRANSITIONS ===== */
.page-enter { animation: slide-up 0.35s ease forwards; }
