/* === Reset & Base === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap');

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

:root {
  --primary: #1a365d;
  --primary-light: #2a4a7f;
  --accent: #c9963b;
  --accent-light: #e8b44d;
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
  --container: 1100px;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.3; color: var(--primary); }
h1 { font-family: var(--font-heading); font-size: 2.2rem; margin-bottom: 0.5em; }
h2 { font-family: var(--font-heading); font-size: 1.8rem; margin-bottom: 0.5em; }
h3 { font-size: 1.2rem; margin-bottom: 0.4em; }

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 72px;
  gap: 32px;
}

.logo {
  font-family: var(--font-heading);
  color: var(--primary) !important;
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.main-nav a {
  display: inline-block;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 8px;
  transition: all 0.2s;
}
.main-nav a:hover {
  color: var(--primary);
  background: rgba(26,54,93,0.06);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.nav-auth:empty { display: none; }

.nav-auth a {
  display: inline-block;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 8px;
  transition: all 0.2s;
}
.nav-auth a:hover {
  color: var(--primary);
  background: rgba(26,54,93,0.06);
}

.nav-auth .nav-user {
  color: var(--text-light);
  font-size: 0.85rem;
  white-space: nowrap;
  padding: 8px 12px;
}

.nav-auth .nav-logout {
  color: var(--accent) !important;
}
.nav-auth .nav-logout:hover {
  background: rgba(201,150,59,0.08);
  color: var(--accent) !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}
.btn-outline:hover {
  background: rgba(26,54,93,0.06);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.btn-danger:hover { background: #a93226; border-color: #a93226; color: #fff; }

.btn-sm { padding: 8px 20px; font-size: 0.85rem; }

/* === Footer === */
.site-footer {
  background: linear-gradient(135deg, var(--primary) 0%, #0f2744 100%);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 28px 0;
  margin-top: 60px;
  font-size: 0.9rem;
}

/* === Signup page === */
.signup-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.signup-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--border);
}

.signup-card--wide { max-width: 680px; }

.signup-card iframe {
  display: block;
  border: none;
  border-radius: var(--radius);
}

.signup-card h2 { text-align: center; margin-bottom: 8px; }

.signup-intro {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.signup-card .btn { width: 100%; margin-top: 8px; }

.signup-card textarea {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 1rem;
  font-family: var(--font-body);
  resize: vertical;
}

.signup-card textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.required { color: #c0392b; }

.radio-group {
  display: flex;
  gap: 24px;
  margin-top: 4px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: normal;
}

.radio-label input[type="radio"] {
  width: auto;
  accent-color: var(--primary);
}

/* === Landing === */
.hero {
  background: linear-gradient(rgba(10,20,40,0.55), rgba(10,20,40,0.55)),
              url('../img/hero-bg.jpeg') center/cover no-repeat;
  color: #fff;
  padding: 120px 24px;
  text-align: center;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero .container {
  max-width: 860px;
}

.hero h1 {
  color: #fff;
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 750px;
  margin: 0 auto 36px;
  line-height: 1.8;
}

.hero-verse {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.05rem;
  opacity: 0.8;
  max-width: 750px;
  margin: 0 auto 36px;
  line-height: 1.8;
}

.hero-verse span {
  display: block;
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.7;
  font-style: normal;
  font-family: var(--font-body);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 80px 0;
}

.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-card .icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.feature-card p { color: var(--text-light); font-size: 0.95rem; line-height: 1.8; }

.section-title {
  text-align: center;
  padding-top: 60px;
  margin-bottom: 12px;
  font-family: var(--font-heading);
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 48px;
  font-size: 1.1rem;
}

/* === Auth gate === */
.auth-gate-message {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 32px 0;
}

.auth-gate-message p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

/* === Course card on landing === */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  padding-bottom: 40px;
}

.course-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.course-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 28px;
}

.course-card-header h3 { color: #fff; font-family: var(--font-heading); font-size: 1.3rem; }
.course-card-header p { opacity: 0.8; margin-top: 6px; font-size: 0.9rem; }

.course-card-body {
  padding: 24px 28px;
}

.course-card-body p { color: var(--text-light); margin-bottom: 16px; font-size: 0.95rem; line-height: 1.8; }

.course-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* === Lessons list === */
.lessons-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 40px 0;
}

.lessons-list li a {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  padding: 20px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.3s;
}

.lessons-list li a:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.lesson-num {
  background: var(--primary);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1rem;
}

.lesson-info h3 { font-size: 1.1rem; margin-bottom: 2px; font-family: var(--font-body); }
.lesson-info p { color: var(--text-light); font-size: 0.9rem; margin: 0; }

.lesson-status {
  margin-left: auto;
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 50px;
  background: rgba(26,54,93,0.08);
  color: var(--primary);
  font-weight: 600;
  display: none;
}

.lesson-status.visible { display: inline-block; }

/* === Lesson page === */
.lesson-page { padding: 40px 0; }

.lesson-header { margin-bottom: 32px; }

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.lesson-reference {
  color: var(--text-light);
  font-style: italic;
  font-size: 1.05rem;
}

.lesson-content h2 {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 8px;
}

.lesson-content p {
  margin-bottom: 16px;
  line-height: 1.8;
}

.lesson-content blockquote {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--primary);
  border-left: 4px solid var(--accent);
  padding: 20px 28px;
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  line-height: 1.8;
}

