/* Import modern typography from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Inter:wght@300;400;500;600&family=Rubik:ital,wght@0,300..700;1,300..700&display=swap');

:root {
  /* Colors */
  --navy-dark: #0a1128;
  --navy-primary: #1a365d;
  --navy-light: #24467d;
  --gold-primary: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.25);
  --gold-bright: #f5d76e;
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --glass-bg: rgba(26, 54, 93, 0.45);
  --glass-border: rgba(212, 175, 55, 0.2);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  
  /* Fonts */
  --font-title: 'Cinzel', serif;
  --font-sans: 'Inter', sans-serif;
  --font-hebrew: 'Rubik', sans-serif;

  /* Sizing basis */
  --fs-eng-base: 0.95rem;
  --fs-heb-base: 1.25rem;
  --lh-eng-base: 1.6;
  --lh-heb-base: 1.8;
}

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

body {
  background-color: var(--navy-dark);
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(36, 70, 125, 0.45) 0%, transparent 60%),
    radial-gradient(circle at 15% 85%, rgba(212, 175, 55, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(36, 70, 125, 0.2) 0%, transparent 50%);
  color: var(--text-white);
  font-family: var(--font-sans);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.25rem 1rem;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--navy-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--navy-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Container constraints */
.container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 3rem;
}

/* Sync Banner */
.status-banner {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background-color: rgba(26, 54, 93, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-bright);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeInDown 0.6s ease-out;
  cursor: pointer;
  transition: transform 0.2s;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #39ff14;
  border-radius: 50%;
  box-shadow: 0 0 8px #39ff14;
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #39ff14; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Header */
.event-header {
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: fadeIn 0.8s ease-out;
}

.logo-container {
  filter: drop-shadow(0 0 8px var(--gold-glow));
  transition: transform 0.4s ease;
}

.logo-container:hover {
  transform: rotate(5deg) scale(1.05);
}

.event-header h1 {
  font-family: var(--font-title);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold-primary);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  line-height: 1.3;
}

.event-date {
  font-size: 0.8rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

/* Main card */
.bencher-card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem 1.25rem;
  box-shadow: 
    0 12px 35px var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.bencher-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
}

.card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: 1.75rem;
  color: var(--text-white);
  letter-spacing: 1.5px;
}

.hebrew-subtitle {
  font-family: var(--font-hebrew);
  font-size: 1.4rem;
  color: var(--gold-bright);
  font-weight: 500;
}

.divider {
  width: 50px;
  height: 2px;
  background-color: var(--gold-primary);
  margin-top: 0.5rem;
  border-radius: 1px;
}

/* Controls Panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.15);
  width: 100%;
}

.language-toggles {
  display: flex;
  width: 100%;
  background-color: rgba(10, 17, 40, 0.5);
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.6rem 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 9px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  outline: none;
}

.toggle-btn:hover {
  color: var(--text-white);
}

.toggle-btn.active {
  background-color: var(--navy-primary);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--gold-bright);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toggle-btn.active[data-target="heb-block"] {
  font-family: var(--font-hebrew);
  font-size: 0.85rem;
}

.text-scaler-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 17, 40, 0.25);
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.scaler-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 500;
}

.scaler-buttons {
  display: flex;
  gap: 0.5rem;
}

.scale-btn {
  background: rgba(36, 70, 125, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.scale-btn:hover {
  background-color: var(--navy-primary);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.scale-btn:active {
  transform: translateY(1px);
}

/* Accordion Layout */
.bencher-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  transition: font-size 0.3s ease;
}

.accordion-item {
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(10, 17, 40, 0.25);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.3s, background-color 0.3s;
}

.accordion-item.is-active {
  border-color: rgba(212, 175, 55, 0.3);
  background: rgba(10, 17, 40, 0.45);
}

/* Header */
.accordion-header {
  width: 100%;
  background: transparent;
  border: none;
  padding: 1rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  outline: none;
}

.accordion-header:hover {
  background: rgba(212, 175, 55, 0.04);
}

.header-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-grow: 1;
}

.header-title {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-white);
  letter-spacing: 0.2px;
  transition: color 0.3s;
}

.accordion-item.is-active .header-title {
  color: var(--gold-bright);
}

.header-subtitle {
  font-family: var(--font-hebrew);
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
}

.accordion-item.is-active .header-subtitle {
  color: rgba(212, 175, 55, 0.7);
}

.chevron {
  font-size: 0.75rem;
  color: var(--gold-primary);
  margin-left: 0.75rem;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accordion-item.is-active .chevron {
  transform: rotate(180deg);
  color: var(--gold-bright);
}

/* Accordion Grid Animation Content Wrapper */
.accordion-content-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease-out;
  overflow: hidden;
  opacity: 0;
}

