:root {
  --color-studio-dark: #0b0d12;
  --color-studio-darker: #050608;
  --color-studio-card: #121620;
  --color-studio-border: #1e2535;
  --color-studio-neutral: #1a1f2e;
  --color-algeria-green: #008751;
  --color-algeria-red: #d21034;
  --color-amber: #f59e0b;
  --color-elevenlabs: #9b59b6;
  --color-elevenlabs-light: #bb86fc;
  --color-elevenlabs-dark: #7b2d9e;
  --font-main: 'Cairo', sans-serif;
  --hamiz-primary: #006837;
  --hamiz-secondary: #008542;
  --hamiz-header-height: 70px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--color-studio-dark);
  color: #f3f4f6;
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  padding-top: var(--hamiz-header-height);
}

.hidden { display: none !important; }

/* Background Glows */
.bg-glow { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.bg-glow-green { top: 0; left: 25%; width: 380px; height: 380px; background: rgba(0, 135, 81, 0.08); }
.bg-glow-red { top: 40px; right: 25%; width: 320px; height: 320px; background: rgba(210, 16, 52, 0.06); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-studio-dark); }
::-webkit-scrollbar-thumb { background: var(--color-studio-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-algeria-green); }

/* Header */
.header {
  border-bottom: 1px solid var(--color-studio-border);
  background: rgba(5, 6, 8, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
  display: none;
}
@media (min-width: 1200px) { .header { display: block; } }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--color-algeria-green), #34d399); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 135, 81, 0.2); color: white; }
.brand-title { display: flex; align-items: center; gap: 8px; }
.brand-title h1 { font-size: 1.2rem; font-weight: 800; color: white; }
.badge { font-size: 10px; background: rgba(0, 135, 81, 0.2); border: 1px solid rgba(0, 135, 81, 0.35); color: #86efac; padding: 2px 8px; border-radius: 9999px; font-weight: 700; }
.brand-desc { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-settings { display: flex; align-items: center; gap: 6px; background: var(--color-studio-card); border: 1px solid var(--color-studio-border); color: #e5e7eb; padding: 8px 14px; border-radius: 10px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.btn-settings:hover { border-color: var(--color-algeria-green); background: rgba(0, 135, 81, 0.1); }
.status-badge { background: rgba(18, 22, 32, 0.85); border: 1px solid var(--color-studio-border); padding: 6px 12px; border-radius: 8px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: #e5e7eb; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Section Navigation */
.section-nav {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  position: relative;
  z-index: 1;
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--color-studio-border);
  background: var(--color-studio-card);
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.25s;
  font-family: var(--font-main);
}
.nav-btn:hover { border-color: #4b5563; color: #e5e7eb; }
.nav-btn.active {
  background: rgba(0, 135, 81, 0.15);
  border-color: var(--color-algeria-green);
  color: #86efac;
  box-shadow: 0 2px 12px rgba(0, 135, 81, 0.15);
}
.nav-btn svg { flex-shrink: 0; }

/* Sections */
.app-section { display: none; }
.app-section.active { display: flex; flex-direction: column; gap: 24px; }

/* Main Layout */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

/* Card */
.card { background: var(--color-studio-card); border: 1px solid var(--color-studio-border); border-radius: 16px; padding: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); position: relative; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title-row { display: flex; align-items: center; gap: 8px; }
.card-title-row h2 { font-size: 14px; font-weight: 700; color: white; }
.card-hint { font-size: 12px; color: #9ca3af; }
.card-flag-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(to left, var(--color-algeria-green), white, var(--color-algeria-red)); }

/* Icons */
.icon-green { color: var(--color-algeria-green); }
.icon-amber { color: var(--color-amber); }
.icon-elevenlabs { color: var(--color-elevenlabs-light); }
.animate-pulse { animation: pulse 2s infinite; }

/* Optimizer */
.optimizer-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; margin-top: 8px; }
.optimizer-title { font-size: 15px; font-weight: 800; color: white; display: flex; align-items: center; gap: 8px; }
.optimizer-desc { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.duration-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #9ca3af; background: rgba(11, 13, 18, 0.6); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--color-studio-border); }
.duration-badge strong { color: #86efac; }

/* Textarea */
.textarea-wrapper { position: relative; margin-bottom: 20px; }
textarea { width: 100%; background: rgba(11, 13, 18, 0.7); border: 1px solid var(--color-studio-border); border-radius: 12px; padding: 12px 16px; font-size: 13px; color: #f3f4f6; font-family: var(--font-main); line-height: 1.7; resize: none; transition: border-color 0.2s; direction: rtl; }
textarea:focus { outline: none; border-color: rgba(0, 135, 81, 0.8); box-shadow: 0 0 0 2px rgba(0, 135, 81, 0.15); }
textarea::placeholder { color: #6b7280; }
#inputText { height: 176px; }
#finalVoiceText { height: 112px; }
#mediaInstructions, #videoInstructions { height: 90px; }
#elevenLabsTextInput { height: 130px; }
#dialogueInput { height: 130px; }
#abtestInput { height: 110px; }
.btn-clear { position: absolute; bottom: 12px; left: 12px; font-size: 10px; background: var(--color-studio-dark); border: 1px solid var(--color-studio-border); color: #9ca3af; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-family: var(--font-main); }
.btn-clear:hover { background: var(--color-studio-border); }

/* Options Grid */
.options-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; }
@media (min-width: 768px) { .options-grid { grid-template-columns: 1fr 1fr; } }
.option-group { display: flex; flex-direction: column; gap: 10px; }
.option-label { font-size: 12px; font-weight: 700; color: #d1d5db; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.label-hint { font-size: 10px; color: #9ca3af; font-weight: 400; }
.option-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-btn { padding: 10px 12px; border-radius: 12px; text-align: right; font-size: 12px; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.4); color: #9ca3af; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; justify-content: center; font-family: var(--font-main); }
.opt-btn:hover { border-color: #4b5563; }
.opt-btn.active { background: rgba(0, 135, 81, 0.1); border-color: var(--color-algeria-green); color: white; }
.opt-btn.active-tone { background: rgba(14, 116, 144, 0.1); border-color: #0e7490; color: white; }
.opt-btn span.opt-title { font-weight: 700; }
.opt-btn span.opt-desc { font-size: 10px; color: #6b7280; }

/* Error */
.error-box { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; padding: 14px; border-radius: 12px; font-size: 12px; text-align: right; margin-bottom: 16px; }

/* Buttons */
.btn-primary { width: 100%; background: linear-gradient(to left, var(--color-algeria-green), #059669); color: white; padding: 14px; border-radius: 12px; font-size: 14px; font-weight: 800; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 16px rgba(0, 135, 81, 0.2); transition: all 0.3s; font-family: var(--font-main); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(0, 135, 81, 0.3); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { width: 100%; background: #f1f5f9; color: var(--color-studio-dark); padding: 14px; border-radius: 12px; font-size: 14px; font-weight: 800; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); transition: all 0.3s; font-family: var(--font-main); }
.btn-secondary:hover { background: white; }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Result Actions */
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-action { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.6); color: #d1d5db; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); text-decoration: none; }
.btn-action:hover { border-color: #4b5563; color: white; }
.btn-action-transfer { border-color: rgba(0, 135, 81, 0.3); color: #86efac; background: rgba(0, 135, 81, 0.08); }
.btn-action-transfer:hover { background: rgba(0, 135, 81, 0.15); color: white; }
.btn-sm { padding: 6px 10px; font-size: 11px; }

/* Results */
.results-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--color-studio-border); padding-bottom: 12px; margin-bottom: 16px; }
.results-title-row { display: flex; align-items: center; gap: 8px; }
.results-title-row h3 { font-size: 14px; font-weight: 700; color: white; }
.results-badge { background: rgba(0, 135, 81, 0.2); padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #86efac; }
.btn-copy { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #9ca3af; background: var(--color-studio-dark); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--color-studio-border); cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.btn-copy:hover { color: white; }
.results-text-box { background: rgba(11, 13, 18, 0.6); padding: 16px; border-radius: 12px; border: 1px solid var(--color-studio-border); margin-bottom: 16px; }
.results-text-box p { font-size: 14px; color: #f3f4f6; line-height: 1.8; white-space: pre-line; font-weight: 500; }
.results-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
@media (min-width: 768px) { .results-grid { grid-template-columns: 1fr 1fr; } }
.results-card { border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.results-card-amber { background: rgba(245, 158, 11, 0.02); border: 1px solid rgba(245, 158, 11, 0.1); }
.results-card-green { background: rgba(16, 185, 129, 0.02); border: 1px solid rgba(16, 185, 129, 0.1); }
.results-card h4 { font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.results-card-amber h4 { color: #fcd34d; }
.results-card-green h4 { color: #86efac; }
.results-card ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.results-card li { display: flex; justify-content: space-between; align-items: center; background: rgba(11, 13, 18, 0.4); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(30, 37, 53, 0.5); }
.results-card li span { font-size: 12px; font-weight: 700; color: #e5e7eb; }
.results-card li button { background: none; border: none; color: #6b7280; cursor: pointer; padding: 2px; transition: color 0.2s; }
.results-card li button:hover { color: white; }
.phonetic-box { font-size: 12px; color: #d1d5db; line-height: 1.7; background: rgba(11, 13, 18, 0.4); padding: 12px; border-radius: 8px; border: 1px solid rgba(30, 37, 53, 0.5); }
.advice-box { background: rgba(14, 116, 144, 0.05); border: 1px solid rgba(14, 116, 144, 0.15); padding: 14px; border-radius: 12px; font-size: 12px; display: flex; align-items: flex-start; gap: 10px; text-align: right; direction: rtl; }
.advice-box svg { color: #22d3ee; flex-shrink: 0; margin-top: 2px; }
.advice-box strong { color: #67e8f9; display: block; margin-bottom: 4px; }
.advice-box span { color: #9ca3af; line-height: 1.6; }

/* Voice Section */
.studio-title { font-size: 15px; font-weight: 800; color: white; display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.voice-section { margin-bottom: 20px; }
.voice-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.voice-grid-inner { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .voice-grid-inner { grid-template-columns: 1fr 1fr; } }

.voice-group-label { font-size: 12px; font-weight: 800; color: #86efac; padding: 8px 12px; background: rgba(0, 135, 81, 0.08); border: 1px solid rgba(0, 135, 81, 0.15); border-radius: 8px; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.voice-group-label-el { color: var(--color-elevenlabs-light); background: rgba(155, 89, 182, 0.08); border-color: rgba(155, 89, 182, 0.15); }
.voice-group-label-pro { color: #fbbf24; background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.15); }
.voice-group-icon { font-size: 14px; }

.voice-btn { padding: 12px; border-radius: 12px; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.5); color: #9ca3af; cursor: pointer; transition: all 0.3s; display: flex; align-items: flex-start; gap: 12px; text-align: right; position: relative; overflow: hidden; font-family: var(--font-main); }
.voice-btn:hover { border-color: #4b5563; }
.voice-btn.active { background: rgba(0, 135, 81, 0.1); border-color: var(--color-algeria-green); color: white; }
.voice-btn-el.active { background: rgba(155, 89, 182, 0.1); border-color: var(--color-elevenlabs); }

.voice-provider-badge { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; margin-top: 4px; }
.voice-provider-gemini { background: rgba(0, 135, 81, 0.12); color: #86efac; border: 1px solid rgba(0, 135, 81, 0.25); }
.voice-provider-el-free { background: rgba(155, 89, 182, 0.12); color: var(--color-elevenlabs-light); border: 1px solid rgba(155, 89, 182, 0.25); }
.voice-provider-el-pro { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }
.voice-avatar { width: 40px; height: 40px; border-radius: 8px; background: var(--color-studio-dark); border: 1px solid var(--color-studio-border); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.voice-info { flex: 1; min-width: 0; }
.voice-info-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 2px; }
.voice-name { font-size: 12px; font-weight: 700; color: #f3f4f6; }
.voice-gender { font-size: 10px; color: #6b7280; }
.voice-desc { font-size: 10px; color: #9ca3af; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.voice-check { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-algeria-green); color: white; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.final-text-section { margin-bottom: 16px; }

/* Audio Player */
.audio-player { border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.5); border-radius: 16px; padding: 16px; margin-top: 16px; }
.player-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.player-format { font-size: 10px; color: #6b7280; font-family: monospace; }
.player-title { font-size: 12px; font-weight: 700; color: #d1d5db; }
.player-empty { padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; color: #6b7280; }
.player-empty svg { animation: pulse 2s infinite; }
.player-empty p { font-size: 12px; }
.player-active { display: flex; flex-direction: column; gap: 14px; }

/* Waveform */
.waveform { height: 40px; background: rgba(5, 6, 8, 0.8); border-radius: 8px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 4px; border: 1px solid rgba(30, 37, 53, 0.5); }
.wave-bar { width: 6px; border-radius: 4px; background: linear-gradient(to top, var(--color-algeria-green), #34d399); transition: height 0.15s; }

/* Speed Controls */
.speed-controls { display: flex; align-items: center; justify-content: space-between; }
.speed-controls > span { font-size: 11px; color: #9ca3af; }
.speed-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.speed-btn { padding: 4px 8px; border-radius: 4px; font-size: 10px; font-family: monospace; border: none; cursor: pointer; transition: all 0.2s; background: var(--color-studio-dark); color: #9ca3af; }
.speed-btn.active { background: var(--color-algeria-green); color: white; }

/* Seeker */
.seeker-row { display: flex; align-items: center; gap: 10px; }
.seeker-row span { font-size: 10px; color: #9ca3af; font-family: monospace; }
.seeker-row input[type="range"] { flex: 1; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; background: var(--color-studio-dark); border-radius: 4px; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--color-algeria-green); cursor: pointer; }

/* Player Controls */
.player-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--color-studio-border); padding-top: 12px; margin-top: 4px; }
.volume-control { display: flex; align-items: center; gap: 8px; }
.volume-control input[type="range"] { width: 64px; }
.btn-icon { background: none; border: none; color: #9ca3af; cursor: pointer; padding: 4px; transition: color 0.2s; }
.btn-icon:hover { color: white; }
.btn-play { width: 44px; height: 44px; border-radius: 50%; background: var(--color-algeria-green); color: white; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 135, 81, 0.2); transition: transform 0.2s; }
.btn-play:hover { transform: scale(1.05); }
.btn-play:active { transform: scale(0.95); }
.btn-download { display: flex; align-items: center; gap: 6px; background: var(--color-studio-neutral); border: 1px solid var(--color-studio-border); color: #e5e7eb; padding: 8px 14px; border-radius: 12px; font-size: 12px; font-weight: 700; text-decoration: none; transition: all 0.2s; font-family: var(--font-main); }
.btn-download:hover { background: var(--color-studio-border); color: white; }
.download-buttons { display: flex; gap: 8px; }
.btn-download-mp3 { background: rgba(0, 135, 81, 0.1); border-color: rgba(0, 135, 81, 0.3); color: #86efac; cursor: pointer; }
.btn-download-mp3:hover { background: rgba(0, 135, 81, 0.2); color: white; }

/* Tutorial */
.tutorial-title { font-size: 14px; font-weight: 700; color: #f3f4f6; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.tutorial-steps { display: flex; flex-direction: column; gap: 10px; }
.tutorial-step { display: flex; gap: 12px; justify-content: flex-end; align-items: flex-start; border-bottom: 1px solid rgba(30, 37, 53, 0.4); padding-bottom: 10px; }
.tutorial-step:last-child { border-bottom: none; padding-bottom: 0; }
.step-content { display: flex; flex-direction: column; text-align: right; }
.step-title { font-size: 12px; font-weight: 700; color: #e5e7eb; margin-bottom: 2px; }
.step-desc { font-size: 11px; color: #9ca3af; line-height: 1.5; }
.step-number { width: 20px; height: 20px; border-radius: 50%; background: rgba(11, 13, 18, 0.8); border: 1px solid var(--color-studio-border); display: flex; align-items: center; justify-content: center; font-size: 10px; color: #86efac; font-weight: 700; flex-shrink: 0; margin-top: 2px; }

/* Footer */
.footer { max-width: 1280px; margin: 48px auto 0; padding: 24px 16px; border-top: 1px solid var(--color-studio-border); text-align: center; font-size: 12px; color: #6b7280; }
.footer-link { color: #86efac; text-decoration: none; transition: color 0.2s; }
.footer-link:hover { color: #4ade80; }
.footer-nav { display: flex; justify-content: center; gap: 16px; margin: 8px 0; }
.footer-nav a { color: #9ca3af; text-decoration: none; font-size: 11px; transition: color 0.2s; }
.footer-nav a:hover { color: #86efac; }
.footer-tech { font-family: monospace; font-size: 10px; margin-top: 4px; }
.footer-tech a { color: #86efac; text-decoration: none; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-content { background: var(--color-studio-card); border: 1px solid var(--color-studio-border); border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--color-studio-border); }
.modal-header h2 { font-size: 16px; font-weight: 800; color: white; }
.modal-close { background: none; border: none; color: #9ca3af; font-size: 24px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all 0.2s; }
.modal-close:hover { color: white; background: var(--color-studio-border); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-size: 13px; font-weight: 700; color: #d1d5db; }
.setting-group select { background: var(--color-studio-dark); border: 1px solid var(--color-studio-border); color: #f3f4f6; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-family: var(--font-main); }
.setting-group select:focus { outline: none; border-color: var(--color-algeria-green); }
.setting-group textarea { height: auto; font-size: 12px; font-family: monospace; direction: ltr; text-align: left; }
.setting-hint { font-size: 11px; color: #6b7280; }
.setting-hint a { color: var(--color-elevenlabs-light); text-decoration: none; }
.setting-hint a:hover { text-decoration: underline; }
.setting-info { font-size: 12px; color: #9ca3af; background: var(--color-studio-dark); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--color-studio-border); text-align: center; }
.setting-info span { font-weight: 700; color: #86efac; }
.btn-save { width: 100%; background: var(--color-algeria-green); color: white; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 700; border: none; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.btn-save:hover { background: #059669; }

/* Upload Section */
.upload-header { margin-bottom: 16px; margin-top: 8px; }
.upload-title { font-size: 15px; font-weight: 800; color: white; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.upload-desc { font-size: 12px; color: #9ca3af; }
.upload-area { position: relative; border: 2px dashed var(--color-studio-border); border-radius: 12px; padding: 24px; text-align: center; transition: all 0.3s; margin-bottom: 16px; cursor: pointer; }
.upload-area:hover, .upload-area.drag-over { border-color: var(--color-algeria-green); background: rgba(0, 135, 81, 0.05); }
.upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #6b7280; }
.upload-placeholder svg { color: #4b5563; }
.upload-text { font-size: 13px; font-weight: 600; color: #9ca3af; }
.upload-formats { font-size: 11px; color: #6b7280; }
.upload-preview { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.preview-grid img { max-width: 120px; max-height: 120px; border-radius: 8px; border: 1px solid var(--color-studio-border); object-fit: cover; }
.upload-preview video { max-width: 100%; max-height: 240px; border-radius: 8px; border: 1px solid var(--color-studio-border); }
.btn-remove-media { display: flex; align-items: center; gap: 4px; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.btn-remove-media:hover { background: rgba(239, 68, 68, 0.2); }
.upload-options { margin-bottom: 16px; }
.upload-type-buttons { grid-template-columns: 1fr 1fr 1fr !important; }
@media (max-width: 640px) { .upload-type-buttons { grid-template-columns: 1fr 1fr !important; } }

/* Media Type Toggle */
.media-type-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.media-type-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 10px; font-size: 13px; font-weight: 700; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.5); color: #9ca3af; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.media-type-btn:hover { border-color: #4b5563; }
.media-type-btn.active { background: rgba(0, 135, 81, 0.12); border-color: var(--color-algeria-green); color: #86efac; }

/* Video Settings */
.video-settings { background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.setting-row:not(:last-child) { border-bottom: 1px solid rgba(30, 37, 53, 0.4); }
.setting-label { font-size: 12px; font-weight: 700; color: #d1d5db; }
.setting-value { font-size: 11px; color: #86efac; }
.video-info { font-size: 12px; color: #9ca3af; text-align: center; padding: 8px 0; }

/* Instructions Box */
.instructions-box { margin-bottom: 16px; }
.instructions-box textarea { height: 90px; }

/* Smart Conversation Chat */
.smart-chat { margin-top: 16px; border: 1px solid var(--color-studio-border); border-radius: 12px; overflow: hidden; }
.chat-header { background: rgba(0, 135, 81, 0.08); border-bottom: 1px solid var(--color-studio-border); padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #86efac; }
.chat-messages { padding: 14px; max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 10px 14px; border-radius: 12px; font-size: 12px; line-height: 1.6; max-width: 85%; }
.chat-msg-ai { background: rgba(0, 135, 81, 0.1); border: 1px solid rgba(0, 135, 81, 0.2); color: #d1fae5; align-self: flex-end; }
.chat-msg-user { background: rgba(30, 37, 53, 0.6); border: 1px solid var(--color-studio-border); color: #e5e7eb; align-self: flex-start; }
.chat-input-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--color-studio-border); }
.extra-instructions-box { padding: 0 14px 10px; }
.chat-text-input { flex: 1; background: rgba(11, 13, 18, 0.7); border: 1px solid var(--color-studio-border); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: #f3f4f6; font-family: var(--font-main); direction: rtl; }
.chat-text-input:focus { outline: none; border-color: var(--color-algeria-green); }
.btn-chat-send { width: 36px; height: 36px; border-radius: 8px; background: var(--color-algeria-green); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-chat-send:hover { background: #059669; }
.btn-chat-finish { margin: 10px 14px 14px; width: calc(100% - 28px); padding: 10px; border-radius: 10px; background: linear-gradient(to left, var(--color-algeria-green), #059669); color: white; font-size: 12px; font-weight: 700; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-main); transition: all 0.2s; }
.btn-chat-finish:hover { transform: translateY(-1px); }

/* Media Result Preview */
.media-result-preview { margin-top: 16px; border: 1px solid var(--color-studio-border); border-radius: 12px; padding: 16px; background: rgba(0, 135, 81, 0.03); }
.result-preview-header { margin-bottom: 10px; }
.result-preview-header h4 { font-size: 13px; font-weight: 800; color: #86efac; }
.result-preview-text { background: rgba(11, 13, 18, 0.6); padding: 14px; border-radius: 10px; border: 1px solid var(--color-studio-border); font-size: 13px; color: #f3f4f6; line-height: 1.8; white-space: pre-line; }
.competitor-analysis-text { background: rgba(245, 158, 11, 0.05); padding: 14px; border-radius: 10px; border: 1px solid rgba(245, 158, 11, 0.15); font-size: 12px; color: #fcd34d; line-height: 1.7; white-space: pre-line; }

/* Competitor Upload */
.competitor-upload-section { margin-bottom: 16px; }
.competitor-text-section { margin-bottom: 12px; }
.competitor-text-section textarea { height: 100px; }
.competitor-upload-zone { border: 2px dashed rgba(245, 158, 11, 0.2); border-radius: 12px; padding: 20px; cursor: pointer; transition: all 0.2s; text-align: center; }
.competitor-upload-zone:hover, .competitor-upload-zone.dragover { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.03); }
.competitor-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.competitor-upload-placeholder p { font-size: 13px; font-weight: 700; color: #f59e0b; margin: 0; }
.competitor-upload-placeholder span { font-size: 11px; color: #6b7280; }
.competitor-upload-preview { position: relative; display: flex; justify-content: center; }
.competitor-preview-media { max-width: 100%; max-height: 220px; border-radius: 8px; object-fit: contain; }

/* Competitor Result Sections */
.competitor-result-box { margin-top: 16px; border: 1px solid rgba(245, 158, 11, 0.2); border-radius: 12px; padding: 16px; background: rgba(245, 158, 11, 0.02); }
.competitor-result-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.competitor-result-section:last-of-type { border-bottom: none; margin-bottom: 12px; padding-bottom: 0; }
.competitor-result-section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.competitor-result-section-header h4 { font-size: 13px; font-weight: 700; color: #f3f4f6; margin: 0; }
.competitor-extracted-text { background: rgba(14, 165, 233, 0.05); padding: 12px; border-radius: 8px; border: 1px solid rgba(14, 165, 233, 0.15); font-size: 12px; color: #93c5fd; line-height: 1.8; white-space: pre-line; direction: rtl; }
.competitor-summary { font-size: 12px; color: #d1d5db; line-height: 1.7; margin: 0 0 10px; }
.competitor-list-group { margin-bottom: 10px; }
.competitor-list-group h5 { font-size: 11px; font-weight: 700; color: #9ca3af; margin: 0 0 6px; }
.competitor-list-group ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.competitor-list-group li { font-size: 12px; padding: 6px 10px; border-radius: 6px; line-height: 1.5; }
.strength-item { background: rgba(74, 222, 128, 0.06); color: #86efac; border: 1px solid rgba(74, 222, 128, 0.12); }
.weakness-item { background: rgba(248, 113, 113, 0.06); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.12); }
.missing-item { background: rgba(245, 158, 11, 0.06); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.12); }
.competitor-meta { font-size: 11px; color: #9ca3af; margin: 4px 0; }
.competitor-meta strong { color: #d1d5db; }

.competitor-scores-grid { display: grid; gap: 8px; }
.competitor-score-item { display: grid; grid-template-columns: 90px 1fr 45px; align-items: center; gap: 8px; }
.competitor-score-label { font-size: 11px; color: #9ca3af; font-weight: 600; }
.competitor-score-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.competitor-score-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.competitor-score-val { font-size: 11px; font-weight: 800; text-align: center; }

.competitor-tips-list { padding: 0 16px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.competitor-tips-list li { font-size: 12px; color: #d1d5db; line-height: 1.6; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.competitor-tips-list li:last-child { border-bottom: none; }

.competitor-better-text { background: rgba(74, 222, 128, 0.05); padding: 12px; border-radius: 8px; border: 1px solid rgba(74, 222, 128, 0.15); font-size: 13px; color: #86efac; line-height: 1.8; white-space: pre-line; direction: rtl; }

/* Video Segments Results */
.video-segments-results { margin-top: 16px; border: 1px solid var(--color-studio-border); border-radius: 12px; padding: 16px; background: rgba(0, 135, 81, 0.03); }
.video-segments-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.video-segment-card { background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 10px; padding: 12px; }
.video-segment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.video-segment-badge { font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 9999px; background: rgba(0, 135, 81, 0.15); color: #86efac; border: 1px solid rgba(0, 135, 81, 0.3); }
.video-segment-time { font-size: 10px; color: #6b7280; font-family: monospace; }
.video-segment-text { font-size: 12px; color: #d1d5db; line-height: 1.7; margin-bottom: 8px; }
.video-segment-actions { display: flex; gap: 6px; }

/* Multi-Variant Results */
.variant-header { margin-bottom: 16px; margin-top: 8px; }
.variants-grid { display: flex; flex-direction: column; gap: 12px; }
.variant-card { background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 12px; padding: 14px; transition: border-color 0.2s; }
.variant-card:hover { border-color: rgba(0, 135, 81, 0.4); }
.variant-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.variant-badge { font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 9999px; }
.variant-badge-short { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.variant-badge-medium { background: rgba(14, 116, 144, 0.15); color: #22d3ee; border: 1px solid rgba(14, 116, 144, 0.3); }
.variant-badge-long { background: rgba(0, 135, 81, 0.15); color: #86efac; border: 1px solid rgba(0, 135, 81, 0.3); }
.variant-duration { font-size: 10px; color: #6b7280; }
.variant-text { font-size: 12px; color: #d1d5db; line-height: 1.7; white-space: pre-line; margin-bottom: 10px; }
.btn-use-variant { font-size: 11px; font-weight: 600; color: #86efac; background: rgba(0, 135, 81, 0.08); border: 1px solid rgba(0, 135, 81, 0.2); padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); }
.btn-use-variant:hover { background: rgba(0, 135, 81, 0.15); }

/* Quality Score */
.score-header { margin-bottom: 16px; }
.score-display { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.score-circle { width: 80px; height: 80px; border-radius: 50%; border: 4px solid var(--color-studio-border); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; transition: border-color 0.3s; }
.score-circle.score-low { border-color: #ef4444; }
.score-circle.score-mid { border-color: #f59e0b; }
.score-circle.score-high { border-color: #10b981; }
.score-number { font-size: 24px; font-weight: 900; color: white; }
.score-label { font-size: 11px; color: #6b7280; }
.score-details { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.score-detail-item { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: #9ca3af; }
.score-detail-bar { width: 60px; height: 4px; background: var(--color-studio-dark); border-radius: 4px; overflow: hidden; }
.score-detail-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.score-tips { background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 10px; padding: 12px; }
.score-tip-item { font-size: 11px; color: #d1d5db; padding: 6px 0; border-bottom: 1px solid rgba(30, 37, 53, 0.4); display: flex; align-items: flex-start; gap: 6px; direction: rtl; }
.score-tip-item:last-child { border-bottom: none; }
.score-tip-icon { color: #fbbf24; flex-shrink: 0; margin-top: 1px; }

/* Segments */
.segments-section { margin-bottom: 16px; }
.segments-header { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #d1d5db; margin-bottom: 10px; }
.segments-list { display: flex; flex-direction: column; gap: 6px; }
.segment-item { background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 8px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.segment-text { font-size: 11px; color: #d1d5db; flex: 1; text-align: right; }
.segment-number { width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 135, 81, 0.15); color: #86efac; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.segment-pause { font-size: 9px; color: #6b7280; background: var(--color-studio-dark); padding: 2px 6px; border-radius: 4px; }

/* TTS Buttons Row */
.tts-buttons-row { display: flex; gap: 10px; }
.tts-buttons-row .btn-secondary { flex: 1; }
.btn-preview { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px 16px; border-radius: 12px; font-size: 12px; font-weight: 700; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.6); color: #d1d5db; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); white-space: nowrap; }
.btn-preview:hover { border-color: var(--color-algeria-green); color: #86efac; }
.btn-preview:disabled { opacity: 0.4; cursor: not-allowed; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* ============================================================
   ElevenLabs Specific Styles
   ============================================================ */

.elevenlabs-card { border-color: rgba(155, 89, 182, 0.2); }
.elevenlabs-flag-bar { background: linear-gradient(to left, var(--color-elevenlabs), var(--color-elevenlabs-light), var(--color-elevenlabs-dark)) !important; }
.elevenlabs-title { color: white; }

.elevenlabs-settings-btn { border-color: rgba(155, 89, 182, 0.3) !important; color: var(--color-elevenlabs-light) !important; }
.elevenlabs-settings-btn:hover { border-color: var(--color-elevenlabs) !important; background: rgba(155, 89, 182, 0.1) !important; }

.elevenlabs-modal-header { border-bottom-color: rgba(155, 89, 182, 0.2); }
.elevenlabs-modal-header h2 { color: var(--color-elevenlabs-light); }

.elevenlabs-info { border-color: rgba(155, 89, 182, 0.2); }
.elevenlabs-info span { color: var(--color-elevenlabs-light) !important; }

.elevenlabs-save-btn { background: var(--color-elevenlabs) !important; }
.elevenlabs-save-btn:hover { background: var(--color-elevenlabs-dark) !important; }

.elevenlabs-status-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 8px; font-size: 12px; color: #9ca3af; }

.elevenlabs-badge { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 9999px; }
.elevenlabs-badge-active { background: rgba(155, 89, 182, 0.15); color: var(--color-elevenlabs-light); border: 1px solid rgba(155, 89, 182, 0.3); }
.elevenlabs-badge-inactive { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }

.elevenlabs-status-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding: 10px 14px; background: rgba(155, 89, 182, 0.04); border: 1px solid rgba(155, 89, 182, 0.15); border-radius: 10px; }
.elevenlabs-status-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #d1d5db; }
.elevenlabs-configure-btn { border-color: rgba(155, 89, 182, 0.3) !important; color: var(--color-elevenlabs-light) !important; }
.elevenlabs-configure-btn:hover { background: rgba(155, 89, 182, 0.1) !important; }

.elevenlabs-section { margin-bottom: 16px; }

.elevenlabs-upload:hover, .elevenlabs-upload.drag-over { border-color: var(--color-elevenlabs) !important; background: rgba(155, 89, 182, 0.05) !important; }

.elevenlabs-file-info { font-size: 12px; color: var(--color-elevenlabs-light); font-weight: 600; padding: 8px 14px; background: rgba(155, 89, 182, 0.08); border: 1px solid rgba(155, 89, 182, 0.2); border-radius: 8px; width: 100%; text-align: center; }

.elevenlabs-preview-audio { width: 100%; max-width: 400px; height: 40px; border-radius: 8px; }

.elevenlabs-select { width: 100%; background: rgba(11, 13, 18, 0.7); border: 1px solid rgba(155, 89, 182, 0.2); border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #f3f4f6; font-family: var(--font-main); direction: rtl; cursor: pointer; transition: border-color 0.2s; }
.elevenlabs-select:focus { outline: none; border-color: var(--color-elevenlabs); box-shadow: 0 0 0 2px rgba(155, 89, 182, 0.15); }
.elevenlabs-select option { background: var(--color-studio-dark); color: #f3f4f6; }

.elevenlabs-generate-btn { background: linear-gradient(to left, var(--color-elevenlabs), var(--color-elevenlabs-dark)) !important; box-shadow: 0 4px 16px rgba(155, 89, 182, 0.25) !important; }
.elevenlabs-generate-btn:hover { box-shadow: 0 6px 24px rgba(155, 89, 182, 0.35) !important; }

.elevenlabs-progress { margin-bottom: 16px; }
.elevenlabs-progress-bar { width: 100%; height: 6px; background: rgba(11, 13, 18, 0.7); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.elevenlabs-progress-fill { height: 100%; background: linear-gradient(to left, var(--color-elevenlabs), var(--color-elevenlabs-light)); border-radius: 4px; transition: width 0.4s ease; width: 0%; }
.elevenlabs-progress-text { font-size: 11px; color: var(--color-elevenlabs-light); text-align: center; font-weight: 600; }

.elevenlabs-result { margin-top: 16px; border: 1px solid rgba(155, 89, 182, 0.2); border-radius: 12px; padding: 16px; background: rgba(155, 89, 182, 0.04); }
.elevenlabs-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.elevenlabs-result-header h4 { font-size: 13px; font-weight: 800; color: var(--color-elevenlabs-light); }
.elevenlabs-result-audio { width: 100%; height: 44px; border-radius: 8px; }
.elevenlabs-download-btn { border-color: rgba(155, 89, 182, 0.3) !important; color: var(--color-elevenlabs-light) !important; background: rgba(155, 89, 182, 0.08) !important; }
.elevenlabs-download-btn:hover { background: rgba(155, 89, 182, 0.15) !important; color: white !important; }

/* ============================================================
   ElevenLabs Quota Widget
   ============================================================ */

.el-quota-widget {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(155, 89, 182, 0.04);
  border: 1px solid rgba(155, 89, 182, 0.15);
  border-radius: 10px;
}

.quota-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quota-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-elevenlabs-light);
}

.quota-counter {
  font-size: 11px;
  font-weight: 700;
  color: #d1d5db;
  font-family: monospace;
  direction: ltr;
}

.quota-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(11, 13, 18, 0.7);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.quota-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s;
  min-width: 2px;
}

.quota-bar-fill.quota-safe {
  background: linear-gradient(to left, #10b981, #34d399);
}

.quota-bar-fill.quota-warning {
  background: linear-gradient(to left, #f59e0b, #fbbf24);
}

.quota-bar-fill.quota-danger {
  background: linear-gradient(to left, #ef4444, #f87171);
}

.quota-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.quota-remaining, .quota-reset {
  font-size: 10px;
  color: #9ca3af;
}

.quota-remaining strong, .quota-reset strong {
  color: #d1d5db;
}

.quota-pct {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  font-family: monospace;
}

.quota-pct.quota-safe {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
}

.quota-pct.quota-warning {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
}

.quota-pct.quota-danger {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

/* Quota Toast Notification */
.quota-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  max-width: 480px;
  width: calc(100% - 32px);
  padding: 14px 16px;
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  z-index: 1300;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-main);
  direction: rtl;
}

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

.quota-toast-error {
  background: rgba(127, 29, 29, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.quota-toast-warning {
  background: rgba(120, 53, 15, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.quota-toast-info {
  background: rgba(55, 48, 107, 0.95);
  border: 1px solid rgba(155, 89, 182, 0.4);
}

.quota-toast-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #f3f4f6;
  line-height: 1.6;
  flex: 1;
}

.quota-toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.quota-toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.quota-toast-close:hover {
  color: white;
}

/* ============================================================
   Dialogue System Styles
   ============================================================ */

.dialogue-card { border-color: rgba(14, 165, 233, 0.2); }
.dialogue-flag-bar { background: linear-gradient(to left, #0ea5e9, #38bdf8, #0284c7) !important; }
.dialogue-title { color: white; }
.icon-dialogue { color: #38bdf8; }

.dialogue-section { margin-bottom: 16px; }

.dialogue-upload-zone { border: 2px dashed rgba(14, 165, 233, 0.2); border-radius: 12px; padding: 20px; cursor: pointer; transition: all 0.2s; text-align: center; }
.dialogue-upload-zone:hover, .dialogue-upload-zone.dragover { border-color: rgba(14, 165, 233, 0.5); background: rgba(14, 165, 233, 0.03); }
.dialogue-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dialogue-upload-placeholder p { font-size: 13px; font-weight: 700; color: #38bdf8; margin: 0; }
.dialogue-upload-placeholder span { font-size: 11px; color: #6b7280; }
.dialogue-upload-preview { position: relative; display: flex; justify-content: center; }
.dialogue-preview-media { max-width: 100%; max-height: 200px; border-radius: 8px; object-fit: contain; }
.dialogue-remove-file { position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(239, 68, 68, 0.9); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.dialogue-remove-file:hover { transform: scale(1.1); }

.dialogue-generate-btn { background: linear-gradient(to left, #0ea5e9, #0284c7) !important; box-shadow: 0 4px 16px rgba(14, 165, 233, 0.25) !important; }
.dialogue-generate-btn:hover { box-shadow: 0 6px 24px rgba(14, 165, 233, 0.35) !important; }

.dialogue-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .dialogue-type-grid { grid-template-columns: 1fr; } }

.dialogue-voices-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .dialogue-voices-row { grid-template-columns: 1fr; } }

.dialogue-voice-pick { display: flex; flex-direction: column; gap: 6px; }
.dialogue-voice-label { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; text-align: center; }
.dialogue-voice-male { background: rgba(14, 165, 233, 0.1); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.2); }
.dialogue-voice-female { background: rgba(236, 72, 153, 0.1); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.2); }

.dialogue-select { width: 100%; background: rgba(11, 13, 18, 0.7); border: 1px solid var(--color-studio-border); border-radius: 10px; padding: 10px 14px; font-size: 12px; color: #f3f4f6; font-family: var(--font-main); direction: rtl; cursor: pointer; }
.dialogue-select:focus { outline: none; border-color: #0ea5e9; }

.dialogue-progress { margin: 16px 0; }
.dialogue-progress-bar { width: 100%; height: 6px; background: rgba(11, 13, 18, 0.7); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.dialogue-progress-fill { height: 100%; background: linear-gradient(to left, #0ea5e9, #38bdf8); border-radius: 4px; transition: width 0.4s ease; width: 0%; }
.dialogue-progress-text { font-size: 11px; color: #38bdf8; text-align: center; font-weight: 600; }

.dialogue-result { margin-top: 16px; border: 1px solid rgba(14, 165, 233, 0.2); border-radius: 12px; padding: 16px; background: rgba(14, 165, 233, 0.03); }
.dialogue-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialogue-result-header h4 { font-size: 13px; font-weight: 800; color: #38bdf8; }

.dialogue-badge { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 9999px; background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }

.dialogue-script-box { display: flex; flex-direction: column; gap: 8px; }
.dialogue-line { padding: 10px 14px; border-radius: 10px; font-size: 12px; line-height: 1.7; }
.dialogue-line-male { background: rgba(14, 165, 233, 0.08); border: 1px solid rgba(14, 165, 233, 0.15); }
.dialogue-line-female { background: rgba(236, 72, 153, 0.08); border: 1px solid rgba(236, 72, 153, 0.15); }
.dialogue-speaker { font-weight: 800; margin-left: 8px; }
.dialogue-line-male .dialogue-speaker { color: #38bdf8; }
.dialogue-line-female .dialogue-speaker { color: #f472b6; }
.dialogue-text { color: #e5e7eb; }

.dialogue-audio-result { margin-top: 16px; border: 1px solid rgba(14, 165, 233, 0.2); border-radius: 12px; padding: 16px; background: rgba(14, 165, 233, 0.03); }
.dialogue-audio-player { width: 100%; height: 44px; border-radius: 8px; margin-bottom: 12px; }
.dialogue-download-btn { border-color: rgba(14, 165, 233, 0.3) !important; color: #38bdf8 !important; background: rgba(14, 165, 233, 0.08) !important; }
.dialogue-download-btn:hover { background: rgba(14, 165, 233, 0.15) !important; color: white !important; }

.dialogue-edit-hint { font-size: 11px; color: #6b7280; margin-bottom: 10px; padding: 6px 10px; background: rgba(14, 165, 233, 0.05); border-radius: 6px; border: 1px dashed rgba(14, 165, 233, 0.15); }

.dialogue-line-editable { border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.dialogue-line-editable.dialogue-line-male { background: rgba(14, 165, 233, 0.06); border: 1px solid rgba(14, 165, 233, 0.15); }
.dialogue-line-editable.dialogue-line-female { background: rgba(236, 72, 153, 0.06); border: 1px solid rgba(236, 72, 153, 0.15); }

.dialogue-line-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dialogue-line-order { display: flex; align-items: center; gap: 3px; margin-left: 8px; }
.dialogue-line-num { width: 22px; height: 22px; border-radius: 50%; background: rgba(14, 165, 233, 0.12); color: #38bdf8; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(14, 165, 233, 0.25); }
.dialogue-line-female .dialogue-line-num { background: rgba(236, 72, 153, 0.12); color: #f472b6; border-color: rgba(236, 72, 153, 0.25); }
.dialogue-move-up-btn, .dialogue-move-down-btn { width: 22px; height: 22px; }
.dialogue-move-up-btn:disabled, .dialogue-move-down-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.dialogue-move-up-btn:not(:disabled):hover { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.dialogue-move-down-btn:not(:disabled):hover { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.dialogue-line-actions { display: flex; gap: 4px; }
.dialogue-line-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.6); color: #9ca3af; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.dialogue-line-btn:hover { color: white; border-color: #4b5563; }
.dialogue-switch-btn:hover { color: #38bdf8; border-color: rgba(14, 165, 233, 0.4); }
.dialogue-delete-btn:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.4); }

.dialogue-edit-textarea { width: 100%; background: rgba(11, 13, 18, 0.5); border: 1px solid var(--color-studio-border); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #f3f4f6; font-family: var(--font-main); line-height: 1.6; resize: vertical; direction: rtl; min-height: 40px; }
.dialogue-edit-textarea:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.12); }

.dialogue-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
@media (max-width: 480px) { .dialogue-add-row { grid-template-columns: 1fr; } }
.dialogue-add-btn { padding: 10px; border-radius: 10px; font-size: 12px; font-weight: 700; border: 2px dashed; cursor: pointer; transition: all 0.2s; font-family: var(--font-main); display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; }
.dialogue-add-male { border-color: rgba(14, 165, 233, 0.25); color: #38bdf8; }
.dialogue-add-male:hover { background: rgba(14, 165, 233, 0.08); border-color: rgba(14, 165, 233, 0.5); }
.dialogue-add-female { border-color: rgba(236, 72, 153, 0.25); color: #f472b6; }
.dialogue-add-female:hover { background: rgba(236, 72, 153, 0.08); border-color: rgba(236, 72, 153, 0.5); }

.dialogue-audio-btn { margin-top: 12px; }

.dialogue-speed-section { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 8px 12px; background: rgba(11, 13, 18, 0.5); border-radius: 8px; border: 1px solid var(--color-studio-border); }
.dialogue-speed-label { font-size: 11px; color: #9ca3af; font-weight: 600; }
.dialogue-speed-buttons { display: flex; flex-wrap: wrap; gap: 4px; }

/* ============================================================
   A/B Testing Styles
   ============================================================ */

.abtest-card { border-color: rgba(245, 158, 11, 0.2); }
.abtest-flag-bar { background: linear-gradient(to left, #f59e0b, #fbbf24, #d97706) !important; }
.abtest-title { color: white; }
.icon-abtest { color: #fbbf24; }

.abtest-section { margin-bottom: 16px; }

.abtest-generate-btn { background: linear-gradient(to left, #f59e0b, #d97706) !important; box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25) !important; }
.abtest-generate-btn:hover { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.35) !important; }

.abtest-progress { margin: 16px 0; }

.abtest-results { margin-top: 16px; }
.abtest-results-header { margin-bottom: 16px; }
.abtest-results-header h4 { font-size: 14px; font-weight: 800; color: #fbbf24; margin-bottom: 4px; }

.abtest-hooks-grid { display: flex; flex-direction: column; gap: 14px; }

.abtest-hook-card { border-radius: 12px; padding: 16px; border: 1px solid var(--color-studio-border); background: rgba(11, 13, 18, 0.5); transition: border-color 0.2s; }
.abtest-hook-card:hover { border-color: rgba(245, 158, 11, 0.3); }

.abtest-hook-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.abtest-hook-badge { font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 9999px; }
.abtest-badge-curiosity { background: rgba(14, 165, 233, 0.12); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.25); }
.abtest-badge-shock { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }
.abtest-badge-solution { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }

.abtest-hook-strategy { font-size: 10px; color: #6b7280; }

.abtest-hook-text { font-size: 14px; font-weight: 600; color: #f3f4f6; line-height: 1.8; padding: 10px 14px; background: rgba(11, 13, 18, 0.6); border-radius: 8px; border: 1px solid var(--color-studio-border); margin-bottom: 10px; direction: rtl; min-height: 40px; }

.abtest-hook-audio { margin-bottom: 10px; }
.abtest-audio { width: 100%; height: 40px; border-radius: 8px; }

.abtest-hook-actions { display: flex; gap: 8px; }

/* ============================================================
   Hamiz.net Header & Sidebar
   ============================================================ */

.hamiz-header { background-color: var(--hamiz-primary); padding: 0.5rem 0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); position: fixed; width: 100%; top: 0; z-index: 1000; height: var(--hamiz-header-height); }
.hamiz-header-content { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; max-width: 1280px; margin: 0 auto; height: 100%; }
.hamiz-header-content > div { display: flex; align-items: center; gap: 1rem; }
.hamiz-header-title { color: white; font-size: 1.4rem; font-weight: 800; margin: 0; font-family: var(--font-main); }
.hamiz-header-right { display: flex; align-items: center; gap: 10px; }
.hamiz-settings-btn { background: rgba(255,255,255,0.1); border: none; color: white; font-size: 1.1rem; cursor: pointer; padding: 8px 10px; border-radius: 8px; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.hamiz-settings-btn:hover { background: rgba(255,255,255,0.2); }
@media (min-width: 1200px) { .hamiz-settings-btn { display: none; } }
.hamiz-logo { display: flex; align-items: center; }
.hamiz-logo img { height: 45px; width: auto; }
.hamiz-menu-toggle { background: rgba(255,255,255,0.1); border: none; color: white; font-size: 1.3rem; cursor: pointer; padding: 8px 10px; border-radius: 8px; transition: background 0.2s; }
.hamiz-menu-toggle:hover { background: rgba(255,255,255,0.2); }

.hamiz-side-menu { position: fixed; right: -100%; top: 0; width: 280px; height: 100vh; height: 100dvh; background-color: #0f1319; box-shadow: -4px 0 32px rgba(0, 0, 0, 0.7); transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1100; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; }
.hamiz-side-menu.active { right: 0; }
.hamiz-menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-studio-border); flex-shrink: 0; }
.hamiz-menu-header h3 { font-size: 18px; font-weight: 800; color: white; margin: 0; }
.hamiz-menu-items { list-style: none; padding: 0; margin: 0; }
.hamiz-menu-item { margin-bottom: 2px; }
.hamiz-menu-link { display: flex; align-items: center; padding: 14px 14px; color: #e5e7eb; text-decoration: none; transition: all 0.2s; border-radius: 12px; font-size: 14px; font-weight: 600; font-family: var(--font-main); gap: 12px; min-height: 48px; }
.hamiz-menu-link:hover { background: rgba(0, 135, 81, 0.15); color: #86efac; }
.hamiz-menu-link:active { background: rgba(0, 135, 81, 0.25); transform: scale(0.98); }
.hamiz-menu-link i { width: 20px; text-align: center; color: #4ade80; font-size: 16px; }
.hamiz-submenu { list-style: none; margin: 4px 20px 0 0; padding: 8px 0; display: none; border-right: 2px solid rgba(0, 135, 81, 0.3); }
.hamiz-submenu.active { display: block; }
.hamiz-submenu .hamiz-menu-link { font-size: 13px; padding: 12px 14px; min-height: 42px; }
.hamiz-menu-close { background: #dc2626; border: none; color: white; font-size: 1.1rem; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3); }
.hamiz-menu-close:hover { background: #ef4444; transform: scale(1.1); }
.hamiz-notification { position: fixed; top: calc(var(--hamiz-header-height) + 16px); right: 16px; padding: 12px 20px; background: linear-gradient(135deg, var(--hamiz-primary), var(--color-algeria-green)); color: white; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1200; font-size: 13px; font-weight: 700; font-family: var(--font-main); }
.hamiz-notification.show { transform: translateX(0); }
.hamiz-side-menu::before { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: -1; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.hamiz-side-menu.active::before { opacity: 1; pointer-events: auto; }

/* ============================================================
   Mobile Responsive
   ============================================================ */

@media (max-width: 768px) {
  :root { --hamiz-header-height: 56px; }
  .hamiz-header-title { font-size: 1.05rem; }
  .hamiz-logo img { height: 30px; }
  .hamiz-header-content { padding: 0 10px; }
  .hamiz-header-content > div { gap: 8px; }
  .hamiz-side-menu { width: 82%; max-width: 300px; }
  .hamiz-menu-toggle { padding: 10px; font-size: 1.2rem; border-radius: 10px; }
  .bg-glow-green { width: 160px; height: 160px; left: 5%; opacity: 0.6; }
  .bg-glow-red { width: 140px; height: 140px; opacity: 0.5; }
  .main-content { padding: 12px; }
  .card { padding: 16px 14px; border-radius: 16px; }
  .section-nav { padding: 0 12px; gap: 6px; margin-top: 12px; }
  .nav-btn { padding: 9px 12px; font-size: 11px; }
  .nav-btn span { display: none; }
  .nav-btn svg { width: 18px; height: 18px; }
  .options-grid { gap: 14px; margin-bottom: 16px; }
  .option-buttons { grid-template-columns: 1fr 1fr; gap: 8px; }
  textarea { font-size: 14px; padding: 14px; }
  #inputText { height: 160px; }
  .btn-primary, .btn-secondary { font-size: 14px; padding: 16px; border-radius: 14px; min-height: 52px; }
  .tts-buttons-row { flex-direction: column; gap: 10px; }
  .voice-grid-inner { grid-template-columns: 1fr; gap: 8px; }
  .media-type-toggle { gap: 6px; }
  .media-type-btn { padding: 10px; font-size: 12px; }
  .upload-type-buttons { grid-template-columns: 1fr 1fr !important; }
  .results-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .result-actions { flex-direction: column; }
  .btn-action { width: 100%; justify-content: center; }
  .player-controls { flex-direction: column; align-items: center; gap: 12px; }
  .btn-play { width: 50px; height: 50px; }
  .download-buttons { width: 100%; gap: 8px; justify-content: center; }
  .speed-controls { flex-direction: column; gap: 8px; align-items: stretch; }
  .score-display { flex-direction: column; align-items: center; gap: 16px; }
  .footer { padding: 24px 14px; margin-top: 24px; }
  .elevenlabs-status-bar { flex-direction: column; gap: 10px; align-items: stretch; }
}

@media (max-width: 420px) {
  :root { --hamiz-header-height: 52px; }
  .hamiz-header-title { font-size: 0.9rem; }
  .hamiz-logo img { height: 26px; }
  .main-content { padding: 8px; }
  .card { padding: 14px 12px; }
  .option-buttons { grid-template-columns: 1fr; gap: 6px; }
  .upload-type-buttons { grid-template-columns: 1fr !important; }
  .download-buttons { flex-direction: column; }
  .btn-download { width: 100%; }
}

@media (pointer: coarse) {
  .opt-btn, .voice-btn, .nav-btn, .btn-primary, .btn-secondary, .btn-preview, .btn-download, .speed-btn, .btn-chat-send, .hamiz-menu-link, .btn-use-variant, .btn-action, .media-type-btn {
    -webkit-tap-highlight-color: transparent;
  }
  .opt-btn:active, .voice-btn:active, .nav-btn:active, .btn-primary:active, .btn-secondary:active, .media-type-btn:active {
    transform: scale(0.97);
    transition: transform 0.1s;
  }
}
