/* Study Planner - practice project
   Look: a paper notebook. Dotted grid background, ink-blue accent, hard offset shadows. */
:root {
  --paper: #fbf8f1;
  --card: #ffffff;
  --ink: #15203b;
  --muted: #5d6784;
  --blue: #2740d8;
  --line: #15203b;
  --yellow: #ffd84d;
  --green: #1f9d6a;
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --head: 'Space Grotesk', 'IBM Plex Sans Arabic', sans-serif;
}
/* Arabic gets its own font first */
html[lang='ar'] { --font: 'IBM Plex Sans Arabic', 'Inter', sans-serif; --head: 'IBM Plex Sans Arabic', sans-serif; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(21, 32, 59, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--head); }

.topbar { display: flex; justify-content: space-between; align-items: center; max-width: 1100px; margin: 0 auto; padding: 26px 5% 10px; }
.brand { font-size: 1.7rem; letter-spacing: -0.01em; background: var(--yellow); padding: 2px 12px; border: 2px solid var(--line); box-shadow: 4px 4px 0 var(--line); transform: rotate(-1.5deg); }
.lang-btn { font: 600 0.95rem var(--font); background: var(--card); border: 2px solid var(--line); padding: 8px 18px; border-radius: 6px; cursor: pointer; box-shadow: 3px 3px 0 var(--line); transition: transform 0.12s, box-shadow 0.12s; }
.lang-btn:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }

.layout { max-width: 1100px; margin: 0 auto; padding: 20px 5% 40px; display: grid; grid-template-columns: 340px 1fr; gap: 30px; align-items: start; }
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 26px; box-shadow: 6px 6px 0 var(--line); }
.panel h2 { font-size: 1.25rem; margin-bottom: 14px; }
.sub-title { margin-top: 30px; padding-top: 22px; border-top: 2px dashed rgba(21, 32, 59, 0.3); }

label { display: block; margin-bottom: 14px; }
label span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select { width: 100%; font: 1rem var(--font); color: var(--ink); padding: 10px 12px; border: 2px solid var(--line); border-radius: 6px; background: #fff; }
input:focus, select:focus { outline: 3px solid rgba(39, 64, 216, 0.35); outline-offset: 1px; }
.btn { width: 100%; font: 700 1rem var(--font); background: var(--blue); color: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 12px; cursor: pointer; box-shadow: 4px 4px 0 var(--line); transition: transform 0.12s, box-shadow 0.12s; }
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--line); }
.form-error { min-height: 1.3em; margin-top: 10px; font-size: 0.88rem; color: #c62828; font-weight: 600; }

.subject-list { list-style: none; display: grid; gap: 10px; }
.subject-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); animation: pop 0.25s ease; }
.subject-list .swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.subject-list .info { flex: 1; min-width: 0; }
.subject-list strong { display: block; overflow-wrap: anywhere; }
.subject-list small { color: var(--muted); }
.remove { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px 8px; border-radius: 6px; }
.remove:hover { color: #c62828; background: rgba(198, 40, 40, 0.1); }
.link-btn { margin-top: 16px; background: none; border: 0; font: 600 0.85rem var(--font); color: var(--muted); text-decoration: underline; cursor: pointer; }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.plan-head h2 { margin: 0; }
.progress { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; font-weight: 600; }
.bar { width: 140px; height: 12px; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.bar-fill { height: 100%; width: 0; background: var(--green); transition: width 0.4s; }

.plan { display: grid; gap: 14px; margin-top: 18px; }
.day { display: grid; grid-template-columns: 78px 1fr; gap: 16px; padding: 14px; border: 2px solid var(--line); border-radius: 10px; background: #fff; animation: pop 0.3s ease both; }
.day.today { background: #fff7d1; }
.day.exam-day { background: #ffe3e0; }
.date-chip { text-align: center; border-right: 2px dashed rgba(21, 32, 59, 0.3); padding-right: 12px; }
html[dir='rtl'] .date-chip { border-right: 0; border-left: 2px dashed rgba(21, 32, 59, 0.3); padding-right: 0; padding-left: 12px; }
.date-chip .dnum { font: 700 1.9rem var(--head); line-height: 1; }
.date-chip .dmon, .date-chip .dwd { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.today-badge { display: inline-block; margin-top: 6px; background: var(--yellow); border: 2px solid var(--line); border-radius: 20px; font-size: 0.62rem; font-weight: 700; padding: 0 8px; }
.tasks { display: grid; gap: 8px; align-content: center; }
.task { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 600; transition: background 0.15s; }
.task:hover { background: #f1ecdf; }
.task input { width: 20px; height: 20px; accent-color: var(--green); flex-shrink: 0; }
.task .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.task .hrs { margin-inline-start: auto; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.task.done { opacity: 0.55; }
.task.done .name { text-decoration: line-through; }
.exam-tag { font-weight: 700; color: #c62828; display: flex; align-items: center; gap: 8px; }
.review-tag { font-size: 0.7rem; background: var(--yellow); border: 1.5px solid var(--line); border-radius: 20px; padding: 0 8px; margin-inline-start: 6px; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; border: 2px dashed rgba(21, 32, 59, 0.3); border-radius: 10px; margin-top: 18px; }

.footer { text-align: center; padding: 10px 5% 40px; font-size: 0.82rem; color: var(--muted); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .day { grid-template-columns: 1fr; }
  .date-chip, html[dir='rtl'] .date-chip { border: 0; padding: 0 0 8px; display: flex; gap: 10px; align-items: baseline; text-align: start; border-bottom: 2px dashed rgba(21, 32, 59, 0.3); }
  .panel { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Days off toggles */
.days-off { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dow { display: block; margin: 0; cursor: pointer; position: relative; }
/* Visually hidden, but only 1px wide: a full-width absolutely positioned input pushed the whole page sideways */
.dow input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.dow span { display: block; margin: 0; padding: 5px 10px; border: 2px solid currentColor; border-radius: 8px; font-size: 0.8rem; color: var(--muted); }
.dow input:checked + span { background: #ffd84d; color: #111; border-color: #111; }
.dow input:focus-visible + span { outline: 2px solid #111; outline-offset: 2px; }
