/* ============================================================
   خدم على راسك — Stylesheet
   Palette: blanc cassé + light gray + charcoal, one restrained
   warm-bronze accent pulled from the avatar's own tones.
   ============================================================ */

:root{
  --bg:            #F6F4EF;
  --bg-alt:        #EFEBE3;
  --surface:       #FCFBF8;
  --surface-soft:  #F1EEE7;
  --border:        rgba(43, 41, 38, 0.10);
  --border-strong: rgba(43, 41, 38, 0.16);

  --ink:           #221F1C;
  --ink-soft:      #514D47;
  --ink-faint:     #8A8479;

  --accent:        #A97D4B;
  --accent-ink:    #6E5230;
  --accent-soft:   rgba(169, 125, 75, 0.14);
  --accent-ring:   rgba(169, 125, 75, 0.35);

  --track:         rgba(43, 41, 38, 0.08);

  --shadow-sm: 0 1px 2px rgba(34, 31, 28, 0.05), 0 1px 1px rgba(34, 31, 28, 0.04);
  --shadow-md: 0 8px 24px rgba(34, 31, 28, 0.07), 0 2px 6px rgba(34, 31, 28, 0.05);
  --shadow-lg: 0 20px 48px rgba(34, 31, 28, 0.12), 0 6px 16px rgba(34, 31, 28, 0.06);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;

  --font-display: "Cairo", "Segoe UI", sans-serif;
  --font-body: "Tajawal", "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

html.dark{
  --bg:            #1B1917;
  --bg-alt:        #171513;
  --surface:       #221F1C;
  --surface-soft:  #29251F;
  --border:        rgba(246, 244, 239, 0.08);
  --border-strong: rgba(246, 244, 239, 0.14);

  --ink:           #F3F0EA;
  --ink-soft:      #C7C1B7;
  --ink-faint:     #8C857A;

  --accent:        #C79A64;
  --accent-ink:    #E7C79A;
  --accent-soft:   rgba(199, 154, 100, 0.16);
  --accent-ring:   rgba(199, 154, 100, 0.4);

  --track:         rgba(246, 244, 239, 0.09);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 10px 26px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 54px rgba(0,0,0,0.5);
  color-scheme: dark;
}

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

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 420ms var(--ease), color 420ms var(--ease);
  overflow-x: hidden;
}

h1, h2, h3{
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink);
}

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

:focus-visible{
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

button{ font-family: inherit; }

/* ============================================================
   Ambient cursor glow (desktop only, toggled in JS)
   ============================================================ */
.cursor-glow{
  position: fixed;
  top: 0; left: 0;
  width: 460px; height: 460px;
  margin-top: -230px;
  margin-left: -230px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, var(--accent-soft) 0%, rgba(169,125,75,0) 70%);
  opacity: 0;
  transition: opacity 400ms ease;
  will-change: transform;
}
.cursor-glow.active{ opacity: 1; }

/* ============================================================
   Layout shell
   ============================================================ */
.page{
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ============================================================
   Hero / Header
   ============================================================ */
.hero{
  padding-top: 22px;
}

.hero__bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 0;
}

.hero__mark{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 7px 16px;
  background: var(--surface);
}

.hero__bar-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-badge{
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 7px 14px;
}

.google-signin-slot{ line-height: 0; }

