:root {
  text-align: -webkit-center;
  background-color: #42434b;
  --logo-height-desktop: 30vh;
  --logo-height-mobile: 10vh;
}

[data-tooltip] {
  position: relative;
  cursor: pointer;
}

/* Tooltip content */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  font-family: "Tajawal", sans-serif;
}

/* Show on hover/focus */
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-2] {
  position: relative;
  cursor: pointer;
}

/* Tooltip content */
[data-tooltip-2]::after {
  content: attr(data-tooltip-2);
  position: absolute;
  top: -65%;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  font-family: "Tajawal", sans-serif;
}

/* Show on hover/focus */
[data-tooltip-2]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.save-btn {
  margin-top: 5px;
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: #eee;
  font-size: 0.8em;
  cursor: pointer;
  color: #333;
  transition: background 0.2s;
}

.save-btn:hover {
  background: #f19b1a;
  color: white;
}

.save-btn:hover .star-icon {
  stroke: white;
  /* works if the SVG paths use stroke */
}

.verse-box {
  display: flex;
  gap: 10px;
  align-items: center;
  /* ✅ Align top of lines */
  justify-content: flex-end;
  border-radius: 6px;
  transition: background 0.2s;
  text-align: right;
  direction: rtl;
  padding: 10px;
  margin: 8px 0;
  background: #33343c;
  font-family: "Tajawal", sans-serif;
  flex-wrap: nowrap;
  /* ✅ Prevent wrapping between prefix and text */
}

.verse-prefix {
  font-weight: bold;
  width: 24px;
  text-align: center;
  color: #999;
  flex-shrink: 0;
  /* ✅ Prevent shrinking on long lines */
}

.verse-box.chorus .verse-prefix {
  color: #f19b1a;
}

.verse-box:hover {
  background: #42434b;
}

.verse-box.selected {
  background: #42434b;
  border: 0px solid #ffcc5b;
}

.verse-content {
  flex: 1;
  line-height: 1.8;
  word-break: break-word;
  /* ✅ Proper wrap on long text */
  text-align: right;
}

#dropdown li.no-results {
  text-align: center;
  color: #999;
  background-color: #24252b;
  padding: 10px;
  cursor: default;
  pointer-events: none;
}

.tagtab {
  border-radius: 50px;
  background-color: #35363e;
  color: white;
  border: 0px solid #78797f;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Tajawal", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tagtab:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.tagtab:active {
  transform: scale(0.95);
  background-color: rgba(255, 255, 255, 0.25);
}

.inner-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 50px;
  background-color: #35363e;
  color: white;
  border: 0px solid #78797f;
  margin: 6px 3px 0px 3px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Tajawal", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.inner-tag:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.inner-tag:active {
  transform: scale(0.95);
  background-color: rgba(255, 255, 255, 0.25);
}

.main-container {
  text-align: -webkit-right;
  background-color: #2b2c33;
  padding: 12px;
  border-radius: 25px;
  justify-items: right;
}

#fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2em;
}

.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  color: #ffffff;
  font-size: 2em;
  font-family: "Tajawal", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5000;
}

body {
  max-width: 800px;
  font-family: "Tajawal", sans-serif;
  margin: 0;
  padding: 10px;
  text-align: center;
}

#logo {
  z-index: 0;
  margin-bottom: 20px;
  color: #ff4d4f;
  font-size: 2em;
  font-weight: bold;
  height: var(--logo-height-desktop);
  max-width: 400px;
  object-fit: contain;
  object-position: center bottom;
  padding-bottom: 20px;
  align-content: center;
}

.hide-logo {
  animation: hideLogo 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.show-logo {
  animation: showLogo 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes hideLogo {
  0% {
    opacity: 1;
    transform: translateY(0px) scale(1);
    height: var(--logo-height-desktop);
  }

  100% {
    opacity: 0;
    transform: translateY(-50px) scale(0.5);
    height: 25px;
  }
}

@keyframes showLogo {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.5);
    height: 0px;
  }

  100% {
    opacity: 1;
    transform: translateY(0px) scale(1);
    height: var(--logo-height-desktop);
  }
}

@media screen and (max-width: 600px) {
  @keyframes hideLogo {
    0% {
      opacity: 1;
      transform: translateY(0px) scale(1);
      height: var(--logo-height-mobile);
    }

    100% {
      opacity: 0;
      transform: translateY(-50px) scale(0.5);
      height: 25px;
    }
  }

  @keyframes showLogo {
    0% {
      opacity: 0;
      transform: translateY(-50px) scale(0.5);
      height: 0px;
    }

    100% {
      opacity: 1;
      transform: translateY(0px) scale(1);
      height: var(--logo-height-mobile);
    }
  }
}

