/**
 * llmreview.ai Teleprompter - Styles
 * Author: Sundar Ramesh Kumar
 */

/* CSS Variables */
:root {
  --brand-primary: #1e40af;
  --brand-secondary: #3730a3;
  --brand-accent: #10b981;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand .back-link {
  font-size: 0.875rem;
  color: var(--brand-primary);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  transition: var(--transition);
  font-weight: 500;
}

.brand .back-link:hover {
  background: var(--bg-tertiary);
  color: var(--brand-secondary);
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--brand-primary);
  display: inline-block;
  margin-right: 0.5rem;
}

.brand .version {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.session-info {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.session-info span {
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

#session-status {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

#connection-status {
  transition: var(--transition);
}

#connection-status.connected {
  background: #d1fae5;
  color: #065f46;
}

#connection-status.disconnected {
  background: #fee2e2;
  color: #991b1b;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
}

/* Panels */
.panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-panel {
  flex: 0 0 30%;
}

.center-panel {
  flex: 0 0 40%;
}

.right-panel {
  flex: 0 0 30%;
}

.panel-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.panel-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

/* Script Input Panel */
.script-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.script-title-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.script-title-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.script-textarea {
  width: 100%;
  min-height: 300px;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  resize: vertical;
  transition: var(--transition);
}

.script-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.script-metadata {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.format-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.format-options label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.format-options select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

/* Teleprompter Panel */
.teleprompter-indicators {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.teleprompter-container {
  position: relative;
  padding: 0;
}

.teleprompter-content {
  height: calc(100vh - 300px);
  overflow-y: auto;
  padding: 3rem 4rem;
  font-size: 28px;
  line-height: 2;
  scroll-behavior: smooth;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 1) 5%,
    rgba(255, 255, 255, 1) 95%,
    rgba(255, 255, 255, 0) 100%
  );
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.teleprompter-content.mirrored {
  transform: scaleX(-1);
}

.teleprompter-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 4rem 2rem;
}

.teleprompter-placeholder p {
  margin: 0.5rem 0;
}

.teleprompter-content p {
  margin-bottom: 1.5rem;
}

.teleprompter-content strong {
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 1.1em;
}

/* Enhanced Rich formatting for teleprompter */
.speech-content {
  margin: 0 0 1.5rem 0;
  line-height: 2;
}

/* Section Headers with Emojis */
.section-header {
  margin: 2rem 0 1rem 0;
  font-weight: 800;
  color: var(--brand-primary);
  font-size: 1.2em;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--brand-accent);
}

/* Visual Cues */
.visual-cue {
  margin: 1rem 0;
  color: #6b7280;
  font-style: italic;
  background: rgba(107, 114, 128, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9em;
}

/* Pause and Breath Markers */
.pause-marker,
[data-content="[PAUSE]"],
[data-content="[breath]"] {
  color: #374151;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.8em;
  opacity: 0.6;
  display: block;
  margin: 1.5rem 0;
}

.pause-center {
  text-align: center;
  margin: 20px 0;
}

/* Emphasis and Stress Words */
.emphasis-text,
.teleprompter-content span.stress,
.teleprompter-content span.emphasis {
  color: #dc2626;
  font-weight: 700;
  font-style: italic;
  text-shadow: 0 0 1px rgba(220, 38, 38, 0.3);
}

.breath-marker {
  display: inline-block;
  color: var(--brand-primary);
  margin: 0 0.5rem;
  font-size: 0.8em;
  opacity: 0.6;
}

/* Highlighted Numbers and Important Phrases */
.teleprompter-content span.highlight,
.teleprompter-content span.keyword {
  background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(251, 191, 36, 0.2);
}

/* Additional emphasis levels for color variety */
.teleprompter-content span.emphasis-high {
  color: #dc2626;
  font-weight: 700;
  font-style: italic;
  text-shadow: 0 0 1px rgba(220, 38, 38, 0.3);
}

.teleprompter-content span.emphasis-medium {
  color: #ea580c;
  font-weight: 600;
  font-style: italic;
}

.teleprompter-content span.emphasis-low {
  color: #0369a1;
  font-weight: 600;
}

.section-break {
  border: 0;
  border-top: 2px dashed #e5e7eb;
  margin: 2rem 0;
  opacity: 0.5;
}

/* Timing Markers */
.timing-marker {
  display: inline-block;
  background: var(--brand-primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7em;
  margin-right: 0.5rem;
  font-weight: 600;
}

/* Section Emojis */
.section-emoji {
  font-size: 1.5em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Better readability for formatted content */
.teleprompter-content .formatted-line {
  display: block;
  margin: 0.3rem 0;
  padding: 0.2rem 0;
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--bg-tertiary);
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--brand-accent);
  transition: width 0.3s ease;
}

/* Preview Panel */
.preview-container {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.preview-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  opacity: 0.5;
}

.session-controls,
.statistics {
  margin-top: 1.5rem;
}

.session-controls h3,
.statistics h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.stat-item span:first-child {
  color: var(--text-secondary);
}

.stat-item span:last-child {
  font-weight: 500;
  color: var(--text-primary);
}

/* Recordings list */
.recordings-container .rec-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}
.recordings-container .rec-item a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recordings-container .rec-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
}
.recordings-container .rec-actions {
  display: flex;
  gap: 6px;
  margin-left: 10px;
}
.recordings-container .rec-actions button {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
  cursor: pointer;
}

