:root {
  --primary-color: var(--rdm-light-primary);
  --bg-primary: var(--rdm-light-bg-primary);
  --bg-secondary: var(--rdm-light-bg-secondary);
  --text-primary: var(--rdm-light-text-primary);
  --text-secondary: var(--rdm-light-text-secondary);
  --border-color: #eee;
}
body.theme-dark {
  --primary-color: var(--rdm-dark-primary);
  --bg-primary: var(--rdm-dark-bg-primary);
  --bg-secondary: var(--rdm-dark-bg-secondary);
  --text-primary: var(--rdm-dark-text-primary);
  --text-secondary: var(--rdm-dark-text-secondary);
  --border-color: #333;
}
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
  padding-bottom: 90px;
}
.rosedev-music-app-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  font-family: "Vazir", sans-serif;
}

.rdm-site-branding {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-grow: 1;
}
.rdm-site-title {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  margin: 0;
}
.rdm-logo {
  width: auto;
  display: none;
}
body.theme-light .rdm-logo-light {
  display: block;
}
body.theme-dark .rdm-logo-dark {
  display: block;
}
body.theme-dark .rdm-logo-light,
body.theme-light .rdm-logo-dark {
  display: none;
}

.rdm-main-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
  gap: 20px;
}
.rdm-nav {
  display: flex;
  gap: 10px;
}
.rdm-nav-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.rdm-nav-btn .dashicons {
  margin-left: 6px;
}
.rdm-nav-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.rdm-search-box {
  position: relative;
  flex-grow: 1;
  max-width: 350px;
}
#rdm-search-input {
  width: 100%;
  padding: 10px 15px 10px 35px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}
.rdm-search-box .dashicons-search {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}
.rdm-top-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}
.rdm-action-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-primary);
}
.rdm-action-btn .dashicons,
.rdm-action-btn .fa-solid {
  font-size: 24px;
  vertical-align: middle;
}
#rdm-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}
#rdm-user-profile .button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 20px;  
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;  
    line-height: normal;
    display: inline-block;
}
.rdm-remaining-days-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    cursor: help;
    padding-top: 8px;  
    box-sizing: border-box;  
}

.rdm-main-content {
  padding: 0 20px;
}
.rdm-main-content h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 5px;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.rdm-main-content h3 .dashicons {
  margin-left: 8px;
}
.rdm-main-content h3 .rdm-delete-btn {
  font-size: 14px;
  color: #e74c3c;
  cursor: pointer;
  background: none;
  border: none;
}
.rdm-view {
  display: none;
}
.rdm-view.active {
  display: block;
}
.rdm-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.rdm-view-header h3 {
  margin: 0;
  border: none;
  padding: 0;
  color: var(--text-primary);
}
.rdm-view-header .button {
  display: flex;
  align-items: center;
  gap: 5px;
  background-color: var(--primary-color);
  color: #fff;
  border-radius: 25px;
  padding: 10px 20px;
  transition: background-color 0.2s;
}
.rdm-view-header .button:hover {
  background-color: var(--text-primary);
}

/* Grid Layout for Music & Album List */
.rdm-music-list,
.rdm-album-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 25px;
}

/* My Playlists Container */
#rdm-my-playlists-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rdm-my-playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}
.rdm-my-playlist-item:hover {
  background-color: var(--bg-primary);
  transform: translateY(-2px);
}
.rdm-my-playlist-item h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  flex-grow: 1;
}
.rdm-my-playlist-item-actions {
  display: flex;
  gap: 10px;
}
.rdm-my-playlist-item-actions .rdm-action-btn {
  font-size: 18px;
}
.rdm-my-playlist-item-actions .rdm-action-btn-delete {
  color: #e74c3c;
}