.search-container {
  position: relative;
  align-items: center;
  width: 100%;
  background-color: #42434b;
  border: 1px solid #78797f;
  border-radius: 12px;
  margin-bottom: -4px;
}

.search-icon {
  position: absolute;
  right: 5px;
  top: 10px;
  height: 24px;
  width: 24px;
  padding-right: 10px;
  color: white;
}

#dropdown li.search-filters {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap: 8px;
  padding: 5px 10px 15px 10px;
  margin-top: 0px;
  background-color: transparent;
  flex-wrap: wrap;
  border-bottom: 1px solid #33343c;
  margin-bottom: 10px;
}

#dropdown li.search-filters:hover {
  background-color: transparent;
}

.filter-tab {
  background-color: #35363e;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-family: "Tajawal", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.filter-tab.active {
  background-color: #f19b1a;
  color: white;
  font-weight: 700;
  transform: scale(1.05);
}

#searchBox {
  font-family: "Tajawal", sans-serif;
  inline-size: -webkit-fill-available;
  line-height: 1.5;
  padding: 10px 52px 10px 6px;
  font-size: 16px;
  height: 24px;
  border-radius: 12px;
  background-color: #42434b;
  border: 0px solid #78797f;
  color: white;
  text-align: right;
  direction: rtl;
}

#dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  width: 100%;
  max-height: 350px;
  overflow-y: auto;
  z-index: 1000;
  text-align: right;
  background: #24252b;
  border-radius: 20px;
  margin-top: 20px;
  padding: 14px 0px;
}

#dropdown li {
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.2s;
  background: #33343c;
  margin: 6px 20px;
  border-radius: 10px;
}

#dropdown li.active,
#dropdown li:hover {
  background: #42434b;
}

#dropdown li .title {
  font-weight: bold;
  color: white;
}

#dropdown li .line {
  font-size: 0.9em;
  color: #a0a1a5;
}

#dropdown::-webkit-scrollbar {
  width: 14px;
}

#dropdown::-webkit-scrollbar-thumb {
  background-color: rgb(66, 67, 75);
  border-radius: 10px;
  border-width: 4px;
  border-style: solid;
  border-color: #24252b;
  border-image: initial;
}

#dropdown::-webkit-scrollbar-track {
  margin-top: 10px;
  margin-bottom: 10px;
  background: transparent;
}

mark {
  background: yellow;
}

#songContainer {
  margin-top: 20px;
  display: inline-block;
  inline-size: -webkit-fill-available;
  text-align: right;
  border: 0px solid #ccc;
  background: #2b2c33;
  padding: 0px 1px 15px 15px;
  border-radius: 25px;
  color: white;
  max-height: calc(100vh - 350px);

  overflow-y: scroll;
  overflow-x: hidden;
  font-size: 0.9em;
  font-weight: bold;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 1;
  transform: scale(1);
  border-bottom: 10px solid #2b2c33;
  min-width: -moz-available;

}

/* Chrome, Edge, Safari */
#songContainer::-webkit-scrollbar {
  width: 14px;
}

#songContainer::-webkit-scrollbar-track {
  background: transparent;
  margin-top: 30px;
  margin-bottom: 30px;
}

#songContainer::-webkit-scrollbar-thumb {
  background-color: #42434b;
  border-radius: 10px;
  border: 4px solid #2b2c33;
}

.hidden {
  opacity: 0 !important;
  transform: scale(1.1) !important;
  pointer-events: none !important;
}

.full-hidden {
  opacity: 0 !important;
  transform: scale(1.1) !important;
  pointer-events: none !important;
  display: none !important;
}

.song-header {
  flex-direction: row-reverse;
  justify-content: space-between;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  padding-top: 20px;
  padding-bottom: 10px;
  background-color: #2b2c33;
  /* optional: prevent content underlapping */
  z-index: 20;
  /* optional: ensure it stays on top */
}

#closeBtn {
  background-color: transparent;
  color: white;
  border: none;
  cursor: pointer;
  width: fit-content;
  margin-left: 5px;
  transition: all 0.3s ease;
  padding: 0;
}

#closeBtn:hover {
  transform: scale(1.1);
}

#closeBtn:active {
  transform: scale(0.9);
}

#closeBtn div {
  background: rgba(255, 255, 255, 0.1);
  height: 30px;
  width: 30px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#closeBtn:hover div {
  background: rgba(255, 255, 255, 0.25);
}

