/* ==========================================================================
   Apple Monochrome Design System (Noir & Blanc Épuré)
   Designed for Mobile, Desktop, Tablet, and Foldable Devices (Surface Duo / Fold)
   Full LTR & RTL (Arabic) Support
   ========================================================================== */

:root {
  --bg-main: #000000;
  --bg-card: #0c0c0e;
  --bg-card-hover: #141417;
  --bg-input: #18181c;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.25);
  --text-main: #ffffff;
  --text-secondary: #8e8e93;
  --text-tertiary: #48484a;
  --accent: #ffffff;
  --accent-inverted: #000000;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-arabic: -apple-system, BlinkMacSystemFont, "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  --glass-blur: blur(25px) saturate(180%);
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f2;
  --bg-input: #ebebed;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 0, 0, 0.25);
  --text-main: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #000000;
  --accent-inverted: #ffffff;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: 90px;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[dir="rtl"] body {
  font-family: var(--font-arabic);
}

/* Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* Header & Status Bar */
.apple-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.apple-logo {
  font-size: 24px;
  line-height: 1;
}

.brand-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #ff453a;
}

.status-dot.online {
  background-color: #30d158;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.4);
}

.lang-select, .theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.lang-select:hover, .theme-btn:hover {
  border-color: var(--border-active);
}

/* Apple Cards */
.apple-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.apple-card:hover {
  border-color: var(--border-active);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* Radio Switcher Tabs */
.radio-switch-group {
  display: flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.radio-tab-btn {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.radio-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Music Player View */
.now-playing-container {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.cover-art {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.track-info {
  flex: 1;
  overflow: hidden;
}

.track-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.track-artist {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Waveform Bars */
.live-waveform {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.wave-bar {
  width: 3px;
  background-color: var(--accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.1s; }

@keyframes wave {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* Controls & Inputs */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.apple-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.apple-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

.apple-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: var(--accent-inverted);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.apple-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.apple-btn:active {
  transform: scale(0.98);
}

.apple-btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.apple-btn-secondary:hover {
  border-color: var(--border-active);
}

.apple-btn-danger {
  background: #ff453a;
  color: #ffffff;
}

/* Player Bar Controls */
.player-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 200px;
}

.apple-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  outline: none;
}

.apple-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* Queue List */
.queue-list {
  list-style: none;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-bottom: 6px;
  font-size: 13px;
}

.queue-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 12px;
}

html[dir="rtl"] .queue-item-title {
  margin-right: 0;
  margin-left: 12px;
}

/* iOS Toggle Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: 0.3s;
  border-radius: 34px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--accent);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
  background-color: var(--accent-inverted);
}

/* Occupants Live List */
.occupants-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.occupant-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
}

.occupant-name {
  font-weight: 600;
}

.occupant-actions {
  display: flex;
  gap: 4px;
}

.mini-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mini-btn:hover {
  color: var(--text-main);
  border-color: var(--border-active);
}

.mini-btn.danger:hover {
  background: #ff453a;
  color: #fff;
  border-color: #ff453a;
}

/* Custom Commands Table */
.apple-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.apple-table th, .apple-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

html[dir="rtl"] .apple-table th, html[dir="rtl"] .apple-table td {
  text-align: right;
}

.apple-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 12px;
  z-index: 1000;
}

[data-theme="light"] .bottom-nav-bar {
  background: rgba(255, 255, 255, 0.85);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--text-main);
}

.nav-icon {
  font-size: 18px;
}

/* Dual-Screen / Desktop Split View */
.dual-panel-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .dual-panel-layout {
    grid-template-columns: 1.1fr 1fr;
    gap: 24px;
  }
}

/* Foldables Surface Duo (Dual Screen / Segments) */
@media (horizontal-viewport-segments: 2) {
  .dual-panel-layout {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* Apple Toast */
.apple-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

[data-theme="light"] .apple-toast {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
}

.apple-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   RTL (Arabic) Dedicated Polish
   ========================================================================== */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .brand-wrapper {
  text-align: right;
}

html[dir="rtl"] .card-header {
  text-align: right;
}

html[dir="rtl"] .apple-btn {
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: normal;
}

html[dir="rtl"] .apple-input {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .apple-input:focus {
  text-align: right;
}

html[dir="rtl"] .search-box {
  flex-direction: row;
}

html[dir="rtl"] .player-actions {
  flex-direction: row;
}

html[dir="rtl"] .volume-container {
  flex-direction: row-reverse;
}

html[dir="rtl"] .occupants-grid {
  flex-direction: row;
  justify-content: flex-start;
}

html[dir="rtl"] .occupant-badge {
  flex-direction: row;
  gap: 8px;
}

html[dir="rtl"] .mini-btn {
  font-family: var(--font-arabic);
  font-size: 11px;
  font-weight: 600;
}

html[dir="rtl"] .nav-item {
  font-family: var(--font-arabic);
  font-size: 11px;
}

html[dir="rtl"] .radio-tab-btn {
  font-family: var(--font-arabic);
  font-size: 13px;
  font-weight: 600;
}

/* ============================================================================
   RADIO STREAM URL CARD & LIVE PREVIEW
   ============================================================================ */
.stream-card {
  padding: 16px 20px;
  background: var(--bg-card);
}

.stream-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.stream-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.stream-input {
  flex: 1;
  font-family: "SF Mono", Menlo, Consolas, Monaco, monospace;
  font-size: 12px;
  color: #30d158;
  background: rgba(0, 0, 0, 0.25);
  cursor: text;
  text-overflow: ellipsis;
}

.stream-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-hint {
  font-size: 11px;
  color: var(--text-tertiary);
}

.mini-btn-listen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.mini-btn-listen:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-main);
}

.mini-btn-listen.playing {
  background: #30d158;
  color: #000;
  border-color: #30d158;
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.3);
}

/* ============================================================================
   SOUNDBOARD (EFFETS SONORES)
   ============================================================================ */
.soundboard-card {
  margin-top: 16px;
}

.sfx-badge {
  font-size: 11px;
  color: var(--text-secondary);
}

.sfx-badge strong {
  color: var(--text-main);
}

.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.sfx-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.2, 0.9, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 68px;
}

.sfx-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.sfx-btn:active, .sfx-btn.playing {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.sfx-emoji {
  font-size: 20px;
  line-height: 1;
}

.sfx-title {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

html[dir="rtl"] .stream-box {
  flex-direction: row;
}

html[dir="rtl"] .stream-footer {
  flex-direction: row-reverse;
}

html[dir="rtl"] .sfx-title {
  font-family: var(--font-arabic);
}

/* YouTube Search Results Dropdown */
.search-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  margin-top: -8px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  overflow: hidden;
  position: relative;
  z-index: 20;
}

.search-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.search-results-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-thumb {
  width: 48px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #111;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

/* Quick Action Buttons on Bots */
.bot-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mini-action-btn {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.mini-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.mini-action-btn.active {
  background: rgba(48, 209, 88, 0.15);
  border-color: #30d158;
  color: #30d158;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-main);
}

.tag-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0 2px;
}

.tag-remove-btn:hover {
  color: #ff453a;
}