/* Album Item Card Style */
.rdm-album-item {
  cursor: pointer;
  text-align: right;
  transition: transform 0.3s ease;
}
.rdm-album-item:hover {
  transform: translateY(-5px);
}
.rdm-album-item-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  margin-bottom: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.rdm-album-item-name {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

/* Music Item Card Style */
.rdm-music-item {
  background-color: var(--bg-secondary);
  cursor: pointer;
  text-align: right;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07), 0 0 2px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
  border: 2px solid transparent;
}
.rdm-music-item:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08);
}
.rdm-item-cover-wrapper {
  position: relative;
  margin-bottom: 12px;
}
.rdm-item-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.rdm-item-play-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}
.rdm-music-item:hover .rdm-item-play-btn {
  opacity: 1;
  transform: translateY(0);
}
.rdm-item-play-btn .dashicons {
  font-size: 24px;
  line-height: 1;
  width: auto;
  height: auto;
}
.rdm-item-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
  padding: 0 4px;
}
.rdm-item-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}
.rdm-item-title {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.rdm-item-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rdm-item-artist {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rdm-item-likes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-right: 8px;
}
.rdm-item-likes .dashicons {
  font-size: 14px;
}
.rdm-drag-handle {
  cursor: grab;
  color: var(--text-secondary);
  opacity: 0.5;
  margin-left: 8px;
}
.rdm-music-item.sortable-ghost {
  background: var(--primary-color);
  opacity: 0.5;
}

/* Now Playing Indicator */
.rdm-music-item.is-playing {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color), 0 8px 25px rgba(0, 0, 0, 0.1);
}
.rdm-music-item.is-playing .rdm-item-play-btn {
  opacity: 1;
  transform: translateY(0);
}

/* Context Menu */
.rdm-item-actions-container {
  position: relative;
  flex-shrink: 0;
}
.rdm-item-context-trigger {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 5px;
}
.rdm-context-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  width: 180px;
}
.rdm-context-menu.active {
  display: block;
}
.rdm-context-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 100%;
  text-align: right;
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.rdm-context-btn .dashicons {
  font-size: 18px;
}
body.theme-light .rdm-context-btn:hover {
  background-color: #f0f0f0;
}
body.theme-dark .rdm-context-btn:hover {
  background-color: #2c3e50;
}

/* Player */
.rdm-player-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--rdm-player-background);
  color: var(--rdm-player-text-primary);
  display: none;
  flex-direction: column;
  z-index: 1000;
}
.rdm-player-progress-container {
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
}
.rdm-player-progress-bar {
  width: 100%;
  height: 5px;
  background-color: #555;
  cursor: pointer;
  margin-top: -5px;
  direction: ltr;
}
.rdm-progress {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.1s linear;
}
.rdm-player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  height: 80px;
}
.rdm-track-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-basis: 30%;
}
#rdm-track-cover {
  width: 60px;
  height: 60px;
  border-radius: 5px;
}
.rdm-track-details {
  display: flex;
  flex-direction: column;
}
#rdm-track-title {
  font-weight: bold;
}
#rdm-track-artist {
  font-size: 0.9em;
  color: var(--rdm-player-text-secondary);
}
#rdm-like-btn .dashicons-heart,
#rdm-download-btn .dashicons-download,
#rdm-add-to-playlist-btn .dashicons-plus-alt {
  font-size: 20px;
}
#rdm-like-btn .dashicons-heart {
  color: var(--rdm-player-icon-color);
  transition: color 0.2s;
}
#rdm-like-btn.is-liked .dashicons-heart {
  color: var(--primary-color);
}
.rdm-player-buttons {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-basis: 40%;
  justify-content: center;
}
.rdm-btn {
  background: none;
  border: none;
  color: var(--rdm-player-icon-color);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
}
.rdm-btn .dashicons,
.rdm-btn .fa-solid {
  vertical-align: middle;
  font-size: 22px;
}
.rdm-btn.active {
  color: var(--primary-color);
}
.rdm-btn-play {
  font-size: 32px;
  color: var(--primary-color);
}
.rdm-btn-play .dashicons {
  font-size: 38px;
  width: 38px;
  height: 38px;
}
.rdm-player-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  flex-basis: 30%;
}
.rdm-time-display {
  font-size: 0.9em;
  min-width: 90px;
  text-align: right;
}

/* Horizontal Volume Control */
.rdm-volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
#rdm-volume-bar {
  width: 80px;
  height: 5px;
  background-color: #555;
  border-radius: 2.5px;
  cursor: pointer;
  direction: ltr;
}
#rdm-volume-progress {
  height: 100%;
  background-color: #fff;
  border-radius: 2.5px;
  width: 100%;
  transition: width 0.1s linear;
}

