/* ═══════════════════════════════════════════════════════════
   PARSHA PAGE STYLES
   Daily Torah Portion Display & Learning Modes
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   PARSHA HERO
   ───────────────────────────────────────────── */
.parsha-hero {
  position: relative;
  padding: 8rem 2rem 3rem;
  background: linear-gradient(180deg, rgba(43, 76, 126, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.parsha-header-content {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 3rem;
}

.book-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  color: var(--warm-gold);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.parsha-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.parsha-name-english {
  color: var(--text-primary);
}

.parsha-name-hebrew {
  font-family: var(--font-hebrew);
  color: var(--warm-gold);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  direction: rtl;
  text-shadow: 0 0 30px var(--glow-gold);
}

.parsha-meta {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 1rem;
}

/* ─────────────────────────────────────────────
   MODE SELECTOR
   ───────────────────────────────────────────── */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-smooth);
  font-family: var(--font-sans);
}

.mode-tab:hover {
  border-color: var(--border-gold);
  background: rgba(212, 175, 55, 0.1);
  transform: translateY(-2px);
}

.mode-tab.active {
  border-color: var(--warm-gold);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.1));
  color: var(--text-gold);
  box-shadow: 0 8px 24px var(--glow-gold);
}

.mode-icon {
  font-size: 1.25rem;
}

/* ─────────────────────────────────────────────
   PARSHA CONTAINER
   ───────────────────────────────────────────── */
.parsha-container {
  position: relative;
  z-index: 10;
}

.learning-section {
  display: none;
  padding: 4rem 0;
  animation: fadeIn 0.5s ease;
}

.learning-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.container-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-story {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ─────────────────────────────────────────────
   CASUAL MODE
   ───────────────────────────────────────────── */
.casual-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem;
  border-radius: var(--radius-xl);
}

.content-title {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.quick-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.summary-card,
.takeaway-card,
.wisdom-card {
  padding: 2.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition-smooth);
}

.summary-card:hover,
.takeaway-card:hover,
.wisdom-card:hover {
  border-color: var(--border-gold);
  box-shadow: 0 12px 40px var(--shadow-deep);
  transform: translateY(-4px);
}

.summary-card h3,
.takeaway-card h3,
.wisdom-card h3 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--warm-gold);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary-card h3::before {
  content: '📖';
}

.takeaway-card h3::before {
  content: '💡';
}

.wisdom-card h3::before {
  content: '✨';
}

.summary-text p,
.takeaway-text p,
.wisdom-text p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.1rem;
}

.read-full-button {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 1.25rem 3rem;
  background: linear-gradient(135deg, var(--warm-gold), var(--soft-gold));
  color: var(--sacred-black);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  font-family: var(--font-sans);
}

.read-full-button:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(212, 175, 55, 0.4);
}

/* ─────────────────────────────────────────────
   DEEP DIVE MODE
   ───────────────────────────────────────────── */

/* Aliyah Navigation */
.aliyah-nav {
  margin-bottom: 3rem;
  text-align: center;
}

.aliyah-nav h3 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.aliyah-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.aliyah-button {
  padding: 0.75rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.aliyah-button:hover {
  border-color: var(--border-gold);
  color: var(--text-gold);
  background: rgba(212, 175, 55, 0.1);
}

.aliyah-button.active {
  border-color: var(--warm-gold);
  background: var(--warm-gold);
  color: var(--sacred-black);
  font-weight: 600;
}

/* Parallel Text Display */
.parallel-text-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

.hebrew-column,
.english-column {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.column-header {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--warm-gold);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-gold);
  text-align: center;
}

.text-content {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  line-height: 2;
  font-size: 1.15rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: 100%;
  box-sizing: border-box;
}

/* Custom Scrollbar */
.text-content::-webkit-scrollbar {
  width: 8px;
}

.text-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.text-content::-webkit-scrollbar-thumb {
  background: var(--warm-gold);
  border-radius: 4px;
}

.text-content::-webkit-scrollbar-thumb:hover {
  background: var(--soft-gold);
}

.hebrew-text {
  font-family: var(--font-hebrew);
  font-size: 1.3rem;
  direction: rtl;
  text-align: right;
  color: var(--text-primary);
}

.english-text {
  color: var(--text-secondary);
}