/* Control Panel */
.control-panel {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
  padding: 1rem 2rem;
}

.controls-container {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.playback-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: var(--transition);
}

.control-btn:hover:not(:disabled) {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-btn .icon {
  font-size: 1.125rem;
}

.control-btn .label {
  font-size: 0.875rem;
  font-weight: 500;
}

.speed-control,
.font-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.speed-control label,
.font-control label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.speed-control input,
.font-control input {
  width: 120px;
}

.speed-control span,
.font-control span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 3rem;
}

.mode-controls {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-secondary);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 0.5rem;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

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

.modal-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.scripts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.script-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: var(--transition);
}

.script-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--brand-primary);
}

.script-item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.script-item-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#loading-message {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Range Input Styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--brand-primary);
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--brand-primary);
  border-radius: 50%;
  cursor: pointer;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    flex: 1;
  }

  .controls-container {
    flex-wrap: wrap;
  }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Remote */
.remote-panel {
  max-width: 720px;
  margin: 0 auto;
}
.remote-join {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.remote-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.remote-field input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  font-size: 16px;
  outline: none;
}
.remote-field input:focus {
  border-color: rgba(249, 115, 22, 0.7);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}
.remote-controls {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.remote-playback {
  display: flex;
  gap: 10px;
}
.remote-sliders {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.remote-sliders .speed-control,
.remote-sliders .font-control {
  width: 100%;
}

/* Remote share card (main teleprompter) */
.remote-share {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.75);
}
.remote-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.remote-share-actions {
  display: flex;
  gap: 10px;
}
.remote-qr {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.remote-qr canvas {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.remote-qr-caption {
  font-size: 13px;
  color: rgba(15, 23, 42, 0.7);
}

/* AI Coach */
.coach-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}
.coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.coach-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.coach-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: rgba(15, 23, 42, 0.85);
}
.coach-panel input[type="range"] {
  width: 100%;
}
.coach-hint {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
}
.teleprompter-content .current-line {
  outline: 2px solid rgba(249, 115, 22, 0.55);
  border-radius: 10px;
  padding: 4px 6px;
  background: rgba(249, 115, 22, 0.08);
}
.teleprompter-content span.filler-word {
  background: rgba(59, 130, 246, 0.12);
  border-radius: 6px;
  padding: 0 4px;
}
.teleprompter-content span.speaker-label {
  opacity: 0.75;
  font-weight: 700;
  margin-right: 6px;
}

/* Inline banner */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #0f172a;
}
.banner.banner-error {
  background: #fee2e2;
  color: #991b1b;
}
.banner.banner-success {
  background: #d1fae5;
  color: #065f46;
}
.banner.banner-info {
  background: #dbeafe;
  color: #1e3a8a;
}
.banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.banner-text {
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.banner-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.banner-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Recording indicator */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}
body.recording-active #record-dot {
  background: #ef4444 !important;
  animation: blink 1s infinite;
}

/* Additional inline styles moved to CSS */
.preview-video {
  width: 100%;
  max-height: 300px;
  background: #000;
  border-radius: 8px;
}

.recording-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.av-sync-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.av-sync-control label {
  font-size: 0.85rem;
  color: #374151;
  white-space: nowrap;
}

.av-sync-control input[type="range"] {
  flex: 1;
  min-width: 120px;
}

.av-sync-control span {
  font-size: 0.85rem;
  color: #111827;
  min-width: 54px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.recording-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #999;
  display: inline-block;
}

.recordings-list {
  margin-top: 1.25rem;
}

.recordings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

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

.recordings-header-title h3 {
  margin: 0;
}

.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.375rem;
  background: #e5e7eb;
  color: #374151;
}

.recordings-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.recordings-controls input,
.recordings-controls select {
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.recordings-controls input {
  min-width: 120px;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

.recordings-container-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-content-large {
  max-width: 820px;
}

.player-video {
  width: 100%;
  background: #000;
  border-radius: 8px;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}
