/* Custom styles for TimeToJam React App */

/* Basic CSS reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fix broken root font-size from volume.css */
html {
  font-size: 16px !important;
  /* Override volume.css's font-size: 1px */
}

body {
  font-size: 1rem !important;
  /* Override volume.css's font-size: 14rem */
}

/* Basic reset for React app */
#root {
  width: 100%;
  min-height: 100vh;
}

/* React App styles - only apply to React app routes */
.app body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  line-height: 1.6 !important;
  color: #333 !important;
  background: #f5f5f5 !important;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Hide main page loader initially - can be controlled via JS later */
.ms_inner_loader {
  display: none !important;
}

.ms_inner_loader .ms_loader {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ensure proper layout structure with minimum viewport height */
.ms_main_wrapper {
  position: relative;
  min-height: 100vh;
}

/* Make the content area have minimum height to push footer down */
.ms_content_wrapper {
  min-height: calc(100vh - 150px);
  /* Subtract approximate footer height */
}

/* Ensure page content areas have minimum height */
.ms_weekly_wrapper,
.ms_banner,
.container-fluid {
  min-height: 70vh;
}

/* Additional adjustments for React compatibility */
a {
  text-decoration: none;
  color: inherit;
}

button.ms_btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

/* Connection status styles from existing app */
.connection-status.connected {
  color: #2ecc71;
}

.connection-status.disconnected {
  color: #e74c3c;
}

/** Modals **/

/* Modal backdrop */
.modal-backdrop.show {
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  opacity: 1;
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #1a202c;
  border-radius: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.4);
}

.modal-footer {
  border-top: none;
}

.modal-header .btn-close {
  color: #FFF;
  filter: invert(1) brightness(100%);
  opacity: 0.8;
}

.modal-header .btn-close:hover {
  opacity: 1;
}

.modal-title.h4 {
  color: #FFF;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body *::-webkit-scrollbar {
  width: 8px;
}

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

.modal-body *::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.modal-body *::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal.centered-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fix form submit button styling */
.ms_register_form button.ms_btn,
.ms_register_form a.ms_btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  margin-bottom: 0.5rem;
  width: 100%;
}

/* Template button styling from original CSS */
.ms_register_form a.ms_btn,
.ms_lang_btn a.ms_btn {
  background-color: transparent !important;
  height: 40px;
  border: 1px solid #fff !important;
  margin-left: 0px;
  padding: 0px 31px;
  line-height: 40px;
  width: auto;
  margin-top: 10px;
  border-radius: 20px !important;
  color: #fff !important;
  font-weight: normal;
  text-transform: capitalize;
  transition: all 0.4s ease-in-out;
}

.ms_register_form a.ms_btn:hover {
  background-color: #ffffff !important;
  color: #22bed7 !important;
  text-decoration: none;
}

/* Disabled button state */
.ms_btn.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Button spacing in modals */
.ms_register_form a.ms_btn+a.ms_btn {
  margin-top: 10px;
}

/* Force buttons to stack vertically in modals */
.ms_register_form a.ms_btn {
  display: block !important;
  width: 100% !important;
}

/* Red danger button for End/Leave Jam */
.ms_register_form a.ms_btn.btn-danger {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: #fff !important;
}

.ms_register_form a.ms_btn.btn-danger:hover {
  background-color: #c82333 !important;
  border-color: #bd2130 !important;
  color: #fff !important;
}

/* Search page specific styles */
.ms_search_controls {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
}

.ms_search_controls .ms_top_search {
  position: relative;
  max-width: none;
}

.ms_search_controls .ms_top_search {
  max-width: 400px;
  position: relative;
  border-radius: 25px;
  overflow: hidden;
}

.ms_search_controls .ms_top_search input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 14px;
  border: 2px solid #444;
  box-sizing: border-box;
  background-image: url("/assets/images/svg/search.svg");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 20px 20px;
  padding-right: 50px;
  background-color: #2a2a2a !important;
  color: #ffffff !important;
}

.ms_search_controls .ms_top_search input:focus {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  border-color: #22bed7 !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(34, 190, 215, 0.2) !important;
}

.ms_search_controls .ms_top_search .search_icon {
  display: none;
}

