/* =========================================
   Widget Card Styles
========================================= */
.mep-widget-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.mep-podcast-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 4px 15px rgba(255, 251, 251, 0);
  cursor: default;
  width: 100%;
  gap: 16px;
  direction: rtl;
}

.mep-card-cover {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.mep-card-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.mep-card-tag {
  display: inline-block;
  background-color: #2563eb;
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 16px;
  margin: 0;
  font-weight: bold;
}

.mep-card-title {
  margin: 0 0 4px 0 !important;
  font-size: 16px !important;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mep-card-author {
  margin: 0 !important;
  font-size: 13px !important;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mep-card-progress-wrapper {
  display: flex;
  align-items: center;
  flex-direction: row;
  direction: ltr;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: #555;
}

.mep-card-progress-bar {
  flex-grow: 1;
  background: #eee;
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.mep-card-progress-fill {
  background: #2563eb;
  height: 100%;
  border-radius: 2px;
  width: 0;
}

.mep-card-play-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  line-height: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.mep-card-play-btn svg {
  display: block;
}

.mep-card-play-btn:hover {
  background: #2563eb;
}

/* =========================================
   Sticky Global Player Styles
========================================= */
.mep-global-player {
  position: fixed;
  bottom: -150px; /* Hidden initially */
  left: 0;
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 20px rgba(255, 251, 251, 0);
  z-index: 999999;
  transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  direction: rtl;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mep-global-player.active {
  bottom: 0;
}

.mep-player-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.mep-player-details {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
}

.mep-player-cover {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mep-player-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mep-player-title {
  font-size: 14px;
  font-weight: bold;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mep-player-author {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mep-player-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 2;
}

.mep-play-pause-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  line-height: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mep-play-pause-btn svg {
  display: block;
}

.mep-progress-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  flex-direction: row;
  direction: ltr;
  gap: 10px;
  font-size: 12px;
  color: #555;
  margin: 0;
  padding: 0;
}

.mep-progress-bar {
  flex-grow: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.mep-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  height: 100%;
  background: #2563eb;
  width: 0%;
  border-radius: 3px;
  pointer-events: none;
}

.mep-close-btn {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.mep-close-btn:hover {
  color: #ff3333;
}

.mep-speed-control {
  position: relative;
  display: flex;
  align-items: center;
}

.mep-speed-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  line-height: 1;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  font-size: 12px;
  font-weight: 700;
}

.mep-speed-btn #mep-speed-label {
  display: block;
}

.mep-speed-btn:hover {
  background: #2563eb;
}

.mep-speed-dropdown {
  position: absolute;
  bottom: 55px;
  left: 0;
  background: #ffffff;
  border-radius: 14px;
  padding: 6px;
  min-width: 85px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid #ececec;
  z-index: 9999;
}

.mep-speed-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mep-speed-option {
  padding: 10px 12px;
  border-radius: 10px;
  color: #333;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

.mep-speed-option:hover {
  background: #dbeafe;
  color: #2563eb;
}

.mep-speed-option.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

@media (max-width: 768px) {
  .mep-speed-dropdown {
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
  }

  .mep-speed-dropdown.active {
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 768px) {
  .mep-player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    flex-wrap: nowrap;
  }

  .mep-progress-wrapper {
    flex: 1;
    min-width: 0;
  }

  .mep-speed-control {
    flex-shrink: 0;
  }

  .mep-play-pause-btn {
    position: static !important;
    flex-shrink: 0;
  }

  .mep-close-btn {
    left: 10px;
  }
}

/* Mobile and Tablet Responsive */
@media (max-width: 768px) {
  .mep-podcast-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    gap: 12px;
  }

  .mep-card-info {
    align-items: center;
    width: 100%;
  }

  .mep-card-cover {
    width: 80px;
    height: 80px;
  }

  .mep-card-progress-wrapper {
    width: 100%;
    justify-content: center;
  }

  .mep-card-play-btn {
    width: 100%;
    border-radius: 12px;
    margin-top: 8px;
  }

  /* Global Player Mobile Layout adjustments */
  .mep-global-player {
    padding: 16px;
  }

  .mep-player-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
  }

  .mep-player-details {
    width: calc(
      100% - 90px
    ); /* Leaves space on the left side for the Play/Pause and Close buttons */
  }

  .mep-player-cover {
    width: 44px;
    height: 44px;
  }

  .mep-player-author {
    display: block; /* Override 768px hidden */
    margin-top: 2px;
  }

  .mep-player-title {
    max-width: 100%;
  }

  .mep-player-controls {
    width: 100%;
  }

  .mep-progress-wrapper span {
    display: inline; /* Override 768px hidden */
  }

  .mep-play-pause-btn {
    position: absolute;
    left: 48px;
    top: 20px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    line-height: 0;
    box-sizing: border-box;
  }

  .mep-close-btn {
    left: 12px;
    top: 20px;
    transform: none;
    height: 36px;
    padding: 0;
  }

  /* Mobile: allow title text to wrap and be visible inside the card */
  .mep-card-info {
    overflow: visible;
  }

  .mep-card-title {
    white-space: normal !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px !important;
  }
}
