/**
 * AlifBee Podcast Player - Styles
 * 
 * @package AlifBee_Podcast_Player
 * @version 1.0.0
 * @author Bal Elsada
 * 
 * CSS follows BEM (Block Element Modifier) naming methodology
 * Block: alifbee-player
 */

/* ==========================================================================
   Base Player Container
   ========================================================================== */

.alifbee-player {
  position: relative;
  border: 2px solid #e0aaff;
  border-radius: 10px;
  padding: 10px;
  max-width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: #fdf8ff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

.alifbee-player:hover {
  box-shadow: 0 4px 12px rgba(160, 85, 247, 0.15);
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.alifbee-player__error {
  color: #dc2626;
  padding: 12px 16px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.alifbee-player__error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.alifbee-player__error-text {
  flex: 1;
  color: #dc2626;
  font-weight: 500;
}

.alifbee-player__retry-btn {
  padding: 6px 12px;
  background-color: #dc2626;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.alifbee-player__retry-btn:hover {
  background-color: #b91c1c;
}

.alifbee-player__retry-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Player Header
   ========================================================================== */

.alifbee-player__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.alifbee-player__play-btn,
.alifbee-player__pause-btn {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.alifbee-player__play-btn:hover,
.alifbee-player__pause-btn:hover {
  transform: scale(1.1);
  box-shadow: none !important;
}

.alifbee-player__play-btn:active,
.alifbee-player__pause-btn:active {
  transform: scale(0.95);
}

.alifbee-player__play-icon,
.alifbee-player__pause-icon {
  display: block;
  cursor: pointer;
  border-radius: 4px;
  transition: transform 0.2s ease-in-out;
}

.alifbee-player__header-image {
  width: 45px;
  height: 45px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
}

.alifbee-player__header-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.alifbee-player__title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  flex: 1;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ==========================================================================
   Player Controls
   ========================================================================== */

.alifbee-player__controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.alifbee-player__progress-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alifbee-player__time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.alifbee-player__current-time,
.alifbee-player__duration {
  min-width: 40px;
}

.alifbee-player__current-time {
  text-align: left;
}

.alifbee-player__duration {
  text-align: right;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.alifbee-player__progress {
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background-color: #ddd;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease;
}

.alifbee-player__progress:hover {
  background-color: #ccc;
}

/* WebKit browsers (Chrome, Safari, Edge) */
.alifbee-player__progress::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
}

.alifbee-player__progress::-webkit-slider-thumb:hover {
  background: #9333ea;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.5);
}

.alifbee-player__progress::-webkit-slider-thumb:active {
  transform: scale(0.95);
}

/* Firefox */
.alifbee-player__progress::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
}

.alifbee-player__progress::-moz-range-thumb:hover {
  background: #9333ea;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.5);
}

.alifbee-player__progress::-moz-range-thumb:active {
  transform: scale(0.95);
}

/* Internet Explorer/Edge legacy */
.alifbee-player__progress::-ms-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  border: none;
}

.alifbee-player__progress::-webkit-slider-runnable-track {
  background: transparent;
  border-radius: 5px;
}

.alifbee-player__progress::-moz-range-track {
  background: transparent;
  border-radius: 5px;
}

/* ==========================================================================
   Volume Control
   ========================================================================== */

.alifbee-player__volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.alifbee-player__volume-icon {
  color: #a855f7;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}

.alifbee-player__volume-icon:hover {
  color: #9333ea;
  transform: scale(1.1);
}

.alifbee-player__volume {
  width: 60px;
  height: 4px;
  border-radius: 4px;
  background-color: #e0aaff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease;
}

.alifbee-player__volume:hover {
  background-color: #d8b4fe;
}

/* WebKit browsers (Chrome, Safari, Edge) */
.alifbee-player__volume::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(168, 85, 247, 0.3);
}

.alifbee-player__volume::-webkit-slider-thumb:hover {
  background: #9333ea;
  transform: scale(1.2);
}

.alifbee-player__volume::-webkit-slider-thumb:active {
  transform: scale(0.9);
}

/* Firefox */
.alifbee-player__volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #a855f7;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.alifbee-player__volume::-moz-range-thumb:hover {
  background: #9333ea;
  transform: scale(1.2);
}

.alifbee-player__volume::-moz-range-thumb:active {
  transform: scale(0.9);
}

.alifbee-player__volume::-moz-range-track {
  background: transparent;
  border-radius: 4px;
}

/* ==========================================================================
   Audio Element (hidden)
   ========================================================================== */

.alifbee-player__audio {
  display: none;
}

/* ==========================================================================
   WordPress Widget Specific Styles
   ========================================================================== */

.widget.alifbee-podcast-player-widget {
  margin-bottom: 20px;
}

.widget.alifbee-podcast-player-widget .widget-title {
  margin-bottom: 15px;
}

/* ==========================================================================
   Elementor Widget Specific Styles
   ========================================================================== */

.elementor-widget-alifbee-podcast-player {
  margin-bottom: 20px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablets and below */
@media (max-width: 768px) {
  .alifbee-player__header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
  }

  .alifbee-player__title {
    font-size: 11px;
    width: 100%;
    margin-top: 8px;
  }

  .alifbee-player__header-image {
    width: 35px;
    height: 35px;
  }

  .alifbee-player__play-icon,
  .alifbee-player__pause-icon {
    width: 30px;
    height: 30px;
  }

  .alifbee-player__time {
    font-size: 11px;
  }
}

/* Mobile devices */
@media (max-width: 480px) {
  .alifbee-player__error-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .alifbee-player__retry-btn {
    width: 100%;
  }

  .alifbee-player__header-image {
    width: 30px;
    height: 30px;
  }

  .alifbee-player__play-icon,
  .alifbee-player__pause-icon {
    width: 28px;
    height: 28px;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .alifbee-player {
    display: none;
  }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Focus styles for keyboard navigation */
.alifbee-player__play-btn:focus,
.alifbee-player__pause-btn:focus {
  outline: 2px solid #a855f7;
  outline-offset: 3px;
  border-radius: 4px;
}

.alifbee-player__progress:focus {
  outline: 2px solid #a855f7;
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .alifbee-player,
  .alifbee-player__play-btn,
  .alifbee-player__pause-btn,
  .alifbee-player__play-icon,
  .alifbee-player__pause-icon,
  .alifbee-player__progress::-webkit-slider-thumb,
  .alifbee-player__progress::-moz-range-thumb,
  .alifbee-player__retry-btn {
    transition: none;
  }

  .alifbee-player__spinner {
    animation: none;
    border-top-color: #a855f7;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .alifbee-player {
    border-color: currentColor;
    border-width: 3px;
  }

  .alifbee-player__progress {
    background-color: #999;
  }
}