.ms_genre_select select {
  width: 100%;
  border: 2px solid #22bed7;
  background-color: #2a2a2a !important;
  border-radius: 25px;
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2322bed7'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
  cursor: pointer;
}

.ms_genre_select select:focus {
  outline: none !important;
  border-color: #56c8d8 !important;
  box-shadow: 0 0 0 2px rgba(34, 190, 215, 0.2) !important;
  background-color: #2a2a2a !important;
  color: #ffffff !important;
}

.ms_genre_select select option {
  background-color: #2a2a2a;
  color: #ffffff;
  padding: 10px;
  font-weight: 500;
}

.search_btn {
  width: 100%;
  height: 42px;
  padding: 0 20px;
  border: 2px solid #22bed7;
  background: linear-gradient(45deg, #22bed7, #56c8d8) !important;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  color: #ffffff !important;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(34, 190, 215, 0.3);
  box-sizing: border-box;
}

.search_btn:hover {
  background: linear-gradient(45deg, #1ca9c9, #22bed7);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 190, 215, 0.3);
}

.search_btn:active {
  transform: translateY(0);
}

.search_btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.no-results {
  color: #ccc;
  font-size: 16px;
  margin: 40px 0;
}

/* Fix loader display for search */
.ms_loader {
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.ms_loader .ms_bars {
  display: flex;
  gap: 3px;
}

.ms_loader .ms_bars .bar {
  width: 3px;
  height: 20px;
  background: linear-gradient(45deg, #22bed7, #56c8d8);
  animation: loader-bars 1.2s infinite;
  border-radius: 2px;
}

.ms_loader .ms_bars .bar:nth-child(2) {
  animation-delay: 0.1s;
}

.ms_loader .ms_bars .bar:nth-child(3) {
  animation-delay: 0.2s;
}

.ms_loader .ms_bars .bar:nth-child(4) {
  animation-delay: 0.3s;
}

.ms_loader .ms_bars .bar:nth-child(5) {
  animation-delay: 0.4s;
}

.ms_loader .ms_bars .bar:nth-child(6) {
  animation-delay: 0.5s;
}

.ms_loader .ms_bars .bar:nth-child(7) {
  animation-delay: 0.6s;
}

.ms_loader .ms_bars .bar:nth-child(8) {
  animation-delay: 0.7s;
}

.ms_loader .ms_bars .bar:nth-child(9) {
  animation-delay: 0.8s;
}

.ms_loader .ms_bars .bar:nth-child(10) {
  animation-delay: 0.9s;
}

@keyframes loader-bars {

  0%,
  40%,
  100% {
    transform: scaleY(0.4);
    opacity: 0.8;
  }

  20% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Critical React Component Styles */

/* Song Editor/Viewer Components */
.song-editor-container {
  margin: 0 auto;
}

.sections-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bars-container {
  overflow-x: hidden;
}

.bar-display-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: stretch;
  position: relative;
}

.bar-display-row:last-child {
  margin-bottom: 0;
}

.bar-display {
  flex: 0 0 calc(25% - 7.5px);
  position: relative;
  min-width: 0;
}

.bar-display.spanning {
  flex: 0 0 calc(50% - 5px);
  position: relative;
}

.bar-display-numbers {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  justify-content: flex-start;
}

.bar-display-chords {
  display: flex;
  gap: 10px;
}

.bar-display-lyrics {
  width: 100%;
}

.bar-number {
  font-weight: 600;
  color: #666;
  font-size: 0.9rem;
  padding: 0.25rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.editable-cell {
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem;
  min-height: 40px;
  display: flex;
  align-items: flex-start;
  cursor: text;
  transition: all 0.2s;
}

.editable-cell.chord-cell {
  padding-top: 0px;
  padding-bottom: 0px;
  background: #fff3cd;
  border-color: #ffeaa7;
  font-weight: 600;
  color: #856404;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
}

.editable-cell.lyrics-cell {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
  z-index: 1;
  min-height: auto;
  align-items: flex-start;
  padding-bottom: 10px;
}

/* Dark theme overrides for song viewer */
.song-editor-container .editable-cell.lyrics-cell {
  background: #0e1120 !important;
  border-color: #374a4f !important;
  color: #ecf0f1 !important;
  padding-bottom: 10px;
}

.song-editor-container .editable-cell.chord-cell {
  background: transparent !important;
  border: none;
  color: #f39c12 !important;
}

.song-editor-container .bar-number {
  color: #666 !important;
  font-weight: 600;
}

/* Bar Separators */
.bar-separator {
  position: absolute;
  width: 1px;
  height: calc(100% - 40px);
  background: linear-gradient(to bottom,
      rgba(128, 128, 128, 0.0) 0%,
      rgba(128, 128, 128, 0.6) 30%,
      rgba(128, 128, 128, 0.6) 100%);
  z-index: 1;
  top: 0;
  pointer-events: none;
}

.bars-per-row-4 .bar-separator-1 {
  left: calc(25% - 2.5px);
}

.bars-per-row-4 .bar-separator-2 {
  left: calc(50%);
}

.bars-per-row-4 .bar-separator-3 {
  left: calc(75% + 2.5px);
}

/* 2-bar layout adjustments */
.bars-per-row-2 .bar-display {
  flex: 0 0 calc(50% - 5px);
}

.bars-per-row-2 .bar-display.spanning {
  flex: 0 0 calc(100%);
}

.bars-per-row-2 .bar-separator-1 {
  display: none;
}

.bars-per-row-2 .bar-separator-2 {
  left: calc(50%);
}

.bars-per-row-2 .bar-separator-3 {
  display: none;
}

/* Song viewer compact styles */
.song-viewer .editable-cell.chord-cell {
  font-size: 14px !important;
  padding: 6px 8px !important;
  min-height: 28px !important;
}

.song-viewer .editable-cell.lyrics-cell {
  font-size: 13px !important;
  padding: 6px 8px !important;
  min-height: 28px !important;
  background: transparent !important;
  border: none !important;
}

.song-viewer .editable-cell.chord-cell:hover,
.song-viewer .editable-cell.lyrics-cell:hover {
  background: transparent !important;
  border-color: transparent !important;
  cursor: default;
}

.song-viewer .bar-number {
  font-size: 12px !important;
  font-weight: 500 !important;
}

.song-viewer .bar-display-row {
  padding-bottom: 25px !important;
}

/* Additional layout helpers */
.d-flex {
  display: flex !important;
}

.align-items-center {
  align-items: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.gap-3 {
  gap: 1rem !important;
}

/* ===== REACT COMPONENT STYLES FROM APP.CSS ===== */

/* Join Screen */
.join-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.join-container {
  background: white;
  padding: 3rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.join-container h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.join-container p {
  margin-bottom: 2rem;
  color: #666;
}

.input-group {
  margin-bottom: 1.5rem;
}

.code-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.5rem;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.code-input:focus {
  outline: none;
  border-color: #3498db;
}

.checkbox-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

button {
  padding: 1rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  color: #e74c3c;
  margin: 1rem 0;
  padding: 0.5rem;
  background: #ffeaea;
  border-radius: 4px;
}

/* Stage Screen */
.stage-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.stage-header {
  background: #2c3e50;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: bold;
}

/* Live Session Indicator Animation */
.live-session-indicator {
  position: relative;
  overflow: hidden;
  background: linear-gradient(45deg, rgba(46, 204, 113, 0.2), rgba(52, 152, 219, 0.2)) !important;
  border-radius: 6px !important;
  padding: 6px 12px !important;
  margin: -6px -12px !important;
  display: inline-block !important;
  animation: pulse 3s infinite ease-in-out !important;
}

.live-session-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.6),
      transparent);
  animation: shimmer 3s infinite ease-in-out;
  z-index: 1;
}

.live-session-indicator * {
  position: relative;
  z-index: 2;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  50% {
    left: 100%;
  }

  100% {
    left: 100%;
  }
}

@keyframes pulse {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.02);
  }

  100% {
    opacity: 0.7;
    transform: scale(1);
  }
}

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

.controls button,
.controls select {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background: #3498db;
  color: white;
  cursor: pointer;
}

.controls button:hover,
.controls select:hover {
  background: #2980b9;
}

.stage-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.chart-display {
  margin: 0 auto;
}

.song-header {
  text-align: center;
  margin-bottom: 2rem;
}

.song-header h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.key-display {
  font-size: 1.5rem;
  color: #666;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.section.active {
  border-left: 4px solid #3498db;
  background: #f8f9fa;
}

.section:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.section-type {
  font-size: 1.2rem;
  color: #3498db;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.bars-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.bar {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.2s;
}

.bar:hover {
  background: #e9ecef;
  border-color: #dee2e6;
}

.bar.active-bar {
  border-color: #3498db;
  background: #e3f2fd;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.bar-chords {
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: bold;
  color: #2c3e50;
  font-size: 1.1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.chord {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.duration {
  font-size: 0.8rem;
  color: #666;
  font-weight: normal;
}

.bar-lyrics {
  font-family: 'Monaco', 'Consolas', monospace;
  color: #555;
  font-size: 1rem;
  line-height: 1.4;
}

.navigation-controls {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
}

.navigation-controls button {
  padding: 1rem 2rem;
  font-size: 1.2rem;
  background: #2ecc71;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.navigation-controls button:hover {
  background: #27ae60;
}

.no-song {
  text-align: center;
  padding: 4rem 2rem;
  color: #666;
}

.no-song h2 {
  margin-bottom: 2rem;
}

/* Modal Fixes - Ensure home page modals display correctly */
.ms_register_popup {
  z-index: 9999 !important;
}

.ms_register_popup .modal-content {
  background: linear-gradient(180deg, rgb(22, 26, 46) 0%, rgb(237, 63, 179) 0%, rgb(59, 200, 231) 0%, rgb(32, 167, 196) 100%) !important;
  border: none !important;
  padding: 50px 50px 46px !important;
  border-radius: 15px !important;
}

.ms_register_popup .modal-dialog {
  max-width: 930px !important;
}

/* Apply top:100px only above mobile breakpoint */
@media (min-width: 768px) {
  .ms_register_popup .modal-dialog {
    top:100px;
  }
}

/* Fix modal width - prevent modals from being too narrow */
.modal-dialog.register_dialog,
.modal-dialog.login_dialog {
  width: 90% !important;
  max-width: calc(100% - 20px) !important;
  margin: 0 auto !important;
}

/* ===== SECTION DROPDOWN STYLES ===== */
.section-dropdown-wrapper {
  position: relative;
  width: fit-content;
}

.section-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-dropdown-trigger.clickable {
  cursor: pointer;
}

.section-dropdown-icon {
  color: #3bc8e7;
  font-size: 12px;
  transition: transform 0.2s ease;
  margin-top: -10px;
}

.section-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #2a3042;
  border: 1px solid #3bc8e7;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-width: 160px;
}

.section-dropdown-item {
  padding: 8px 12px;
  color: #ffffff;
  background-color: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid #363c3e;
  transition: background-color 0.2s ease;
}

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

.section-dropdown-item:hover {
  background-color: rgba(59, 200, 231, 0.05);
}

.section-dropdown-item.selected {
  color: #3bc8e7;
  background-color: rgba(59, 200, 231, 0.1);
}

.section-dropdown-item.selected:hover {
  background-color: rgba(59, 200, 231, 0.1);
}

.section-dropdown-item.danger {
  color: #f00;
  border-top: 1px solid #308ca1d5;
}

.section-dropdown-item.danger:hover {
  background-color: rgba(220, 53, 69, 0.1);
}

.section-dropdown-separator {
  height: 1px;
  background-color: #363c3e;
  margin: 0;
}

/* Search page dropdown positioning */
.search-dropdown-right {
  right: 0;
  left: auto;
}

/* Responsive modal layout */
@media (max-width: 768px) {

  /* Stack modal content vertically on mobile and center everything */
  .ms_register_popup .modal-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }

  /* Ensure QR code section is visible and centered on mobile */
  .ms_register_popup .ms_register_img {
    margin: 0 auto 20px auto !important;
    display: flex !important;
    justify-content: center !important;
    order: 1 !important;
    /* Show QR code first */
    width: 50% !important;
    flex-shrink: 0 !important;
  }

  /* Center the form section on mobile and ensure it comes after QR code */
  .ms_register_popup .ms_register_form {
    width: 100% !important;
    text-align: center !important;
    order: 2 !important;
    /* Show form content second */
  }
}

.ms_register_popup .modal-body {
  padding: 0 !important;
}

/* Fix button styling in modals */
.ms_register_popup .ms_btn {
  background-color: #3bc8e7 !important;
  color: #ffffff !important;
  border: 2px solid #3bc8e7 !important;
  padding: 12px 30px !important;
  border-radius: 25px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: all 0.3s ease-in-out !important;
  text-align: center !important;
  line-height: normal !important;
  vertical-align: middle !important;
  min-width: auto !important;
  width: auto !important;
}

.ms_register_popup .ms_btn:hover {
  background-color: #ffffff !important;
  color: #3bc8e7 !important;
  border-color: #ffffff !important;
}

.ms_register_popup .btn-danger {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: #ffffff !important;
}

.ms_register_popup .btn-danger:hover {
  background-color: #c82333 !important;
  border-color: #c82333 !important;
  color: #ffffff !important;
}

/* Fix close button styling */
.ms_register_popup .close {
  position: absolute !important;
  right: -12px !important;
  top: -12px !important;
  width: 30px !important;
  height: 30px !important;
  background-color: #ffffff !important;
  border: 2px solid #3bc8e7 !important;
  border-radius: 50% !important;
  color: #3bc8e7 !important;
  font-size: 18px !important;
  font-weight: normal !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1 !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  opacity: 1 !important;
}

.ms_register_popup .close:hover {
  background-color: #ffffff !important;
  color: #3bc8e7 !important;
  opacity: 1 !important;
}

.ms_register_popup .close:focus {
  outline: none !important;
}

/* Fix the background sprite position for the close icon */
.ms_register_popup .close .fa_icon.form_close {
  background-position: -833px -3px !important;
  font-size: 18px !important;
  line-height: 1 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

.ms_register_popup .close .fa_icon.form_close:before {
  content: none !important;
}

/* Song List Modal */
.song-list-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.song-list-modal .modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h3 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.song-item {
  padding: 1rem;
  text-align: left;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.song-item:hover {
  background: #e9ecef;
}

/* Song Editor */
.song-editor {
  min-height: 100vh;
  background: #f5f5f5;
  width: 100%;
}

.song-editor-header {
  background: white;
  padding: 1rem 2rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bars-per-row-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bars-per-row-toggle label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.bars-per-row-select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-size: 0.9rem;
}

.song-editor-header h1 {
  color: #2c3e50;
  font-size: 1.5rem;
}

.back-button {
  background: none;
  border: 1px solid #ddd;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  font-size: 0.9rem;
}

.back-button:hover {
  background: #f8f9fa;
}

.save-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.save-button:hover {
  background: #218838;
}

.save-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* Full-page song editor specific styles */
.song-editor .song-editor-container {
  margin: 2rem auto;
  width: 100%;
}

.song-editor-content {
  padding: 0;
}

.sections-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bar-display-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: stretch;
  position: relative;
}

.bar-display-row:last-child {
  margin-bottom: 0;
}

.bar-display {
  flex: 0 0 calc(25% - 7.5px);
  position: relative;
  min-width: 0;
}

.bar-display.spanning {
  flex: 0 0 calc(50% - 5px);
  position: relative;
}

/* 2-bar layout adjustments */
.bars-per-row-2 .bar-display {
  flex: 0 0 calc(50% - 5px);
}

.bars-per-row-2 .bar-display.spanning {
  flex: 0 0 calc(100%);
}

/* Add Bar Display */
.add-bar-display {
  flex: 0 0 calc(25% - 7.5px);
  min-width: 0;
}

.add-bar-display .bar-display-chords {
  position: relative;
}

.add-bar-display-content {
  background: #f8f9fa;
  border: 2px dashed #ccc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 20px;
  margin-top: 18px;
}

.bars-per-row-2 .add-bar-display {
  flex: 0 0 calc(50% - 5px);
}

.add-bar-button-center {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.add-bar-button-center:hover {
  background: #5a6268;
}

.bar-display-numbers {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  justify-content: flex-start;
}

.bar-display.spanning .bar-display-numbers {
  justify-content: flex-start;
  gap: 10px;
}

.bar-display.spanning .bar-display-numbers .bar-number {
  flex: 0 0 auto;
  text-align: left;
  width: calc(50% - 5px);
}

.bar-display-chords {
  display: flex;
  gap: 10px;
}

.bar-display-chords>* {
  margin-right: 0 !important;
}

.bar-display-chords>*:last-child {
  margin-right: 0 !important;
}

.bar-display-lyrics {
  width: 100%;
}

.bar-number {
  font-weight: 600;
  color: #666;
  font-size: 0.9rem;
  padding: 0.25rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.bar-delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  font-size: 10px;
  font-family: monospace;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.bar-number:hover .bar-delete-btn {
  opacity: 1;
}

.bar-delete-btn:hover {
  background: #c82333;
}

.bar-chords {
  display: flex;
  flex-wrap: nowrap;
  flex: 1;
  gap: 10px;
}

/* Each chord cell takes equal space */
.bar-chords>* {
  flex: 1;
}

/* Ensure consistent width for spanning bar chord containers */
.bar-display.spanning .bar-chords {
  width: calc(50% - 5px);
  flex: 0 0 auto;
}

.lyrics-container {
  width: 100%;
}

/* Bar Separators - HTML elements for reliable positioning */
.bar-separator {
  position: absolute;
  width: 1px;
  height: calc(100% - 40px);
  background: linear-gradient(to bottom,
      rgba(128, 128, 128, 0.0) 0%,
      rgba(128, 128, 128, 0.6) 30%,
      rgba(128, 128, 128, 0.6) 100%);
  z-index: 1;
  top: 0;
  pointer-events: none;
}

/* 4-bar layout separator positions */
.bars-per-row-4 .bar-separator-1 {
  left: calc(25% - 2.5px);
}

.bars-per-row-4 .bar-separator-2 {
  left: calc(50%);
}

.bars-per-row-4 .bar-separator-3 {
  left: calc(75% + 2.5px);
}

/* 2-bar layout separator positions */
.bars-per-row-2 .bar-separator-1 {
  display: none;
}

.bars-per-row-2 .bar-separator-2 {
  left: calc(50%);
}

.bars-per-row-2 .bar-separator-3 {
  display: none;
}

.editable-cell {
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem;
  min-height: 40px;
  display: flex;
  align-items: flex-start;
  cursor: text;
  transition: all 0.2s;
}

.editable-cell:hover {
  background: #e9ecef;
  border-color: #007bff;
}

.editable-cell.chord-cell {
  padding-top: 0px;
  padding-bottom: 0px;
  background: #fff3cd;
  border-color: #ffeaa7;
  font-weight: 600;
  color: #856404;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
}

.editable-cell.chord-cell.single-chord {
  background: #fff3cd;
  border-color: #ffeaa7;
  font-weight: 600;
  color: #856404;
  text-align: center;
}

.editable-cell.lyrics-cell {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
  z-index: 1;
  min-height: auto;
  align-items: flex-start;
}

.song-editor-container:not([data-mode="view"]) .bar-display-row:not(:last-child):after {
  width: 100%;
  height: 5px;
  content: "";
  position: absolute !important;
  bottom: 0;
  left: -15px;
  z-index: 0;
  background: -webkit-radial-gradient(50% 50%, ellipse closest-side, #3bc8e7, rgba(255, 42, 112, 0) 60%);
  background: -moz-radial-gradient(50% 50%, ellipse closest-side, #3bc8e7, rgba(255, 42, 112, 0) 60%);
  background: -ms-radial-gradient(50% 50%, ellipse closest-side, #3bc8e7, rgba(255, 42, 112, 0) 60%);
  background: -o-radial-gradient(50% 50%, ellipse closest-side, #3bc8e7, rgba(255, 42, 112, 0) 60%);
}

.lyrics-cell-with-arrow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.lyrics-cell-with-arrow .lyrics-input {
  width: 100%;
  padding-right: 30px;
  min-height: 1.2em;
  line-height: 1.4;
  font-family: inherit;
}

.lyrics-arrow {
  background: transparent;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  margin-left: 10px;
  margin-top: 2px;
  transition: all 0.2s;
  min-width: 24px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-start;
}

.lyrics-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  color: #ffffff;
  transform: scale(1.1);
}

.lyrics-arrow:disabled {
  background: transparent;
  border-color: #6c757d;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.editable-cell input,
.editable-cell textarea {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  outline: none;
  color: inherit;
}

.editable-cell.chord-cell input {
  background: transparent;
}

.editable-cell.chord-cell input::placeholder {
  color: #374a4f;
  font-style: italic;
  font-size: 14px;
}

.editable-cell .chord-placeholder,
.editable-cell .lyrics-placeholder {
  color: #374a4f;
  font-style: italic;
  font-size: 14px;
}

.add-section-button {
  background: #007bff;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 2rem;
  width: fit-content;
}

.add-section-button:hover {
  background: #0056b3;
}

.add-bar-button {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  margin: 1rem 1.5rem;
  width: fit-content;
}

.add-bar-button:hover {
  background: #5a6268;
}

.edit-song-button {
  background: #17a2b8;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

.edit-song-button:hover {
  background: #138496;
}

/* Transparent lyrics inputs in view mode */
[data-mode="view"] .lyrics-input,
[data-mode="view"] .editable-cell input,
[data-mode="view"] .editable-cell textarea,
[data-mode="view"].song-editor-container .editable-cell.lyrics-cell {
  background: transparent !important;
  border: 1px solid transparent !important;
  border-color: transparent !important;
}

/* Remove padding-bottom from bar-display-row in view mode */
[data-mode="view"] .bar-display-row {
  padding-bottom: 0 !important;
  margin-bottom: 0px !important;
}

/* Prevent disabled inputs/textareas from being grayed out in view mode */
[data-mode="view"] input:disabled,
[data-mode="view"] textarea:disabled {
  color: inherit !important;
  background-color: inherit !important;
  opacity: 1 !important;
}

.editable-cell.chord-cell {
  position: relative;
}

/* Nashville Number System styling */
.chord-nns {
  color: #1babb6;
  position: absolute;
  top: -18px;
  font-weight: bold !important;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .stage-header {
    flex-direction: column;
    gap: 1rem;
  }

  .section-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .navigation-controls {
    flex-direction: column;
    gap: 1rem;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .bar-display-row {
    /* Keep flex-direction: row to maintain 2 bars per row on mobile */
  }

  .bar-display-chords {
    gap: 0.25rem;
  }

  .bar-chords {
    gap: 0.25rem;
  }

  .song-editor-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .song-editor-content {
    padding: 1rem;
  }

  .song-metadata-editor {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
}

/* Dark Theme Song Editor Overrides */
.song-editor-container.ms_weekly_wrapper {
  background: transparent;
  padding: 0px;
  width: 100%;
}

.song-editor-container .sections-container {
  margin-bottom: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Dark theme overrides for song editor form controls - match search page exactly */
.song-editor-container .ms_top_search input.form-control,
.song-editor-container .ms_top_search select.form-control {
  width: 100%;
  padding: 12px 20px;
  border-radius: 25px !important;
  font-size: 14px !important;
  border: 2px solid #444 !important;
  box-sizing: border-box;
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  line-height: normal !important;
  height: auto !important;
}

.song-editor-container .ms_top_search input.form-control:focus,
.song-editor-container .ms_top_search select.form-control:focus {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  border-color: #22bed7 !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(34, 190, 215, 0.2) !important;
}

.song-editor-container .ms_top_search select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2322bed7'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
  cursor: pointer;
}

.song-editor-container .ms_top_search .form-control option {
  background-color: #2a2a2a !important;
  color: #ffffff !important;
  padding: 10px;
  font-weight: 500;
}

.song-editor-container .ms_top_search .form-control::placeholder {
  color: #777777 !important;
}

/* Reusable styled button class for song editor */
.song-editor-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 10px 20px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border: none !important;
  border-radius: 20px !important;
  white-space: nowrap !important;
  min-width: fit-content !important;
  width: auto !important;
  line-height: 1 !important;
  height: auto !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.song-editor-btn:hover:not(:disabled) {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.song-editor-btn:active:not(:disabled) {
  transform: translateY(0) !important;
}

.song-editor-btn:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.song-editor-btn i {
  font-size: 12px !important;
  line-height: 1 !important;
}

.song-editor-btn span {
  line-height: 1 !important;
}

/* Button color variants */
.song-editor-btn.btn-success {
  background: #28a745 !important;
  color: #ffffff !important;
}

.song-editor-btn.btn-success:hover:not(:disabled) {
  background: #218838 !important;
}

.song-editor-btn.btn-danger {
  background: #dc3545 !important;
  color: #ffffff !important;
}

.song-editor-btn.btn-danger:hover:not(:disabled) {
  background: #c82333 !important;
}

.song-editor-btn.btn-primary {
  background: #3bc8e7 !important;
  color: #ffffff !important;
}

.song-editor-btn.btn-primary:hover:not(:disabled) {
  background: #2ea3c4 !important;
}

.song-editor-btn.btn-secondary {
  background: #6c757d !important;
  color: #ffffff !important;
}

.song-editor-btn.btn-secondary:hover:not(:disabled) {
  background: #5a6268 !important;
}

/* Add bar display styling - only in song editor */
.song-editor-container .add-bar-display-content {
  background: #252b4d !important;
  border: 2px dashed #3bc8e7 !important;
  border-radius: 6px;
}

/* Loading states for dark theme */
.song-editor-container .spinner-border {
  color: #3bc8e7 !important;
}

.song-editor-container .alert-danger {
  background: #e74c3c;
  color: white;
  border: 1px solid #c0392b;
}

.song-editor-container .alert-warning {
  background: #f39c12;
  color: white;
  border: 1px solid #e67e22;
}

/* ===== LOGIN MODAL FIXES ===== */
/* Fix overlap between checkbox and login button */
.ms_register_form .remember_checkbox {
  margin-bottom: 20px !important;
}

.ms_register_form .ms_btn {
  margin-top: 10px !important;
  clear: both !important;
}

/* ===== VIEWER HEADER CONTROLS FIXES ===== */
/* Ensure header control values are visible */
.viewer-controls input.form-control,
.viewer-controls select.form-control {
  color: #ffffff !important;
  background-color: #2a3042 !important;
  border: 1px solid #363c3e !important;
  font-size: 14px !important;
  padding: 4px 8px !important;
}

.viewer-controls input.form-control:focus,
.viewer-controls select.form-control:focus {
  color: #ffffff !important;
  background-color: #2a3042 !important;
  border: 1px solid #3bc8e7 !important;
  box-shadow: 0 0 0 0.2rem rgba(59, 200, 231, 0.25) !important;
  outline: none !important;
}

.viewer-controls select.form-control option {
  background-color: #2a3042 !important;
  color: #ffffff !important;
}

/* Override any existing ms_top_search styles that might interfere */
.ms_header .viewer-controls input.form-control,
.ms_header .viewer-controls select.form-control {
  color: #ffffff !important;
  background-color: #2a3042 !important;
  border: 1px solid #363c3e !important;
  font-weight: normal !important;
}

/* Ensure the select dropdown has proper width and alignment */
.viewer-controls select.form-control {
  min-width: 60px !important;
  text-align: center !important;
  text-align-last: center !important;
  padding: 6px 8px !important;
  line-height: 1.7 !important;
}

/* View mode cell styling tweaks */
.song-editor-container[data-mode="view"] .editable-cell.lyrics-cell {
  padding-top: 0px;
  padding-bottom: 10px;
}

.song-editor-container[data-mode="view"] .editable-cell.chord-cell {
  min-height: 0px;
  padding-top: 0px !important;
  padding-bottom: 0px !important;
  font-size: 0.85em !important;
}

.song-editor-container[data-mode="view"] .bar-display-row {
  background-color: #0000009c;
  padding: 2px;
  border-radius: 8px;
}

.song-editor-container[data-mode="view"] .bar-display.spanning .bar-display-chords .bar-chords {
  padding-left: 6px;
}

.song-editor-container[data-mode="view"] .bar-display.spanning> :nth-child(2) .bar-chords:first-child {
  padding-left: 0 !important;
}