/* Question blocks */
.question-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
}

.question-block label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--primary);
}

.question-block textarea {
  width: 100%;
  min-height: 80px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.2s;
}

.question-block textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.save-status {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

/* === Login page === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 40px 20px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 8px;
  display: none;
}

.form-error.visible { display: block; }

.login-card .btn { width: 100%; margin-top: 8px; }

/* === Admin === */
.admin-page { padding: 40px 0; }

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.admin-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-table tr:hover td { background: rgba(26,54,93,0.03); }

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.modal h3 { margin-bottom: 20px; }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* User answers view in admin */
.answers-list {
  list-style: none;
}

.answers-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}

.answers-list li strong { color: var(--primary); }
.answers-list li p { margin-top: 4px; color: var(--text); }

/* === My answers page === */
.my-answers-page { padding-bottom: 40px; }

.answers-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}

.answer-lesson-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.answer-lesson-block h3 { margin-bottom: 4px; }

.answer-ref {
  font-weight: normal;
  color: var(--text-light);
  font-size: 0.9rem;
}

.answer-date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.answer-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.answer-item:first-of-type { border-top: none; margin-top: 12px; }

.answer-question {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.answer-text {
  line-height: 1.6;
}

.print-header { display: none; }
.print-meta { color: var(--text-light); }

/* === About page === */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.about-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
}

.about-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.about-card-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.about-card h3 { margin-bottom: 8px; }
.about-card p { color: var(--text-light); font-size: 0.95rem; flex: 1; line-height: 1.8; }

.about-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.about-meta {
  font-size: 0.8rem;
  color: var(--text-light);
}

.about-section {
  padding: 40px 0;
  border-top: 2px solid var(--accent);
}

.about-section h2 { margin-bottom: 12px; }
.about-section p { max-width: 100%; line-height: 1.8; }

.about-steps {
  list-style: none;
  counter-reset: step;
  margin-top: 12px;
}

.about-steps li {
  counter-increment: step;
  padding: 10px 0 10px 44px;
  position: relative;
  font-size: 1.05rem;
}

.about-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Print === */
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  .print-header { display: block; margin-bottom: 24px; }
  .answer-lesson-block { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero { padding: 60px 20px; min-height: auto; }
  .features { grid-template-columns: 1fr; }

  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
  }

  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }

  .nav-auth {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .admin-table { font-size: 0.85rem; }
  .admin-table th, .admin-table td { padding: 8px 10px; }

  .courses-grid { grid-template-columns: 1fr; }
}