/* Force Dashicons styles for player buttons to prevent theme conflicts */
.rdm-player-container .rdm-btn .dashicons {
  font-family: "dashicons" !important;
  text-decoration: inherit;
  font-weight: normal;
  font-style: normal;
  vertical-align: top;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Loader */
.rdm-loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}
.rdm-loader {
  border: 5px solid #555;
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Custom Modals */
.rdm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.2s, opacity 0.2s ease-in-out;
}
.rdm-modal.active {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}
.rdm-modal-content {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 0;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 450px;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
.rdm-modal.active .rdm-modal-content {
  transform: scale(1);
  opacity: 1;
}
.rdm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
}
.rdm-modal-header h3 {
  margin: 0;
  font-size: 18px;
  border: none;
  padding: 0;
  color: var(--text-primary);
}
.rdm-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
}
.rdm-modal-body {
  padding: 20px;
}
.rdm-modal-body p {
  text-align: center;
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--text-secondary);
}
.rdm-modal-body input[type="text"],
.rdm-modal-body input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 15px;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
}
.rdm-modal-body button {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: 8px;
}
#rdm-auth-modal input {
  text-align: center;
  direction: ltr;
}
#rdm-change-number-link {
  display: block;
  margin-top: 15px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}
#rdm-plans-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}
.rdm-plan-item {
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: 8px;
  text-align: right;
}
.rdm-plan-item h4 {
  margin: 0 0 10px;
}
.rdm-plan-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rdm-plan-price {
  font-weight: bold;
  color: var(--primary-color);
}
.rdm-plan-buy-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}
#rdm-download-links-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}
.rdm-download-link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: var(--bg-secondary);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color 0.2s;
}
.rdm-download-link-item .quality {
  font-weight: bold;
}
.rdm-download-link-item .icon {
  color: var(--primary-color);
}

/* --- Playlist Modal Styles --- */
#rdm-playlist-modal .rdm-modal-body {
  padding: 10px 20px 20px;
}
.rdm-playlist-modal-section {
  margin-top: 20px;
}
.rdm-playlist-modal-section:first-child {
  margin-top: 0;
}
.rdm-playlist-modal-section h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.rdm-create-playlist-form {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}
#rdm-new-playlist-name {
  flex: 1 1 auto;
  width: auto;
  margin-bottom: 0;
}
#rdm-create-playlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.2s, transform 0.2s;
}
#rdm-create-playlist-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}
#rdm-create-playlist-btn .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
  line-height: 1;
}
#rdm-user-playlists-container {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
#rdm-user-playlists-container p {
  padding: 20px;
  margin: 0;
}
.rdm-playlist-item {
  padding: 12px 15px;
  cursor: pointer;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}
.rdm-playlist-item:last-child {
  border-bottom: none;
}
body.theme-light .rdm-playlist-item:hover {
  background-color: #f0f0f0;
}
body.theme-dark .rdm-playlist-item:hover {
  background-color: #2c3e50;
}

#rdm-queue-container {
  max-height: 400px;
  overflow-y: auto;
}
.rdm-subscription-status {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-right: 4px solid var(--primary-color);
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}
.rdm-artist-page-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.rdm-artist-page-header img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
}
.rdm-artist-page-header .info h2 {
  margin: 0 0 10px;
}
.rdm-artist-page-header .info p {
  margin: 0;
  color: var(--text-secondary);
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 768px) {
  /* Header */
  .rdm-main-header {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .rdm-site-branding {
    order: -1;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
  }

  .rdm-nav {
    justify-content: center;
    flex-wrap: wrap;
  }

  .rdm-search-box {
    max-width: 100%;
    order: 3;
  }

  .rdm-top-actions {
    justify-content: space-between;
    order: 1;
  }

  #rdm-user-profile {
    order: 2;
  }

  #rdm-user-profile span {
    display: none;
  }

  .rdm-main-content {
    padding: 0 10px;
  }

  /* Music List */
  .rdm-music-list,
  .rdm-album-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }

  /* Player */
  .rdm-player-controls {
    height: 60px;
    padding: 10px 15px;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .rdm-track-info,
  .rdm-player-extra {
    display: none;
  }

  .rdm-player-buttons {
    flex-basis: 100%;
    justify-content: center;
  }

  body {
    padding-bottom: 90px;
  }

  /* Artist Page */
  .rdm-artist-page-header {
    flex-direction: column;
    text-align: center;
  }

  /* Modals */
  .rdm-modal-content {
    width: 90%;
    margin: 10% auto;
    padding: 0;
  }
}

@media (max-width: 480px) {
  /* Even smaller screens */
  .rdm-music-list,
  .rdm-album-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .rdm-btn .dashicons,
  .rdm-btn .fa-solid {
    font-size: 20px;
  }

  .rdm-btn-play .dashicons {
    font-size: 34px;
    width: 34px;
    height: 34px;
  }
}

/* --- SweetAlert2 z-index Fix --- */
.swal2-container {
  z-index: 3000 !important;
}
