@import '../shared.css';

/* .screen / .screen.active live in shared.css */

/* ════════════════════════════════════════════════════════════════
   Screen management
════════════════════════════════════════════════════════════════ */
#screen-setup.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
}

/* ════════════════════════════════════════════════════════════════
   Setup card  — matches task-list onboarding card
════════════════════════════════════════════════════════════════ */
.setup-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.setup-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 2px;
}

.setup-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  background: linear-gradient(135deg, var(--daily), var(--monthly));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  text-align: center;
}

.setup-sub {
  font-size: 0.9rem;
  color: var(--color-text-tertiary);
  margin: 0 0 4px;
  text-align: center;
}

.setup-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.setup-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.setup-optional {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  background: var(--color-background-secondary);
  padding: 1px 6px;
  border-radius: 100px;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}

.date-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-background-secondary);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.date-input:focus { border-color: var(--weekly); }

.setup-error {
  font-size: 0.83rem;
  color: var(--quarterly);
  min-height: 1.1em;
  margin: 0;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════════
   Countdown header  — matches tasks-site-header
════════════════════════════════════════════════════════════════ */
.cd-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Countdown badge — centre of header */
.cd-badge-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
}

.cd-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: color-mix(in srgb, var(--weekly) 8%, var(--color-surface));
  border: 1.5px solid color-mix(in srgb, var(--weekly) 25%, var(--color-border));
  border-radius: 100px;
  padding: 8px 22px;
}

.cd-badge.badge-done {
  background: color-mix(in srgb, var(--yearly) 10%, var(--color-surface));
  border-color: color-mix(in srgb, var(--yearly) 30%, var(--color-border));
}

.days-count {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--weekly);
  line-height: 1;
}
.badge-done .days-count { font-size: 1.5rem; color: var(--yearly); }

.days-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* Change-dates button */
.change-date-btn {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.change-date-btn:hover {
  border-color: var(--color-text-secondary);
  background: var(--color-background-secondary);
  color: var(--color-text-primary);
}

/* ════════════════════════════════════════════════════════════════
   Calendar container
════════════════════════════════════════════════════════════════ */
.calendar-container {
  padding: 24px 20px 56px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  align-items: start;
}

/* ════════════════════════════════════════════════════════════════
   Month card  — matches user-card / add-user-form surface style
════════════════════════════════════════════════════════════════ */
.cal-month {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cal-month-hdr {
  padding: 11px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-border);
}

/* ── Grid ── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.cal-cell:nth-child(7n)   { border-right: none; }
.cal-cell:nth-last-child(-n+7) { border-bottom: none; }

/* Day-name header row */
.cal-day-name {
  aspect-ratio: auto;
  padding: 5px 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  background: var(--color-background-primary);
  border-bottom: 1px solid var(--color-border);
}

.cal-empty { background: var(--color-background-primary); }

/* ── Day number ── */
.cal-day-num {
  font-size: 0.82rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
  line-height: 1;
}

/* ════ Day state classes ════ */

/* Outside school year — very faint */
.cal-day.cal-outside {
  background: var(--color-background-primary);
}
.cal-day.cal-outside .cal-day-num {
  color: var(--color-text-tertiary);
  opacity: 0.3;
}

/* Weekends — subtle tint */
.cal-day.cal-weekend:not(.cal-outside) {
  background: var(--color-background-primary);
}
.cal-day.cal-weekend:not(.cal-outside) .cal-day-num {
  color: var(--color-text-tertiary);
}

/* Past school days — muted with cross-off */
.cal-day.cal-past .cal-day-num {
  color: var(--color-text-tertiary);
  opacity: 0.5;
}

/* Cross-off mark (X lines) */
.cal-xoff {
  position: absolute;
  inset: 5px;
  pointer-events: none;
  z-index: 2;
}
.cal-xoff::before,
.cal-xoff::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 55%;
  height: 1.5px;
  background: color-mix(in srgb, var(--quarterly) 35%, var(--color-border));
  border-radius: 2px;
  transform-origin: center;
}
.cal-xoff::before { transform: translate(-50%,-50%) rotate(45deg); }
.cal-xoff::after  { transform: translate(-50%,-50%) rotate(-45deg); }

/* Future school days */
.cal-day.cal-future .cal-day-num {
  color: var(--color-text-primary);
}

/* Today — weekly blue circle */
.cal-day.cal-today {
  background: color-mix(in srgb, var(--weekly) 8%, var(--color-surface));
}
.cal-day.cal-today .cal-day-num {
  background: var(--weekly);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Clickable school days — pointer cursor + hover hint */
.cal-day.cal-clickable { cursor: pointer; }
.cal-day.cal-clickable:hover:not(.cal-vacation):not(.cal-today):not(.cal-last) {
  background: color-mix(in srgb, var(--yearly) 8%, var(--color-surface));
}

/* Vacation day — amber tint with sun mark */
.cal-day.cal-vacation {
  background: color-mix(in srgb, var(--yearly) 14%, var(--color-surface));
}
.cal-day.cal-vacation .cal-day-num {
  color: color-mix(in srgb, var(--yearly) 80%, var(--color-text-primary));
  font-weight: 700;
}
.cal-day.cal-vacation-past .cal-day-num {
  opacity: 0.6;
}
.cal-vmark {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 0.55rem;
  line-height: 1;
  opacity: 0.7;
  pointer-events: none;
  z-index: 2;
}
.cal-day.cal-vacation:hover {
  background: color-mix(in srgb, var(--yearly) 22%, var(--color-surface));
}

/* Last day — yearly gold circle with glow */
.cal-day.cal-last {
  background: color-mix(in srgb, var(--yearly) 12%, var(--color-surface));
}
.cal-day.cal-last .cal-day-num {
  background: var(--yearly);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yearly) 28%, transparent);
}

/* ════════════════════════════════════════════════════════════════
   Responsive
════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .cd-header { padding: 10px 14px; }
  .days-count { font-size: 1.3rem; }
  .days-label { font-size: 0.75rem; }
  .calendar-container {
    grid-template-columns: 1fr;
    padding: 14px 12px 48px;
    gap: 12px;
  }
}