#fullscreen-content {
  align-items: center;
  justify-content: center;

  direction: rtl;

  width: 100%;
}

.save-btn {
  background: none;
  padding: 0px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 40px;
  width: 40px;
  border-radius: 40px;
  background-color: #52535c;
}

.save-btn .star-icon {
  width: 16px;
  height: 16;
  stroke: rgb(160, 161, 165);
  fill: none;
  transition: fill 0.2s ease;
}

.save-btn.active {
  background-color: #f19b1a;
}

.save-btn.active .star-icon {
  fill: white;
  stroke: white;
}

.app-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(66, 67, 75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
  font-size: 16px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.app-loading.fade-out {
  opacity: 0;
  transform: translateY(-20px);
}

.app-loading.hidden {
  display: none;
}

.css-loader {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  margin-top: 10px;
}

#songheader-controls {
  min-width: fit-content;
}

#songPlayer {
  max-width: 450px !important;
  width: 100%;
  max-width: 600px;
  min-width: 300px;
  border-radius: 10px;
  background-color: #d4d3cc;
  color: white;
  padding: 5px;
  box-sizing: border-box;
  filter: invert(1);
}

/* 🎚 شريط التحكم */
#songPlayer::-webkit-media-controls-panel {
  background-color: #bdbcb4;
}

/* ▶️ زرار التشغيل */
#songPlayer::-webkit-media-controls-play-button {
  background-color: #bdbcb4;
  border-radius: 50%;
}

/* 🔊 أيقونة الصوت */
#songPlayer::-webkit-media-controls-mute-button {
  background-color: #b1b0a7;
  border-radius: 50%;
}

/* ⏱ شريط التقدم */
#songPlayer::-webkit-media-controls-timeline {
  background-color: #bdbcb4;
  border-radius: 5px;
}

/* 🔊 شريط الصوت */
#songPlayer::-webkit-media-controls-volume-slider {
  background-color: #b1b0a7;
  border-radius: 5px;
}

/* ⏱ الوقت */
#songPlayer::-webkit-media-controls-current-time-display,
#songPlayer::-webkit-media-controls-time-remaining-display {
  color: white;
  filter: invert(1);
}

.masses-controls {
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  /* مسافة بين كل زرار */
  flex-wrap: wrap;
  /* لو الشاشة ضيقة يتكسر للسطر التالي */
  align-items: center;
  background-color: rgb(43, 44, 51);
  padding: 8px 0px;
  border-radius: 12px;
}

.masses-controls label {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 6px;
  background-color: #35363e;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-family: "Tajawal", sans-serif;
  user-select: none;
  transition: all 0.3s ease;
}

/* Hover effect */
.masses-controls label:hover {
  background-color: #35363e;
}

.masses-controls input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  background-color: transparent;
  /* default empty */
  transition: all 0.2s;
}

/* Checked state */
.masses-controls input[type="checkbox"]:checked {
  background-color: #f19b1a;
  border-color: #f19b1a;
}

/* Optional: add check mark */
.masses-controls input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 6px;
  width: 3px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 10px;
}

.font-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #42434b;
  border-radius: 50px;
  width: 45px;
  height: 45px;
  min-width: 45px;
  min-height: 45px;
  max-width: 45px;
  max-height: 45px;
  cursor: pointer;
  transition: none;
  border: 2px solid #42434b;
  padding: 10px;
}

.font-btn:hover {
  background-color: #4d4e57;
  border: 2px solid #4d4e57;
}

.font-btn svg {
  pointer-events: none;
}

#left-controls {
  display: flex;
  flex-direction: row;
  width: fit-content;
  min-width: fit-content;
  gap: 5px;
  align-items: center;
}

/* Hide PWA standalone mode title bar icons */
@media (display-mode: standalone) {

  /* Hide the entire title bar area */
  body {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  /* If there's a specific container for these icons */
  .pwa-title-bar,
  .standalone-header,
  .app-header {
    display: none !important;
  }
}

.row {
  display: flex;
  gap: 1rem;
  /* مسافة بين الاتنين */
  margin-bottom: 0.75rem;
}

.row label {
  flex: 1;
  /* كل label ياخد نص العرض */
  display: flex;
  flex-direction: column;
  font-size: 14px;
  gap: 5px;
  font-weight: normal;
}

.row input,
.row select {
  margin-top: 0.25rem;
}

label.number-drag {
  cursor: default;
  user-select: none;
}

label.number-drag:hover {
  cursor: ew-resize;
  /* horizontal arrows */
}

#songVerses {
  direction: rtl;
  border-top: 1px solid #42434b;
}

