:root {
  /* Logo Theme Colors */
  --bg-color: #0e191d;          /* Deepest background from logo dark teal */
  --card-bg: rgba(43, 90, 108, 0.22); /* Translucent teal card bg from logo background */
  --border-color: rgba(212, 136, 114, 0.18); /* Warm copper tinted border */
  --text-primary: #f0f7f9;      /* Light tealish white text */
  --text-secondary: #8da6af;    /* Slate-teal secondary text */
  
  --primary: #d48872;           /* Main copper logo color */
  --primary-glow: rgba(212, 136, 114, 0.35);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.4);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.4);
  
  --font-family: 'Inter', 'Cairo', sans-serif;
  --font-display: 'Outfit', 'Cairo', sans-serif;
  --border-radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(43, 90, 108, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 136, 114, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* App Container Layout */
.app-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.logo-area {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 54px;
  border-radius: 8px;
  display: block;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Language selector */
.lang-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn.active {
  background: var(--primary);
  color: #1a0f0b;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-secondary);
}

.status-badge.recording {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.status-badge.recording .pulse-dot {
  background-color: var(--danger);
  animation: pulse 1.5s infinite;
}

.status-badge.paused {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.status-badge.paused .pulse-dot {
  background-color: var(--warning);
}

/* Main Content Grid */
.app-main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  flex: 1;
}

@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Common Card style */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Left Sidebar setup styles */
.config-sidebar h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.config-section h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.step-num {
  background: var(--primary);
  color: #1a0f0b;
  font-size: 0.8rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
}

/* Form inputs styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  background-color: rgba(10, 20, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Audio Visualizer representation */
.mic-visualizer-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 20, 25, 0.4);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.visualizer-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  width: 140px;
}

.vis-bar {
  width: 4px;
  height: 10%;
  background: var(--primary);
  border-radius: 2px;
  transition: height 0.05s ease;
  min-height: 2px;
}

.mic-status-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Logo Preview and Upload Layout */
.logo-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(10, 20, 25, 0.4);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 10px;
  min-height: 64px;
}

.logo-preview-box img {
  max-height: 48px;
  max-width: 130px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-preview-box.empty {
  border-style: dashed;
}

.empty-placeholder {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.btn-group-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Layout settings grid */
.layout-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.form-group-half {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-half label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Range input/sliders styling */
.range-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

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

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-value {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 32px;
  text-align: right;
}

/* Right Main Workspace Canvas / Preview styling */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preview-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.info-tip {
  font-size: 0.8rem;
  background: rgba(212, 136, 114, 0.1);
  color: var(--primary);
  border: 1px solid rgba(212, 136, 114, 0.2);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: help;
}

/* Live canvas styling */
.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(14, 25, 29, 0.45); /* Semi-transparent so mockup shows underneath */
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
  text-align: center;
  transition: var(--transition);
}

.prompt-content {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: rgba(14, 25, 29, 0.88); /* Opaque background card for text readability */
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.icon-monitor {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

.prompt-content h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.prompt-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  text-decoration: none;
  gap: 8px;
}

.btn-xs {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #b35e46);
  color: #1a0f0b;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--success-glow);
}

.btn-success:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--danger-glow);
}

.btn-danger-link {
  background: transparent;
  color: var(--danger);
  padding: 2px 4px;
}

.btn-danger-link:hover {
  text-decoration: underline;
}

/* Controls bottom bar layout */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(10, 20, 25, 0.4);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.rec-timer {
  margin-left: auto;
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  letter-spacing: 1px;
}

/* Modal Overlay Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0e191d;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.video-preview-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.video-preview-container video {
  width: 100%;
  height: 100%;
  display: block;
}

.input-with-addon {
  display: flex;
  align-items: center;
}

.input-with-addon .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-addon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-left: none;
  padding: 10px 14px;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* RTL OVERRIDES FOR ARABIC */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .header-controls {
  flex-direction: row-reverse;
}

[dir="rtl"] .status-badge {
  flex-direction: row-reverse;
}

[dir="rtl"] .config-section h3 {
  gap: 12px;
}

[dir="rtl"] .step-num {
  font-family: inherit;
}

[dir="rtl"] .range-value {
  text-align: left;
}

[dir="rtl"] .rec-timer {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .controls-bar button {
  margin-right: 0;
}

[dir="rtl"] .input-with-addon .form-control {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

[dir="rtl"] .input-addon {
  border-left: 1px solid var(--border-color);
  border-right: none;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

[dir="rtl"] .modal-footer {
  justify-content: flex-start;
  flex-direction: row-reverse;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button select {
  flex: 1;
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border-radius: 8px;
  flex-shrink: 0;
}

.btn-icon.muted {
  background: var(--danger-glow);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}
