/* ──── Study Builder Layout ──── */
.study-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.study-body {
  flex: 1;
  padding: var(--space-12) 0;
}

.study-container {
  max-width: 720px;
  margin: 0 auto;
}

/* ──── Step Indicator ──── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-12);
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-faint);
  transition: all var(--duration-normal) var(--ease-out);
}

.step-dot.active {
  border-color: var(--color-gold);
  background-color: var(--color-gold);
  color: var(--color-bg);
}

.step-dot.completed {
  border-color: var(--color-gold);
  background-color: var(--color-gold-muted);
  color: var(--color-gold);
}

.step-line {
  width: 48px;
  height: 2px;
  background-color: var(--color-border);
  transition: background-color var(--duration-normal) var(--ease-out);
}

.step-line.completed {
  background-color: var(--color-gold);
}

/* ──── Step 1: Setup Form ──── */
.study-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.study-form h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  text-align: center;
  margin-bottom: var(--space-2);
}

.study-form .form-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

.form-field input,
.form-field select {
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px var(--color-gold-muted);
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a9bb0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: var(--space-10);
}

.form-field select option {
  background-color: var(--color-surface);
  color: var(--color-text);
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.radio-option {
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: center;
}

.radio-option input:checked + label {
  border-color: var(--color-gold);
  background-color: var(--color-gold-muted);
  color: var(--color-gold);
}

.radio-option label:hover {
  border-color: var(--color-gold-border);
}

.generate-btn {
  padding: var(--space-4) var(--space-8);
  background-color: var(--color-gold);
  color: var(--color-bg);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
  margin-top: var(--space-4);
}

.generate-btn:hover {
  background-color: var(--color-gold-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ──── Step 2: Loading ──── */
.study-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  gap: var(--space-8);
}

.study-loading.active {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-status {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  min-height: 24px;
}

/* ──── Step 3: Study Output ──── */
.study-output {
  display: none;
}

.study-output.active {
  display: block;
}

.study-output-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.study-output-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
}

.study-output-header p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.study-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-10);
}

.study-actions .btn svg {
  width: 16px;
  height: 16px;
}

/* Day Cards */
.day-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.day-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.day-card:hover {
  box-shadow: var(--shadow-gold);
}

.day-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.day-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-gold-muted);
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

.day-card-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
}

.day-passage {
  margin-bottom: var(--space-6);
}

.day-passage .passage-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}

.day-passage .passage-ref {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-gold);
}

.day-section {
  margin-bottom: var(--space-6);
}

.day-section:last-child {
  margin-bottom: 0;
}

.day-section h4 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}

.day-section ol,
.day-section ul {
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.day-section ol { list-style: decimal; }
.day-section ul { list-style: disc; }

.day-section li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

/* Confessional Anchor */
.confessional-anchor {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
}

.confessional-anchor .anchor-source {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-gold);
  margin-bottom: var(--space-2);
}

.confessional-anchor .anchor-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

/* Theologian Quote */
.theologian-quote {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
}

.theologian-quote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-2);
}

.theologian-quote cite {
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ──── Print / PDF Export ──── */
@media print {
  @page {
    margin: 0.75in;
    size: letter;
  }

  *,
  *::before,
  *::after {
    background: white !important;
    color: #1a1a1a !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: #ccc !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-header,
  .mobile-menu,
  .site-footer,
  .step-indicator,
  .study-actions,
  #step-setup,
  #step-loading {
    display: none !important;
  }

  .study-page {
    min-height: auto;
  }

  .study-body {
    padding: 0;
  }

  .study-output {
    display: block !important;
  }

  .study-output-header {
    margin-bottom: 24pt;
    border-bottom: 2pt solid #c9a84c !important;
    padding-bottom: 12pt;
  }

  .study-output-header h2 {
    font-size: 20pt;
    color: #1a1a1a !important;
  }

  .study-output-header p {
    font-size: 11pt;
    color: #444 !important;
  }

  .day-card {
    border: 1px solid #ddd !important;
    padding: 18pt;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 18pt;
  }

  .day-card-header {
    border-bottom: 1px solid #ddd !important;
  }

  .day-number {
    background: #f5f0e0 !important;
    color: #8a7530 !important;
    border: 1px solid #c9a84c !important;
  }

  .day-passage .passage-ref {
    color: #8a7530 !important;
  }

  .day-section h4 {
    color: #666 !important;
  }

  .confessional-anchor {
    border-left: 3px solid #c9a84c !important;
    background: #faf8f0 !important;
  }

  .confessional-anchor .anchor-source {
    color: #8a7530 !important;
  }

  .theologian-quote {
    background: #f9f9f9 !important;
  }

  a[href]::after {
    content: none !important;
  }
}

/* ──── Responsive ──── */
@media (max-width: 768px) {
  .study-body {
    padding: var(--space-8) 0;
  }

  .day-card {
    padding: var(--space-6);
  }

  .radio-group {
    grid-template-columns: 1fr 1fr;
  }

  .study-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .study-actions .btn {
    justify-content: center;
  }
}