/* Fullscreen Navigation Buttons */
.fullscreen-nav-btn {
  position: absolute;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: none;
  /* Hidden by default (Desktop) */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5010;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}

.fullscreen-nav-btn:hover {
  background: rgba(241, 155, 26, 0.8);
  transform: scale(1.1);
}

.fullscreen-nav-btn:active {
  transform: scale(0.9);
}

.exit-btn {
  top: 20px;
  right: 20px;
  /* Adjust for RTL if needed, but top-right is standard for exit */
}

.prev-btn {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.next-btn {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* Mobile Responsiveness Improvements */
@media screen and (max-width: 600px) {
  body {
    max-width: 100%;
    padding: 5px;
  }

  #logo {
    height: var(--logo-height-mobile);
    padding-top: 115px;
    /* Added padding top for centering feel */
    margin-bottom: 15px;
    padding-bottom: 0;
  }

  .fullscreen-nav-btn {
    display: flex;
    /* Show only on Mobile */
    width: 44px;
    /* Native feel */
    height: 44px;
    font-size: 1.5rem;
    top: auto;
    /* Remove vertical center */
    bottom: 20px;
    /* Move to very bottom */
    transform: none;
  }

  .exit-btn {
    top: 10px;
    right: 10px;
    bottom: auto;
    /* Keep exit at top */
  }

  .prev-btn {
    left: 20px;
    bottom: 20px;
  }

  .next-btn {
    right: 20px;
    bottom: 20px;
  }

  /* Keep top bar in one row on Mobile */
  .top-bar {
    padding: 10px;
    height: 50px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    margin-bottom: 0px;
  }

  .segmented {
    width: auto !important;
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px;
  }

  .segmented button {
    padding: 6px 8px;
  }

  .display-screen-dropdown {
    width: fit-content;
    min-width: 100px;
    background: none;
    padding: 5px;
    text-align: right;
  }

  .display-screen-title {
    font-size: 10px;
  }

  .display-screen-current {
    font-size: 12px;
  }

  .display-screen-arrow {
    left: 5px;
    width: 10px;
    height: 10px;
  }

  /* Increase touch targets for mobile */
  .segmented button,
  .font-btn,
  .save-btn,
  .tagtab,
  .inner-tag,
  #closeBtn div {
    min-width: 44px;
    min-height: 44px;
  }

  .main-container {
    padding: 15px 10px;
    border-radius: 20px;
    width: auto;
    margin: 0 5px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Buttons in one row on Mobile */
  .main-container>br {
    display: none;
  }

  .main-container .tagtab {
    flex: 1;
    font-size: 10px;
    /* Scaled down little bit */
    padding: 8px 2px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  .main-container .tagtab svg {
    width: 10px;
    height: 10px;
  }

  /* Wrap the buttons in a row */
  .main-container-buttons {
    display: flex;
    flex-direction: row;
    gap: 5px;
    width: 100%;
    margin-top: 10px;
  }

  .search-container {
    border-radius: 15px;
  }

  #searchBox {
    font-size: 16px;
    /* Prevent iPhone auto-zoom */
    padding: 12px 45px 12px 10px;
    height: auto;
  }

  #songContainer {
    max-height: calc(100vh - 300px);
    padding: 0 8px 15px 8px;
    margin-top: 15px;
  }

  .song-header {
    flex-direction: column-reverse;
    gap: 15px;
    padding-top: 15px;
  }

  #left-controls {
    justify-content: center;
    width: 100%;
    gap: 10px;
  }

  #songheader-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
  }

  #songTitle {
    font-size: 1.1rem;
    text-align: right;
    margin: 0;
  }
}

/* Mobile-specific refinements for floating elements */
@media screen and (max-width: 600px) {
  .floating-buttons {
    bottom: 15px;
    padding: 4px;
    gap: 4px;
  }

  .floating-buttons button {
    width: 44px;
    height: 44px;
  }

  #settingsPanel {
    bottom: 70px;
    padding: 15px;
    border-radius: 20px 20px 0 0;
    max-height: calc(100vh - 100px);
  }

  .settings-tabs {
    padding: 10px 0;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tabs .tab {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .masses-controls label {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }
}

/* Orientation adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .exit-btn {
    top: 10px;
    right: 10px;
  }

  .prev-btn,
  .next-btn {
    width: 40px;
    height: 40px;
  }

  #logo {
    display: none;
    /* Save space in landscape */
  }
}