/* ============================================
   Swim Training Generator — Styles
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #111;
  padding: 2rem 1rem;
}

/* ── Layout ───────────────────────────────── */
.app {
  max-width: 800px;
  margin: 0 auto;
}

.header {
  margin-bottom: 1.5rem;
}

.header h1 {
  font-size: 26px;
  font-weight: 600;
  color: #0a1628;
}

.header p {
  font-size: 15px;
  color: #555;
  margin-top: 6px;
}

/* ── Cards ────────────────────────────────── */
.form-card {
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.form-card h2 {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.1rem;
}

/* ── Form Elements ────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label, .section-label {
  font-size: 13px;
  color: #555;
  display: block;
}

select, input[type="text"], input[type="number"], textarea {
  font-family: inherit;
  font-size: 14px;
  color: #111;
  background: #f8f9fb;
  border: 1px solid #dde0e8;
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.15s;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: #3b73d8;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.divider {
  border: none;
  border-top: 1px solid #f0f1f3;
  margin: 1.1rem 0;
}

/* ── Pool Selector ────────────────────────── */
.pool-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin: 8px 0;
}

.pool-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 8px;
  border: 1px solid #dde0e8;
  border-radius: 12px;
  cursor: pointer;
  background: #f8f9fb;
  transition: all 0.15s;
}

.pool-option:hover {
  background: #fff;
  border-color: #c0cbea;
}

.pool-option.selected {
  background: #eef2fd;
  border: 2px solid #3b73d8;
}

.pool-label {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.pool-sublabel {
  font-size: 11px;
  color: #888;
}

.pool-option.selected .pool-label,
.pool-option.selected .pool-sublabel {
  color: #2256c7;
}

.pool-note {
  margin-top: 10px;
  font-size: 12px;
  color: #777;
  padding: 8px 12px;
  background: #f8f9fb;
  border-radius: 8px;
  line-height: 1.5;
}

/* ── Volume Selector ──────────────────────── */
.volume-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
  margin: 8px 0;
}

.vol-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 11px 6px;
  border: 1px solid #dde0e8;
  border-radius: 8px;
  cursor: pointer;
  background: #f8f9fb;
  transition: all 0.15s;
  text-align: center;
}

.vol-option:hover {
  background: #fff;
}

.vol-option.selected {
  background: #eef2fd;
  border: 2px solid #3b73d8;
}

.vol-label {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.vol-sub {
  font-size: 10px;
  color: #888;
  margin-top: 3px;
}

.vol-option.selected .vol-label,
.vol-option.selected .vol-sub {
  color: #2256c7;
}

/* ── Custom Volume ────────────────────────── */
.custom-vol-wrap {
  display: none;
  margin-top: 10px;
}

.custom-vol-wrap.visible {
  display: block;
}

.custom-vol-inner {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 10px;
}

.custom-hint {
  font-size: 11px;
  color: #888;
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Detail Mode Selector ─────────────────── */
.program-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
  margin: 8px 0;
}

.detail-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border: 1px solid #dde0e8;
  border-radius: 8px;
  cursor: pointer;
  background: #f8f9fb;
  transition: all 0.15s;
  text-align: center;
  gap: 4px;
}

.detail-option:hover {
  background: #fff;
}

.detail-option.selected {
  background: #eef2fd;
  border: 2px solid #3b73d8;
}

.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.detail-sub {
  font-size: 10px;
  color: #888;
}

.detail-option.selected .detail-label,
.detail-option.selected .detail-sub {
  color: #2256c7;
}

.detail-note {
  font-size: 11px;
  color: #888;
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8f9fb;
  border-radius: 6px;
  line-height: 1.5;
}

/* ── Tags ─────────────────────────────────── */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}

.tag {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  background: #f2f3f6;
  color: #555;
  border: 1px solid #dde0e8;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.tag:hover {
  background: #e8eaf0;
}

.tag.selected {
  background: #eef2fd;
  color: #2256c7;
  border-color: #3b73d8;
  font-weight: 500;
}

/* ── Generate Button ──────────────────────── */
.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #2256c7;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 1rem;
  transition: background 0.15s;
  letter-spacing: 0.01em;
}

.btn-generate:hover {
  background: #1a46a8;
}

.btn-generate:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Output ───────────────────────────────── */
.output-card {
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.output-card h2 {
  font-size: 17px;
  font-weight: 600;
  color: #0a1628;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f1f3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.output-body {
  font-size: 14px;
  color: #222;
  line-height: 1.85;
  white-space: pre-wrap;
}

/* ── Badges ───────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  background: #eef2fd;
  color: #2256c7;
}

.badge-success {
  background: #e6f4ea;
  color: #137333;
}

.badge-warning {
  background: #fef7e0;
  color: #9a6000;
}

/* ── Loading ──────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #888;
  font-size: 14px;
  padding: 1rem 0;
}

.dots {
  display: flex;
  gap: 5px;
}

.dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbb;
  animation: dp 1.2s infinite;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dp {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ── Info / Error ─────────────────────────── */
.info-box {
  font-size: 13px;
  color: #555;
  padding: 12px 14px;
  background: #f8f9fb;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  margin-top: 1rem;
  line-height: 1.6;
}

.error {
  color: #b91c1c;
  font-size: 13px;
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  margin-top: 1rem;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .volume-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .pool-selector,
  .program-detail-grid {
    grid-template-columns: 1fr;
  }
}