.theme-toggle{
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), background 220ms var(--ease);
}
.theme-toggle:hover{ box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.theme-toggle:active{ transform: scale(0.95); }
.icon{ width: 19px; height: 19px; }
.icon--moon{ display: none; }
html.dark .icon--sun{ display: none; }
html.dark .icon--moon{ display: block; }

.hero__content{
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 12px;
  padding: 30px 0 8px;
  position: relative;
}

.hero__text{
  position: relative;
  z-index: 2;
  animation: rise 700ms var(--ease) both;
}

.hero__eyebrow{
  font-size: 13.5px;
  color: var(--accent-ink);
  font-weight: 700;
  margin: 0 0 10px;
}

.hero__title{
  font-size: clamp(2.6rem, 6vw, 4.1rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.hero__subtitle{
  margin: 16px 0 0;
  font-size: 1.15rem;
  color: var(--ink-soft);
  font-weight: 500;
  max-width: 30ch;
}

.hero__avatar{
  position: relative;
  z-index: 1;
  justify-self: center;
  animation: rise 800ms 120ms var(--ease) both;
}

.hero__avatar img{
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  filter: drop-shadow(0 22px 34px rgba(34,31,28,0.22));
}

@keyframes rise{
  from{ opacity: 0; transform: translateY(14px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Shared panel / card language
   ============================================================ */
.panel{
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px;
  margin-top: 22px;
  transition: background-color 420ms var(--ease), border-color 420ms var(--ease);
}

.panel__head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel__head h2{
  font-size: 1.3rem;
  font-weight: 800;
}

/* ============================================================
   Timer
   ============================================================ */
.panel--timer{
  text-align: center;
  padding: 40px 30px 34px;
}

.timer{
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer__ring-wrap{
  position: relative;
  width: min(300px, 72vw);
  height: min(300px, 72vw);
}

.timer__ring{ width: 100%; height: 100%; transform: rotate(-90deg); }

.timer__ring-track{
  fill: none;
  stroke: var(--track);
  stroke-width: 10;
}

.timer__ring-progress{
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 829.4;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 900ms linear, stroke 400ms ease;
}

.timer__ring-progress.is-break{ stroke: #8FA793; }
html.dark .timer__ring-progress.is-break{ stroke: #86A38C; }

.timer__center{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
}

.timer__state{
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.01em;
}

.timer__time{
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}

.timer__subject{
  font-size: 13.5px;
  color: var(--ink-faint);
  max-width: 20ch;
}

.timer__next{
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--ink-faint);
}

.timer__controls{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.btn{
  border: none;
  border-radius: 100px;
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease), opacity 200ms var(--ease);
}
.btn:disabled{ opacity: 0.45; cursor: not-allowed; }

.btn--primary{
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
html.dark .btn--primary{ background: var(--accent); color: #1B1917; }
.btn--primary:hover:not(:disabled){ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--primary:active:not(:disabled){ transform: scale(0.97); }

.btn--ghost{
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover:not(:disabled){ background: var(--surface-soft); transform: translateY(-1px); }
.btn--ghost:active:not(:disabled){ transform: scale(0.97); }

.btn--icon{
  width: 48px; height: 48px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.btn--icon:hover{ background: var(--surface-soft); }
.btn--icon:active{ transform: scale(0.93); }
.icon--sound-off{ display: none; }
.btn--icon[aria-pressed="false"] .icon--sound-on{ display: none; }
.btn--icon[aria-pressed="false"] .icon--sound-off{ display: block; }

/* ============================================================
   Statistics
   ============================================================ */
.stats-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card{
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition: transform 240ms var(--ease), box-shadow 240ms var(--ease), border-color 240ms var(--ease);
}
.stat-card:hover{
  transform: translateY(-3px) scale(1.012);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.stat-card__value{
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 200ms ease;
}

.stat-card__label{
  font-size: 12.5px;
  color: var(--ink-faint);
  font-weight: 500;
  line-height: 1.4;
}

.stat-card--progress{ gap: 6px; }

.progress-ring-wrap{ position: relative; width: 80px; height: 80px; }
.progress-ring{ width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring-track{ fill: none; stroke: var(--track); stroke-width: 7; }
.progress-ring-fill{
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  transition: stroke-dashoffset 700ms var(--ease);
}
.progress-ring-value{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
}

/* ============================================================
   Weekly schedule
   ============================================================ */
.days-tabs{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}
.days-tabs::-webkit-scrollbar{ height: 5px; }
.days-tabs::-webkit-scrollbar-thumb{ background: var(--border-strong); border-radius: 10px; }

.day-tab{
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 100px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 220ms var(--ease);
  white-space: nowrap;
}
.day-tab:hover{ background: var(--surface-soft); transform: translateY(-1px); }
.day-tab.is-active{
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
html.dark .day-tab.is-active{ background: var(--accent); color: #1B1917; border-color: var(--accent); }

.sessions-list{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.subject-card{
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: right;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 240ms var(--ease), box-shadow 240ms var(--ease), border-color 240ms var(--ease), background 240ms var(--ease);
  animation: rise 500ms var(--ease) both;
}
.subject-card:hover{
  transform: translateY(-3px) scale(1.012);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}
.subject-card:active{ transform: scale(0.99); }

.subject-card__index{
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-faint);
  transition: all 220ms var(--ease);
}

.subject-card__body{ flex: 1; min-width: 0; }

.subject-card__name{
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 3px;
}

.subject-card__status{
  font-size: 12px;
  color: var(--ink-faint);
}

.subject-card.is-selected{
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-ring) inset;
}
.subject-card.is-selected .subject-card__index{
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
html.dark .subject-card.is-selected .subject-card__index{ color: #1B1917; }

.subject-card.is-done{ opacity: 0.68; }
.subject-card.is-done .subject-card__name{ text-decoration: line-through; text-decoration-color: var(--ink-faint); }
.subject-card.is-done .subject-card__index{ background: var(--ink); color: var(--bg); border-color: var(--ink); }
.subject-card.is-done .subject-card__index::after{ content: "✓"; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer{
  margin-top: 40px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px){
  .hero__content{ grid-template-columns: 1fr; text-align: center; gap: 4px; }
  .hero__text{ order: 2; }
  .hero__avatar{ order: 1; }
  .hero__avatar img{ max-width: 220px; }
  .hero__subtitle{ margin-inline: auto; }
  .stats-grid{ grid-template-columns: repeat(2, 1fr); }
  .sessions-list{ grid-template-columns: 1fr; }
}

@media (max-width: 480px){
  .page{ padding: 0 16px 48px; }
  .panel{ padding: 22px 18px; }
  .btn{ padding: 13px 20px; font-size: 14px; }
  .timer__controls{ gap: 10px; }
  .cursor-glow{ display: none; }
}