.accordion-content-wrapper.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.accordion-content {
  min-height: 0;
  padding: 0 1.15rem 1.25rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Styled Instructions / Directions */
.instruction-text {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--gold-bright);
  background-color: rgba(212, 175, 55, 0.08);
  border-left: 2px solid var(--gold-primary);
  padding: 0.4rem 0.65rem;
  border-radius: 0 6px 6px 0;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Text Stack Containers */
.liturgy-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 1.25rem;
}

.liturgy-stack:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Text Blocks */
.text-block {
  display: block;
}

.text-block.hide-block {
  display: none !important;
}

.badge {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
  opacity: 0.85;
}

.liturgy-text {
  color: var(--text-white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.liturgy-text.english {
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 400;
}

.liturgy-text.transliteration {
  text-align: left;
  font-family: var(--font-sans);
  font-style: italic;
  color: #f3e5ab; /* Soft cream shade to differentiate */
}

.liturgy-text.hebrew {
  font-family: var(--font-hebrew);
  text-align: right;
  direction: rtl;
  letter-spacing: 0.2px;
}

/* Zimmun Layout Specifics */
.zimmun-line {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: rgba(10, 17, 40, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.zimmun-speaker {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-primary);
  display: inline-block;
}

/* Font size configuration mapping */
.font-size-sm .liturgy-text.english,
.font-size-sm .liturgy-text.transliteration {
  font-size: calc(var(--fs-eng-base) - 0.1rem);
  line-height: calc(var(--lh-eng-base) - 0.1);
}
.font-size-sm .liturgy-text.hebrew {
  font-size: calc(var(--fs-heb-base) - 0.15rem);
  line-height: calc(var(--lh-heb-base) - 0.1);
}

.font-size-md .liturgy-text.english,
.font-size-md .liturgy-text.transliteration {
  font-size: var(--fs-eng-base);
  line-height: var(--lh-eng-base);
}
.font-size-md .liturgy-text.hebrew {
  font-size: var(--fs-heb-base);
  line-height: var(--lh-heb-base);
}

.font-size-lg .liturgy-text.english,
.font-size-lg .liturgy-text.transliteration {
  font-size: calc(var(--fs-eng-base) + 0.15rem);
  line-height: calc(var(--lh-eng-base) + 0.15);
}
.font-size-lg .liturgy-text.hebrew {
  font-size: calc(var(--fs-heb-base) + 0.2rem);
  line-height: calc(var(--lh-heb-base) + 0.15);
}

.font-size-xl .liturgy-text.english,
.font-size-xl .liturgy-text.transliteration {
  font-size: calc(var(--fs-eng-base) + 0.3rem);
  line-height: calc(var(--lh-eng-base) + 0.2);
}
.font-size-xl .liturgy-text.hebrew {
  font-size: calc(var(--fs-heb-base) + 0.45rem);
  line-height: calc(var(--lh-heb-base) + 0.2);
}

.font-size-xxl .liturgy-text.english,
.font-size-xxl .liturgy-text.transliteration {
  font-size: calc(var(--fs-eng-base) + 0.5rem);
  line-height: calc(var(--lh-eng-base) + 0.25);
}
.font-size-xxl .liturgy-text.hebrew {
  font-size: calc(var(--fs-heb-base) + 0.7rem);
  line-height: calc(var(--lh-heb-base) + 0.25);
}

/* Action button */
.action-container {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-primary {
  width: 100%;
  padding: 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--gold-primary);
  background: linear-gradient(135deg, var(--gold-primary) 0%, #b3922e 100%);
  color: var(--navy-dark);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.3);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  outline: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.45);
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-primary) 100%);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary.completed {
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow: none;
}

.btn-primary.completed:hover {
  background: rgba(212, 175, 55, 0.06);
}

/* Accordion details guidelines card */
.info-accordion {
  width: 100%;
  background: rgba(26, 54, 93, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
}

.accordion-details {
  padding: 1.15rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 17, 40, 0.2);
}

.accordion-summary {
  padding: 0.9rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-bright);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  list-style: none;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary::after {
  content: '▼';
  font-size: 0.65rem;
  transition: transform 0.25s ease;
  color: var(--gold-primary);
}

.info-accordion[open] .accordion-summary::after {
  transform: rotate(180deg);
}

.accordion-details p {
  margin-bottom: 0.5rem;
}

.accordion-details ul {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}

.accordion-details li {
  margin-bottom: 0.4rem;
}

/* Event Nav & Footer */
.event-navigation {
  text-align: center;
  margin-top: 0.5rem;
}

.nav-link {
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s, text-shadow 0.2s;
}

.nav-link:hover {
  color: var(--text-white);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.app-footer {
  text-align: center;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.app-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-footer .copyright {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Confetti particles */
.confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-card-flash {
  animation: successFlash 1s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successFlash {
  0% {
    box-shadow: 0 12px 35px var(--glass-shadow);
    border-color: var(--glass-border);
  }
  35% {
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.7);
    border-color: var(--gold-primary);
  }
  100% {
    box-shadow: 0 12px 35px var(--glass-shadow);
    border-color: var(--glass-border);
  }
}

/* Prefers reduced motion accessibility rule */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
