/* ==========================================================================
   SUNDAY SCHOOL TARANIM - REVERSED LAYOUT LIGHT THEME & OBS STYLESHEET
   100% PURE STANDARD VANILLA CSS (NO NESTING FOR MAX COMPATIBILITY)
   ========================================================================== */

:root {
  --font-family: 'Alexandria', sans-serif;
  
  --bg-light: #f4f6fc;
  --bg-card: #ffffff;
  --border-card: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  
  --shadow-card: 0 6px 20px rgba(37, 99, 235, 0.06);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.2);
  --shadow-popover: 0 12px 35px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100vh;
  overflow: hidden; /* FITTED SCREEN VIEW - NO SCROLLBAR */
  background-color: var(--bg-light);
  color: var(--text-main);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOP NAV STRIP */
.top-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-card);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.brand-text-centered {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.brand-text-centered .brand-main {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-left-logo {
  display: flex;
  align-items: center;
}

.brand-left-logo .brand-logo-img {
  height: 38px;
  width: 38px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.top-options {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ICON MENU BUTTONS & COMPACT POP-OVERS */
.dropdown-wrapper {
  position: relative;
}

.icon-menu-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-menu-btn:hover {
  background: #e2e8f0;
  color: var(--accent-blue);
}

/* SLEEK ULTRA-COMPACT DROPDOWN POPOVER */
.dropdown-popover {
  position: absolute;
  top: 110%;
  right: 0;
  left: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  padding: 0.55rem 0.75rem;
  min-width: 260px;
  max-width: min(320px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown-popover::-webkit-scrollbar {
  width: 4px;
}

.dropdown-popover::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.popover-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  min-height: 26px;
}

.popover-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-size: 0.76rem;
}

.compact-control-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.popover-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.control-select, .control-input {
  background: #f8fafc;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.76rem;
  outline: none;
  font-weight: 500;
  max-width: 180px;
  width: 100%;
  box-sizing: border-box;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.control-select:focus, .control-input:focus {
  border-color: var(--accent-blue);
}

/* SLIDER STYLING MATCHING WEBSITE THEME COLORS */
.slider-input {
  width: 70px;
  height: 4px;
  accent-color: var(--accent-blue) !important;
  cursor: pointer;
}

.color-picker-input {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

.btn {
  border: none;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-secondary { background: #f1f5f9; border: 1px solid var(--border-card); color: var(--text-main); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.8rem; }

/* COPY LINK ANIMATION RIPPLE KEYFRAMES */
@keyframes copyRipple {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); box-shadow: 0 0 16px rgba(16, 185, 129, 0.45); }
  100% { transform: scale(1); }
}

.btn-copied-anim {
  animation: copyRipple 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}

/* HERO COMPACT CENTERED SEARCH (FITTED NO SCROLL) */
.search-hero {
  padding: 0.65rem 1.5rem 0.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  flex-shrink: 0;
}

.search-toolbar {
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 12px;
  border-radius: 20px;
}

.toggle-switch input {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.centered-search-box {
  position: relative;
  width: 100%;
  max-width: 720px;
}

.centered-search-box .search-icon-glow {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-blue);
  font-size: 1.05rem;
  z-index: 10;
}

.centered-search-box input {
  width: 100%;
  background: #ffffff;
  border: 2px solid rgba(37, 99, 235, 0.25);
  color: #0f172a;
  padding: 0.75rem 3.2rem 0.75rem 2.8rem;
  border-radius: 40px;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.06);
}

.centered-search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.18);
}

.centered-search-box .clear-btn {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  z-index: 10;
}

/* SEARCH DROPDOWN FLUSH ATTACHED DIRECTLY UNDER SEARCH INPUT */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  box-shadow: var(--shadow-popover);
  max-height: 420px;
  overflow-y: auto;
  z-index: 500;
}

.search-dropdown::-webkit-scrollbar {
  width: 6px;
}
.search-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.franco-translation-header {
  padding: 0.6rem 1.15rem;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  color: var(--accent-blue);
  font-size: 0.84rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: right;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.franco-translation-header strong {
  color: #1d4ed8;
  background: #dbeafe;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-item {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: right;
  transition: background 0.12s;
}

.search-item:hover { background: #f0f6ff; }
.search-item .item-top { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.search-item .item-title { font-weight: 800; color: #0f172a; font-size: 0.95rem; flex: 1; min-width: 0; }
.search-item .item-badges-group { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

.search-item .item-badge {
  font-size: 0.7rem;
  color: var(--accent-blue);
  background: #eff6ff;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}

.search-item .item-badge.bible-badge {
  color: #7c3aed;
  background: #f5f3ff;
}

.search-item .item-badge.lyrics-match-badge {
  color: #0e7490;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
}

/* Highlight matched text in search results */
.search-highlight {
  background: #fef08a;
  color: #78350f;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 800;
}

.search-item .item-preview-box {
  padding: 0.5rem 0.8rem;
  background: #f8fafc;
  border-radius: 10px;
  border-right: 3px solid var(--accent-blue);
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.65;
  word-break: break-word;
}

.search-item .line-num-mini {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: #e0f2fe;
  padding: 1px 5px;
  border-radius: 4px;
  margin: 0 4px;
  display: inline-block;
}

.search-item .line-num-mini.matched-line-badge {
  color: #7c3aed;
  background: #ede9fe;
}

.search-item .preview-sep {
  color: #cbd5e1;
  margin: 0 6px;
  font-size: 0.75rem;
}

.search-item.no-results-item {
  cursor: default !important;
  background: #ffffff !important;
  color: var(--text-muted) !important;
  display: flex;
  align-items: center;
}
.search-item.no-results-item:hover { background: #ffffff !important; }


/* DUAL-COLUMN DASHBOARD (FITTED 100% SCREEN HEIGHT) */
.dashboard-halves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 0.5rem 1.5rem;
  flex: 1;
  overflow: hidden;
}

.half-panel {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel-bar {
  padding: 0.65rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-bar .panel-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mini-btn-flat {
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
}

.mini-btn-flat:hover { background: #e2e8f0; }

.counter-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.badge-count {
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
}

.lines-list-box, .recent-list-box {
  flex: 1;
  overflow-y: auto;
}

.line-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease;
}

.line-item .line-num {
  width: 32px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.line-item .line-content {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.line-item:hover { background: #f8fafc; }

.line-item.active {
  background: #fef3c7 !important;
  border-right: 4px solid var(--accent-gold);
}

.line-item.active .line-num { color: #92400e; font-weight: 800; }
.line-item.active .line-content { color: #78350f; font-weight: 800; }

.copy-line-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.15s ease;
}

.copy-line-btn:hover {
  background: #e2e8f0;
  color: var(--accent-blue);
}

.copy-line-btn.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}

.recent-item {
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.2s ease, background 0.15s ease;
  position: relative;
  background: #ffffff;
}

.recent-item.dragging {
  opacity: 0.9;
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.25);
  border: 2px solid var(--accent-blue) !important;
  border-radius: 10px;
  z-index: 50;
}

.recent-item .recent-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recent-item .recent-title-group .drag-handle-icon {
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: grab;
  padding: 2px 4px;
}

.recent-item .recent-title-group .recent-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.recent-item .delete-recent-btn {
  background: #fee2e2 !important;
  border: 1px solid #fca5a5 !important;
  color: #dc2626 !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
}

.recent-item .delete-recent-btn:hover {
  color: #ffffff !important;
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  transform: scale(1.06) !important;
}

.recent-item:hover {
  background: #f8fafc;
}
.recent-item:hover .recent-title { color: var(--accent-blue); }
.recent-item:hover .drag-handle-icon { color: var(--accent-blue); }

.recent-item.active {
  background: #eff6ff;
  border-right: 4px solid var(--accent-blue);
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i { font-size: 2.2rem; margin-bottom: 0.75rem; color: #cbd5e1; }
.empty-state p { font-size: 0.9rem; line-height: 1.5; }

.app-toast {
  position: fixed;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 0.65rem 1.3rem;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

/* BOTTOM FOOTER STATUS STRIP */
.app-bottom-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 1rem;
  background: #ffffff;
  border-top: 1px solid var(--border-card);
  flex-shrink: 0;
  z-index: 100;
}

/* CREDITS INFO ICON AT BOTTOM LEFT */
.credits-info-btn {
  position: absolute;
  right: 1.15rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.credits-info-btn:hover {
  color: var(--accent-blue);
  transform: scale(1.2);
}

/* CREDITS MODAL POPUP */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 20px;
  box-shadow: var(--shadow-popover);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header .modal-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header .modal-title i { color: var(--accent-blue); }

.modal-close-btn {
  background: #f1f5f9;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-body .credits-text {
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.6;
  font-weight: 500;
}

.modal-body .credits-link {
  color: var(--accent-blue);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.modal-body .credits-link:hover {
  text-decoration: underline;
}

.modal-body .credits-author {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  color: #1e40af;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body .credits-author strong {
  color: #1e3a8a;
  font-weight: 800;
}

.songs-count-subtext {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 3px 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* OBS EMBEDDED OVERLAY */
.obs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: visible !important;
  user-select: none;
}

.obs-overlay[data-chroma="green"] { background-color: #00FF00 !important; }
.obs-overlay[data-chroma="blue"] { background-color: #0000FF !important; }
.obs-overlay[data-chroma="black"] { background-color: #000000 !important; }
.obs-overlay[data-chroma="transparent"] { background-color: transparent !important; }

.snap-guide { position: absolute; z-index: 50; pointer-events: none; border-color: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.snap-guide.vertical { top: 0; bottom: 0; left: 50%; border-left: 2px dashed #f59e0b; }
.snap-guide.horizontal { left: 0; right: 0; top: 50%; border-top: 2px dashed #f59e0b; }

.obs-lower-third-box {
  position: absolute;
  left: 50%;
  top: 75%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
}

.obs-line-text {
  display: inline-block !important;
  font-size: 54px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.5;
  white-space: pre-line;
  text-align: center;
  cursor: grab;
  max-width: 90vw;
  word-break: break-word;
  padding: 25px 45px;
  overflow: visible !important;
  box-sizing: border-box;
  will-change: transform, opacity;
}

.obs-line-text:active { cursor: grabbing; }

/* TEXT APPEARANCE ANIMATIONS FOR CONTAINER & PREVIEW (WITH MOBILE SAFARI WEBKIT COMPATIBILITY) */
@-webkit-keyframes textAppearSlide {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, calc(-50% + 50px)) scale(0.92);
    transform: translate(-50%, calc(-50% + 50px)) scale(0.92);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes textAppearSlide {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, calc(-50% + 50px)) scale(0.92);
    transform: translate(-50%, calc(-50% + 50px)) scale(0.92);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@-webkit-keyframes textAppearDrop {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, calc(-50% - 50px)) scale(0.92);
    transform: translate(-50%, calc(-50% - 50px)) scale(0.92);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes textAppearDrop {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, calc(-50% - 50px)) scale(0.92);
    transform: translate(-50%, calc(-50% - 50px)) scale(0.92);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@-webkit-keyframes textAppearPop {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, -50%) scale(0.2);
    transform: translate(-50%, -50%) scale(0.2);
  }
  70% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1.08);
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes textAppearPop {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, -50%) scale(0.2);
    transform: translate(-50%, -50%) scale(0.2);
  }
  70% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1.08);
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@-webkit-keyframes textAppearFlip {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, -50%) perspective(600px) rotateX(-85deg);
    transform: translate(-50%, -50%) perspective(600px) rotateX(-85deg);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) perspective(600px) rotateX(0deg);
    transform: translate(-50%, -50%) perspective(600px) rotateX(0deg);
  }
}

@keyframes textAppearFlip {
  0% {
    opacity: 0;
    -webkit-transform: translate(-50%, -50%) perspective(600px) rotateX(-85deg);
    transform: translate(-50%, -50%) perspective(600px) rotateX(-85deg);
  }
  100% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) perspective(600px) rotateX(0deg);
    transform: translate(-50%, -50%) perspective(600px) rotateX(0deg);
  }
}

@-webkit-keyframes textAppearGlow {
  0% {
    opacity: 0;
    -webkit-filter: blur(30px);
    filter: blur(30px);
    -webkit-transform: translate(-50%, -50%) scale(1.25);
    transform: translate(-50%, -50%) scale(1.25);
  }
  100% {
    opacity: 1;
    -webkit-filter: blur(0px);
    filter: blur(0px);
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes textAppearGlow {
  0% {
    opacity: 0;
    -webkit-filter: blur(30px);
    filter: blur(30px);
    -webkit-transform: translate(-50%, -50%) scale(1.25);
    transform: translate(-50%, -50%) scale(1.25);
  }
  100% {
    opacity: 1;
    -webkit-filter: blur(0px);
    filter: blur(0px);
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
  }
}

.animate-appear-slide {
  -webkit-animation: textAppearSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  animation: textAppearSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.animate-appear-drop {
  -webkit-animation: textAppearDrop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  animation: textAppearDrop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.animate-appear-pop {
  -webkit-animation: textAppearPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
  animation: textAppearPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}

.animate-appear-flip {
  -webkit-animation: textAppearFlip 0.2s ease-out forwards !important;
  animation: textAppearFlip 0.2s ease-out forwards !important;
}

.animate-appear-glow {
  -webkit-animation: textAppearGlow 0.2s ease-out forwards !important;
  animation: textAppearGlow 0.2s ease-out forwards !important;
}

.hidden { display: none !important; }

/* MOBILE RESPONSIVE OPTIMIZATION */
@media (max-width: 768px) {
  html, body {
    height: auto;
    overflow-y: auto;
  }

  .app-container {
    height: auto;
    overflow: visible;
  }

  .brand-text-centered {
    display: none !important;
  }

  .top-nav {
    padding: 0.4rem 0.65rem;
  }

  .icon-menu-btn {
    width: 32px;
    height: 32px;
    font-size: 0.88rem;
  }

  /* DROPDOWN POPOVER ON MOBILE (FLOATING COMPACT SHEET WITH BACKDROP SHADOW) */
  .dropdown-popover {
    position: fixed !important;
    top: 52px !important;
    left: 0.65rem !important;
    right: 0.65rem !important;
    width: calc(100vw - 1.3rem) !important;
    min-width: unset !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    padding: 0.6rem 0.75rem !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35) !important;
    border-radius: 14px !important;
    max-height: 75vh !important;
    z-index: 9999 !important;
  }

  .search-hero {
    padding: 0.4rem 0.65rem;
  }

  .search-toolbar {
    margin-bottom: 0.25rem;
  }

  /* PREVENT MOBILE AUTO-ZOOM ON INPUT FOCUS BY SETTING FONT-SIZE TO 16PX MINIMUM */
  .centered-search-box input {
    font-size: 16px !important;
    padding: 0.55rem 2.4rem 0.55rem 2rem;
  }

  .control-select, .control-input {
    font-size: 16px !important;
    padding: 0.25rem 0.45rem !important;
  }

  /* ON MOBILE: PRESENTATION LINES PANEL ABOVE / RECENT SESSION PANEL BELOW */
  .dashboard-halves {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 0 0.65rem 1.25rem 0.65rem;
    gap: 0.75rem;
  }

  .presentation-lines-panel {
    order: 1;
    height: 380px;
  }

  .recent-session-panel {
    order: 2;
    height: 300px;
  }

  .line-item {
    padding: 0.55rem 0.75rem;
  }

  .line-text-arabic {
    font-size: 0.95rem;
  }
}

/* OBS WEBSOCKET & QR SCANNER STYLES */
.badge-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  right: 3px;
  border: 1.5px solid #ffffff;
}

.badge-status.disconnected {
  background-color: #ef4444;
}

.badge-status.connected {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  margin-right: auto;
}

.status-pill.offline {
  background-color: #fee2e2;
  color: #dc2626;
}

.status-pill.online {
  background-color: #d1fae5;
  color: #059669;
}

.popover-divider {
  border: none;
  border-top: 1px dashed #e2e8f0;
  margin: 0.2rem 0;
}

.btn-danger {
  background-color: #ef4444 !important;
  color: #ffffff !important;
}

.btn-danger:hover {
  background-color: #dc2626 !important;
}

/* QR SCANNER MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

.modal-close-btn:hover {
  color: #0f172a;
}

.modal-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.qr-instructions {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

#qr-reader-viewport {
  width: 100%;
  min-height: 250px;
  background-color: #0f172a;
  border-radius: 12px;
  overflow: hidden;
}

.qr-status-msg {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem;
  border-radius: 8px;
  text-align: center;
}

.qr-status-msg.success {
  background-color: #d1fae5;
  color: #059669;
}

.qr-status-msg.error {
  background-color: #fee2e2;
  color: #dc2626;
}

/* COMPACT OBS TRANSITION CONTROL STRIP */
.obs-compact-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.strip-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.strip-icon {
  color: var(--accent-blue);
  font-size: 0.85rem;
}

.strip-select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  padding: 2px 0;
}

.strip-range-item {
  flex: 1;
  min-width: 130px;
}

.strip-range {
  width: 100%;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.strip-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 42px;
  text-align: right;
}

.strip-btn {
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.strip-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.strip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
