/* ===== Reset / base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-1: #1a2a6c;
  --bg-2: #b21f1f;
  --bg-3: #1a2a6c;
  --accent-gold: #ffd700;
  --accent-amber: #ffae42;
  --category-color: #e0f4f4;
  --scrollbar-thumb: #005f73;
  --scrollbar-track: #e0f4f4;
}

/* Full-page layout - FIXED */
html, body {
  height: 100%;
  width: 100%;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  background: #0a0f24;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* إزالة التمرير */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container - FIXED */
.player-container {
  width: 95vw; /* استخدام عرض النافذة */
  height: 95vh; /* استخدام ارتفاع النافذة */
  max-width: 800px;
  max-height: 900px;
  background: rgba(0,0,0,0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 15px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,215,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* منع التمرير الداخلي */
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  flex-shrink: 0; /* منع الانكماش */
}

.title {
  font-size: clamp(20px, 4vw, 28px); /* حجم خط متجاوب */
  font-weight: 800;
  background: linear-gradient(to right, var(--accent-gold), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.6px;
  text-align: center;
}

/* Now playing / Bismillah block */
.now-playing {
  margin-bottom: 10px;
  flex-shrink: 0;
}

.bismillah {
  background: rgba(255,255,255,0.03);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,215,0,0.06);
  text-align: center;
}

.bismallah-text {
  font-weight: 800;
  font-size: clamp(16px, 3vw, 20px);
  background: linear-gradient(to right, var(--accent-gold), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  font-family: 'Cairo', sans-serif;
}

.dedication {
  font-size: clamp(12px, 2.5vw, 16px);
  color: rgba(255,255,255,0.92);
  line-height: 1.4;
}

/* Search box */
.search-container {
  margin: 8px 0;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
  font-size: clamp(13px, 2.5vw, 15px);
  font-family: 'Cairo', sans-serif;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255,255,255,0.6);
}

/* Station list - FIXED */
.station-list-container {
  margin: 8px 0;
  flex: 1; /* يأخذ المساحة المتبقية */
  min-height: 0; /* يسمح بالمرونة */
}

.station-list {
  width: 100%;
  height: 100%;
  max-height: none; /* إزالة الحد الأقصى للارتفاع */
  overflow-y: auto;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: clamp(13px, 2.5vw, 15px);
  font-family: 'Cairo', sans-serif;
  color: #fff;
}

.station-list optgroup {
  font-weight: bold;
  color: var(--category-color);
  background: rgba(0, 95, 115, 0.3);
  padding: 4px;
  font-size: clamp(12px, 2.5vw, 14px);
}

.station-list option {
  padding: 8px 10px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 14px);
}

.station-list option:hover {
  background: rgba(255,255,255,0.1);
}

/* Scrollbar styling */
.station-list::-webkit-scrollbar {
  width: 6px;
}

.station-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
}

.station-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 8px;
}

/* Controls */
.controls { 
  margin-top: 6px; 
  flex-shrink: 0;
}

.main-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 4px;
}

/* Buttons */
.control-btn {
  width: clamp(40px, 8vw, 48px);
  height: clamp(40px, 8vw, 48px);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  font-size: clamp(14px, 3vw, 18px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.control-btn:hover { 
  transform: translateY(-4px); 
}

/* play button bigger */
.play-btn {
  width: clamp(50px, 10vw, 66px);
  height: clamp(50px, 10vw, 66px);
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  box-shadow: 0 8px 30px rgba(238,90,36,0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 3.5vw, 20px);
}

/* Play wrapper & spinner */
.play-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  position: absolute;
  width: clamp(60px, 12vw, 80px);
  height: clamp(60px, 12vw, 80px);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--accent-gold);
  animation: spin 1s linear infinite;
  display: none;
  z-index: 5;
}

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

/* Volume controls */
.volume-section {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.volume-btn {
  width: clamp(35px, 7vw, 40px);
  height: clamp(35px, 7vw, 40px);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 14px);
}

.volume-slider {
  width: clamp(120px, 25vw, 180px);
  accent-color: var(--accent-gold);
}

/* Message displayed inside UI */
.message {
  margin-top: 8px;
  display: none;
  background: rgba(0,0,0,0.4);
  padding: 6px 8px;
  border-radius: 6px;
  color: #9fffb7;
  border: 1px solid rgba(78,255,107,0.12);
  text-align: center;
  font-weight: 700;
  font-size: clamp(12px, 2.5vw, 14px);
  flex-shrink: 0;
}

/* Now Playing Info */
.now-playing-info {
  margin-top: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  text-align: center;
  flex-shrink: 0;
}

.current-track {
  font-weight: 600;
  color: var(--accent-gold);
  font-size: clamp(12px, 2.5vw, 14px);
}

/* Marquee box for dua */
.marquee-box {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.28);
  overflow: hidden;
  border: 1px solid rgba(255,215,0,0.06);
  height: clamp(35px, 7vw, 44px);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.marquee-box #marqueeText {
  white-space: nowrap;
  display: inline-block;
  animation: marquee 20s linear infinite;
  font-weight: 700;
  color: #fff;
  font-size: clamp(12px, 2.5vw, 14px);
}

.marquee-box #marqueeText span {
  background: linear-gradient(to right, var(--accent-gold), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.marquee-box #marqueeText .emoji {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
}

@keyframes marquee { 
  0% { transform: translateX(100%); } 
  100% { transform: translateX(-100%); } 
}

/* Credit text */
.credit {
  margin-top: 8px;
  text-align: center;
  font-size: clamp(6px, 1.5vw, 8px);
  color: rgba(255,255,255,0.7);
  font-family: 'Cairo', sans-serif;
  flex-shrink: 0;
}

/* Responsive tweaks for very small screens */
@media (max-width: 350px) {
  .player-container {
    padding: 10px;
    border-radius: 15px;
  }
  
  .main-controls {
    gap: 8px;
  }
  
  .volume-section {
    gap: 8px;
  }
  
  .bismillah {
    padding: 6px 8px;
  }
}

/* Responsive tweaks for landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
  .player-container {
    height: 98vh;
    padding: 10px;
  }
  
  .now-playing,
  .search-container,
  .controls,
  .volume-section,
  .marquee-box {
    margin-top: 4px;
    margin-bottom: 4px;
  }
  
  .station-list-container {
    flex: 0.7;
  }
  
  .station-list {
    font-size: 12px;
  }
  
  .station-list optgroup,
  .station-list option {
    font-size: 11px;
    padding: 4px 6px;
  }
}