/* Room 204 Schedule Generator — Stylesheet */

:root {
  --color-bg:        #f5f7fa;
  --color-card:      #ffffff;
  --color-border:    #d1d9e0;
  --color-primary:   #2563eb;
  --color-primary-h: #1d4ed8;
  --color-text:      #1e293b;
  --color-muted:     #64748b;
  --color-warn:      #b45309;
  --color-uncov:     #fee2e2;
  --color-break:     #fef9c3;
  --radius:          8px;
  --shadow:          0 1px 3px rgba(0,0,0,.1);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  padding: 1rem;
}

header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}
header h1 { font-size: 1.6rem; }
header .subtitle { color: var(--color-muted); font-size: .95rem; }

main {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card h2 { font-size: 1.15rem; margin-bottom: 1rem; }

/* ── Form ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .9rem; }
select, input[type="text"], textarea, button {
  font-family: inherit;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .45rem .65rem;
  font-size: .95rem;
  background: #fff;
}
textarea { resize: vertical; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .9rem;
  cursor: pointer;
}
.checkbox-label input { width: auto; }

.sub-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .5rem;
}
.sub-row input { flex: 2; }
.sub-row select { flex: 1; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: .6rem 1.4rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--color-primary-h); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 4px;
  padding: .45rem 1rem;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { background: #eff6ff; }

.loading-indicator { margin-left: 1rem; color: var(--color-muted); font-size: .9rem; }

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#loading-overlay[hidden] { display: none; }
.loading-box {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 3rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  max-width: 320px;
}
.loading-box p { font-size: 1.1rem; font-weight: 600; margin-top: 1rem; }
.loading-box .loading-sub { font-size: .85rem; font-weight: 400; color: var(--color-muted); margin-top: .4rem; }
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e2e8f0;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Output header ── */
.output-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.output-header h2 { margin-bottom: 0; }
.output-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pass-rate { font-size: .85rem; font-weight: 600; color: #16a34a; }
.pass-rate.warn { color: var(--color-warn); }

/* ── Schedule grid ── */
.schedule-wrapper { overflow-x: auto; }

.schedule-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.schedule-grid th {
  background: #1e293b;
  color: #fff;
  padding: .5rem .6rem;
  text-align: left;
  white-space: nowrap;
}
.schedule-grid td {
  border: 1px solid var(--color-border);
  padding: .45rem .5rem;
  vertical-align: top;
  min-width: 80px;
}
.schedule-grid .time-col { font-weight: 600; white-space: nowrap; }
.schedule-grid .type-col { color: var(--color-muted); font-size: .75rem; min-width: 90px; }
.activity-label { font-size: .7rem; font-weight: 700; color: #1e293b; margin-top: .15rem; }
.break-names { margin-top: .25rem; display: flex; flex-wrap: wrap; gap: 2px; }
.break-chip { font-size: .65rem !important; padding: .1rem .3rem !important; opacity: .85; }
.pe-block { background: #e0f2fe; color: #0369a1; font-weight: 600; font-size: .8rem; text-align: center; }
.schedule-grid td.uncovered      { background: var(--color-uncov); color: #b91c1c; font-weight: 600; }
.schedule-grid td.break-uncovered { background: var(--color-break); color: #92400e; }
.schedule-grid small { color: #475569; display: block; }
.staff-cell { padding: .35rem .4rem !important; }
.staff-chip {
  display: inline-block;
  border-radius: 4px;
  padding: .15rem .4rem;
  font-size: .75rem;
  font-weight: 600;
  margin: .1rem .1rem .1rem 0;
  white-space: nowrap;
}
.center-label {
  font-size: .7rem;
  color: #475569;
  margin-top: .2rem;
  font-style: italic;
}

/* ── Report ── */
.report-content { font-size: .9rem; line-height: 1.6; }
.report-content h1, .report-content h2, .report-content h3 { margin: 1rem 0 .5rem; }
.report-content ul, .report-content ol { padding-left: 1.5rem; margin: .5rem 0; }
.report-content blockquote {
  border-left: 3px solid var(--color-primary);
  margin: .75rem 0;
  padding: .5rem 1rem;
  background: #f0f6ff;
  color: var(--color-text);
  font-style: italic;
}

/* ── Chat ── */
.hint { color: var(--color-muted); font-size: .85rem; margin-bottom: .75rem; }
.chat-messages {
  min-height: 60px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .75rem;
  margin-bottom: .75rem;
  font-size: .9rem;
}
.chat-msg { margin-bottom: .5rem; }
.chat-msg.user { color: var(--color-primary); }
.chat-msg.agent { color: var(--color-text); }
.chat-msg.error { color: #b91c1c; }
.chat-input-row { display: flex; gap: .5rem; }
.chat-input-row input { flex: 1; }

/* ── Legend ── */
.legend {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  box-shadow: var(--shadow);
  font-size: .8rem;
}
.legend h3 { font-size: .85rem; margin-bottom: .5rem; }
.legend ul { list-style: none; }
.legend li {
  padding: .2rem .5rem;
  border-radius: 3px;
  margin-bottom: .25rem;
}

@media (max-width: 900px) {
  .legend { display: none; }
}

@media print {
  header, #input-section, #chat-section, .legend, .btn-primary, .btn-secondary { display: none; }
  .card { box-shadow: none; border: none; }
  body { background: #fff; }
}