.verse {
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.verse:hover {
  background: rgba(212, 175, 55, 0.08);
}

.verse-number {
  display: inline-block;
  width: 30px;
  color: var(--warm-gold);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Commentary Section */
.commentary-section {
  margin-top: 4rem;
  padding: 3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.commentary-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.comm-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 3px solid transparent;
  font-family: var(--font-sans);
}

.comm-tab:hover {
  color: var(--text-gold);
}

.comm-tab.active {
  color: var(--warm-gold);
  border-bottom-color: var(--warm-gold);
}

.commentary-content {
  min-height: 400px;
}

.commentary-tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.commentary-tab-content.active {
  display: block;
}

.commentary-item {
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--warm-gold);
}

.commentary-source {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--warm-gold);
  margin-bottom: 1rem;
  font-weight: 600;
}

.commentary-text {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.05rem;
}

.reference-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--warm-gold);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.reference-link:hover {
  text-shadow: 0 0 10px var(--glow-gold);
}

/* ─────────────────────────────────────────────
   STORY MODE
   ───────────────────────────────────────────── */
.story-content {
  padding: 4rem 0;
}

.story-text {
  background: var(--bg-card);
  padding: 4rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  line-height: 2;
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-family: var(--font-serif);
}

.story-text p {
  margin-bottom: 2rem;
  text-indent: 2rem;
}

.story-text p:first-of-type::first-letter {
  font-size: 4rem;
  line-height: 1;
  float: left;
  margin: 0.1rem 0.5rem 0 0;
  color: var(--warm-gold);
  font-weight: 700;
}

.story-section {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.story-section:last-child {
  border-bottom: none;
}

/* ─────────────────────────────────────────────
   LOADING STATES
   ───────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
}

.loading::after {
  content: '⏳';
  font-size: 2rem;
  margin-left: 1rem;
  animation: spin 2s linear infinite;
}

/* Global Loading Overlay */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-content {
  text-align: center;
  max-width: 400px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--warm-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
}

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

.loading-text {
  font-size: 1.5rem;
  color: var(--warm-gold);
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
}

.loading-subtext {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Global Error State */
.global-error {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.error-content {
  max-width: 500px;
  padding: 3rem;
  border-radius: var(--radius-xl);
  text-align: center;
  border: 2px solid rgba(139, 38, 53, 0.5);
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.error-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: #ff6b6b;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.error-button {
  padding: 1rem 2rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  font-family: var(--font-sans);
}

.error-button.primary {
  background: linear-gradient(135deg, var(--warm-gold), var(--soft-gold));
  color: var(--sacred-black);
  border-color: var(--warm-gold);
}

.error-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.error-button.primary:hover {
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

/* Aliyah Markers */
.aliyah-marker {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.1));
  border: 2px solid var(--warm-gold);
  border-radius: var(--radius-md);
  color: var(--warm-gold);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 2rem 0 1.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-serif);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

@keyframes highlightPulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
  }
  50% {
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.6);
    transform: scale(1.05);
  }
}

.aliyah-range {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  font-weight: 400;
}

/* Verse Highlighting */
.verse.highlighted {
  background: rgba(212, 175, 55, 0.15);
  border-left-color: var(--warm-gold);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
  transform: translateX(4px);
}

.verse {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  padding-left: 0.75rem;
}

/* Error Messages in Text Areas */
.error-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.retry-button {
  margin-top: 1.5rem;
  padding: 1rem 2rem;
  background: var(--warm-gold);
  color: var(--sacred-black);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.retry-button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .parallel-text-container {
    grid-template-columns: 1fr;
  }

  .hebrew-column {
    order: 1;
  }

  .english-column {
    order: 2;
  }
}

@media (max-width: 768px) {
  .parsha-hero {
    padding: 6rem 1.5rem 2rem;
  }

  .mode-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-tab {
    width: 100%;
    justify-content: center;
  }

  .casual-content,
  .commentary-section {
    padding: 2rem 1.5rem;
  }

  .story-text {
    padding: 2rem 1.5rem;
    font-size: 1.1rem;
  }

  .commentary-tabs {
    flex-direction: column;
  }

  .comm-tab {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* ═══════════════════════════════════════════════════════════
   VERSE ACTION BUTTONS
   ═══════════════════════════════════════════════════════════ */

.verse {
  position: relative;
  padding-right: 3rem; /* Make room for action buttons */
}

.verse-actions {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.verse:hover .verse-actions {
  opacity: 1;
}

.verse-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 44px;  /* WCAG AAA compliant touch target */
  min-height: 44px; /* WCAG AAA compliant touch target */
  display: flex;
  align-items: center;
  justify-content: center;
}

.verse-action-btn:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1.1);
}

.verse-action-btn:active {
  transform: scale(0.95);
}

.verse-action-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Mobile: Always show action buttons */
@media (max-width: 768px) {
  .verse-actions {
    opacity: 0.7;
  }

  .verse:hover .verse-actions {
    opacity: 1;
  }
}
