/* =============================================================================
   Pomodoro Timer — Styles
   ============================================================================= */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --work-color:  #e74c3c;
  --break-color: #27ae60;
  --bg:          #1a1a2e;
  --surface:     #16213e;
  --surface2:    #0f3460;
  --text:        #eaeaea;
  --text-muted:  #666;
  --accent:      #e74c3c;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);

  /* Uncomment to use a background image:
     background-image: url('assets/bg.jpg');
     background-size: cover;
     background-position: center;
     background-attachment: fixed; */

  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 3rem;
  gap: 1.6rem;
}

h1 {
  font-size: 1.1rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Config panel ─────────────────────────────────────────────────────────── */
.config-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.2rem 1.5rem;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.config-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.field input {
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  padding: 0.48rem 0.7rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

.field input:focus {
  border-color: var(--accent);
}

.calc-info {
  background: var(--surface2);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
  min-height: 2.2rem;
}

.calc-info strong {
  color: var(--text);
}

.btn-apply {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-apply:hover  { opacity: 0.85; }
.btn-apply:active { transform: scale(0.98); }

/* ── Timer ring ───────────────────────────────────────────────────────────── */
.timer-ring {
  position: relative;
  width: 230px;
  height: 230px;
}

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

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

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.4s;
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

#time-display {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

#mode-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* ── Sessions strip ───────────────────────────────────────────────────────── */
.sessions-strip {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 500px;
  width: 100%;
  padding: 0 1rem;
}

.strip-item {
  height: 7px;
  border-radius: 4px;
  transition: background 0.3s, box-shadow 0.3s;
}

.strip-work  { background: var(--surface2); min-width: 24px; flex: 1; }
.strip-break { background: var(--surface2); min-width: 10px; flex: 0 0 10px; }

.strip-work.done    { background: var(--work-color); }
.strip-break.done   { background: var(--break-color); }
.strip-work.active  { background: var(--work-color);  box-shadow: 0 0 8px var(--work-color); }
.strip-break.active { background: var(--break-color); box-shadow: 0 0 8px var(--break-color); }

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: transform 0.1s, opacity 0.2s;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 2.5rem;
  font-size: 1rem;
  min-width: 130px;
}

.btn-icon {
  background: var(--surface);
  color: var(--text-muted);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ── Info bar ─────────────────────────────────────────────────────────────── */
.info-bar {
  background: var(--surface);
  border-radius: 14px;
  padding: 0.8rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  max-width: 500px;
}

.info-cell { display: flex; flex-direction: column; gap: 0.2rem; }
.info-cell:nth-child(2) { align-items: center; }
.info-cell:nth-child(3) { align-items: flex-end; }

.info-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.info-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.status-ok     { background: rgba(39,174,96,.18);  color: #2ecc71; }
.status-ahead  { background: rgba(41,128,185,.18); color: #5dade2; }
.status-behind { background: rgba(231,76,60,.18);  color: #e74c3c; }
.status-idle   { background: var(--surface2);      color: var(--text-muted); }

/* ── Schedule panel ───────────────────────────────────────────────────────── */
.schedule-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.schedule-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.schedule-countdown {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.schedule-countdown strong {
  color: var(--text);
  font-size: 0.82rem;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface2) transparent;
}

.schedule-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  transition: background 0.2s;
}

.schedule-row.active { background: var(--surface2); }
.schedule-row.done   { opacity: 0.38; }

.sched-time {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.schedule-row.active .sched-time { color: var(--text); }

.sched-label {
  font-size: 0.82rem;
  font-weight: 500;
}

.schedule-row.active .sched-label {
  font-weight: 700;
  color: var(--accent);
}

.sched-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface2);
  flex-shrink: 0;
}

.schedule-row.done   .sched-dot { background: var(--text-muted); }
.schedule-row.active .sched-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

/* ── Sound toggle ─────────────────────────────────────────────────────────── */
#sound-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  background: var(--surface);
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toast notification ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-130%);
  background: var(--surface2);
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  font-size: 0.86rem;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }
