/* ============================================
   SpeakFlow App - Dark Theme Styles
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121a;
  --bg-surface: #1a1a24;
  --bg-hover: #22222e;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-glow: rgba(255, 107, 53, 0.15);
  --accent-dim: rgba(255, 107, 53, 0.08);
  --text-primary: #f0ece6;
  --text-secondary: #8a8694;
  --text-muted: #5a5666;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --sidebar-width: 240px;
  --topbar-height: 0px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.5px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  display: block;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-link.active .nav-icon {
  opacity: 1;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
}

.nav-separator {
  height: 1px;
  background: var(--border);
  margin: 8px 14px;
}

/* Nav sections with group labels */
.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 14px 3px;
  user-select: none;
}

.nav-link-logout {
  color: var(--text-muted);
}

.nav-link-logout:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
}

.sidebar-footer {
  padding: 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px;
}

#app-content {
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================================
   Auth Pages (Login/Register)
   ============================================ */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo span {
  color: var(--accent);
}

.auth-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.auth-card .form-group {
  margin-bottom: 18px;
}

.auth-card .form-actions {
  margin-top: 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Google Sign-In button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  text-decoration: none;
  color: #3c4043;
}

.btn-google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Divider between OAuth and email/password */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 4px;
  color: var(--text-muted, var(--text-secondary));
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.auth-divider span {
  padding: 0 12px;
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
}

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

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s ease;
}

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

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

.card-title {
  font-size: 16px;
  font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.2);
}

.btn-warning {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.btn-warning:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.22);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
}

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

.btn-icon {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
}

.btn-block {
  width: 100%;
}

/* ============================================
   Form Controls
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.form-input,
.form-select,
.form-textarea {
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a8694' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-draft {
  background: rgba(90, 86, 102, 0.2);
  color: var(--text-muted);
}

.badge-scheduled {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.badge-posted {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.badge-default {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-platform {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-linkedin {
  background: rgba(0, 119, 181, 0.15);
  color: #5bb5e8;
}

.badge-twitter {
  background: rgba(29, 161, 242, 0.12);
  color: #6ec8f5;
}

.badge-blog {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
}

.badge-newsletter {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.badge-custom {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-surface);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--bg-hover);
}

/* ============================================
   Recording Page
   ============================================ */
.record-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 0 40px;
  text-align: center;
}

.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #fff;
  transition: all 0.3s ease;
  position: relative;
}

.record-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px var(--accent-glow);
}

.record-btn.recording {
  animation: pulse-record 1.5s ease-in-out infinite;
  background: var(--danger);
}

@keyframes pulse-record {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  70% { box-shadow: 0 0 0 24px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}

.record-timer {
  font-family: 'Space Grotesk', monospace;
  font-size: 36px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 20px;
  letter-spacing: 2px;
}

.record-status {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Waveform Visualization */
.waveform-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  margin-top: 24px;
}

.waveform-viz .bar {
  width: 4px;
  border-radius: 4px;
  background: var(--accent);
  height: 10px;
  transition: height 0.15s ease;
}

.waveform-viz.active .bar {
  animation: waveform-bar 1.2s ease-in-out infinite;
}

@keyframes waveform-bar {
  0%, 100% { transform: scaleY(0.3); opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 1; }
}

.waveform-viz.recording-viz .bar {
  background: var(--danger);
}

/* Post-recording controls */
.recording-result {
  width: 100%;
  max-width: 500px;
  margin: 24px auto 0;
}

.recording-result audio {
  width: 100%;
  margin-bottom: 16px;
  border-radius: 8px;
}

.recording-result .form-group {
  margin-bottom: 16px;
}

.recording-result .btn-row {
  display: flex;
  gap: 10px;
}

.upload-area {
  margin-top: 20px;
  padding: 16px;
  border: 1px dashed var(--border-light);
  border-radius: 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-area:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
  background: var(--accent-dim);
}

.upload-area input[type="file"] {
  display: none;
}

/* Recordings list */
.recordings-list {
  margin-top: 40px;
}

.recordings-list h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

.recording-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color 0.2s ease;
}

.recording-item:hover {
  border-color: var(--border-light);
}

.recording-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.recording-item-info {
  flex: 1;
  min-width: 0;
}

.recording-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recording-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  gap: 12px;
}

.recording-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.transcript-preview {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 120px;
  overflow-y: auto;
}

/* ============================================
   Templates Page
   ============================================ */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.template-card:hover {
  border-color: var(--border-light);
}

.template-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.template-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.template-card-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.template-card-preview {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Template form */
.template-form {
  max-width: 600px;
}

.template-form .form-group {
  margin-bottom: 20px;
}

.template-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

/* ============================================
   Content Page
   ============================================ */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  width: fit-content;
}

.filter-tab {
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
}

.filter-tab:hover {
  color: var(--text-secondary);
}

.filter-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.content-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.content-card:hover {
  border-color: var(--border-light);
}

.content-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.content-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.content-card-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.content-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Content expanded/edit form */
.content-edit {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.content-edit .form-group {
  margin-bottom: 18px;
}

.content-edit .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ============================================
   Calendar Page
   ============================================ */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.calendar-month-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.calendar-view-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.calendar-view-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s ease;
}

.calendar-view-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.calendar-view-btn:hover {
  color: var(--text-secondary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.calendar-day-header {
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.calendar-day {
  min-height: 100px;
  padding: 8px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.15s ease;
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day:hover {
  background: var(--bg-hover);
}

.calendar-day.other-month {
  opacity: 0.3;
}

.calendar-day.today {
  background: var(--accent-dim);
}

.calendar-day-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.calendar-day.today .calendar-day-number {
  color: var(--accent);
  font-weight: 700;
}

.calendar-pill {
  display: block;
  padding: 3px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.calendar-pill:hover {
  opacity: 0.8;
}

.calendar-pill.draft {
  opacity: 0.4;
}

.calendar-pill.posted {
  opacity: 1;
}

.calendar-pill.scheduled {
  opacity: 0.85;
}

.calendar-pill-linkedin {
  background: rgba(0, 119, 181, 0.2);
  color: #5bb5e8;
}

.calendar-pill-twitter {
  background: rgba(29, 161, 242, 0.15);
  color: #6ec8f5;
}

.calendar-pill-blog {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.calendar-pill-newsletter {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.calendar-pill-custom {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ============================================
   Dashboard Page
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-card-icon {
  font-size: 24px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* CSS Bar Chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 180px;
  padding: 20px 0;
}

.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart-bar {
  width: 100%;
  max-width: 60px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
}

.bar-chart-bar.linkedin { background: #5bb5e8; }
.bar-chart-bar.twitter { background: #6ec8f5; }
.bar-chart-bar.blog { background: #c084fc; }
.bar-chart-bar.newsletter { background: var(--success); }
.bar-chart-bar.custom { background: var(--text-muted); }

.bar-chart-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
  text-align: center;
}

.bar-chart-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Recent Activity */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.activity-item:hover {
  background: var(--bg-hover);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-dot.linkedin { background: #5bb5e8; }
.activity-dot.twitter { background: #6ec8f5; }
.activity-dot.blog { background: #c084fc; }
.activity-dot.newsletter { background: var(--success); }
.activity-dot.custom { background: var(--text-muted); }

.activity-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-date {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modal-slide-up 0.2s ease;
}

@keyframes modal-slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal .form-group {
  margin-bottom: 20px;
}

.modal .form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ============================================
   Toast Notifications
   ============================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 380px;
}

.toast {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease;
  border: 1px solid;
  backdrop-filter: blur(12px);
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

.toast-success {
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.2);
}

.toast-error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.2);
}

.toast-info {
  background: rgba(255, 107, 53, 0.1);
  color: var(--accent);
  border-color: rgba(255, 107, 53, 0.2);
}

.toast-warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.2);
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  flex-direction: column;
  gap: 16px;
}

.loading-center .loading-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ============================================
   Utility
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.font-mono { font-family: 'Space Grotesk', monospace; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden { display: none !important; }

.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ============================================
   Responsive: Mobile
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  .sidebar-header {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 6px 8px;
    gap: 0;
    overflow-x: auto;
    flex: 1;
    justify-content: space-around;
  }

  .nav-link {
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    font-size: 10px;
    text-align: center;
    min-width: 0;
  }

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

  .nav-separator {
    display: none;
  }

  .nav-link-logout {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px 80px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .templates-grid {
    grid-template-columns: 1fr;
  }

  .two-col-layout {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 70px;
    padding: 4px;
  }

  .calendar-day-number {
    font-size: 11px;
  }

  .calendar-pill {
    font-size: 8px;
    padding: 2px 4px;
  }

  .record-btn {
    width: 100px;
    height: 100px;
    font-size: 36px;
  }

  .record-timer {
    font-size: 28px;
  }

  #toast-container {
    left: 16px;
    right: 16px;
    bottom: 80px;
    max-width: none;
  }

  .modal {
    max-width: none;
    margin: 0 8px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .filter-tabs {
    overflow-x: auto;
    width: 100%;
  }

  .bar-chart {
    height: 140px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card-value {
    font-size: 24px;
  }

  .recording-item {
    flex-wrap: wrap;
  }

  .recording-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================
   Settings / Connected Accounts
   ============================================ */
.settings-section {
  margin-bottom: 48px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.settings-section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.connection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.connection-card:hover {
  border-color: var(--border-light);
}

.connection-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.connection-platform-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
}

.connection-platform-icon svg {
  width: 24px;
  height: 24px;
}

.connection-platform-info {
  flex: 1;
  min-width: 0;
}

.connection-platform-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.connection-status {
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-connected {
  color: var(--success);
}

.status-expired {
  color: var(--danger);
}

.status-warning {
  color: var(--warning);
}

.status-disconnected {
  color: var(--text-muted);
}

.connection-details {
  flex: 1;
  margin-bottom: 20px;
}

.connection-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  gap: 12px;
}

.connection-detail-row + .connection-detail-row {
  border-top: 1px solid var(--border);
}

.connection-detail-label {
  color: var(--text-muted);
  flex-shrink: 0;
}

.connection-detail-value {
  color: var(--text-secondary);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ============================================
   Responsive additions for settings
   ============================================ */
@media (max-width: 768px) {
  .connections-grid {
    grid-template-columns: 1fr;
  }
}

/* Hide sidebar + show auth pages full-width */
body.auth-mode .sidebar {
  display: none;
}

body.auth-mode .main-content {
  margin-left: 0;
  padding: 0;
}

/* ============================================
   Auto-Posting & Engagement Styles
   ============================================ */

/* Content card extras */
.content-card-schedule {
  font-size: 12px;
  color: var(--accent);
  margin: 6px 0 0;
}

.content-card-error {
  font-size: 12px;
  color: var(--danger);
  margin: 6px 0 0;
}

.badge-failed {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.badge-success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.btn-success {
  background: var(--success);
  color: #0a0a0f;
  border: none;
  font-weight: 600;
}

.btn-success:hover {
  background: #2fc98a;
}

/* LinkedIn OAuth button */
.btn-linkedin {
  background: #0A66C2;
  color: #fff;
  border: none;
  font-weight: 600;
  text-decoration: none;
}

.btn-linkedin:hover {
  background: #004182;
  color: #fff;
  text-decoration: none;
}

/* Auth page divider ("or" separator) */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 12px;
}

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

.error-banner {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.success-banner {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

/* Calendar published/failed pills */
.calendar-pill.published {
  opacity: 0.75;
  text-decoration: none;
  border-left: 3px solid var(--success);
}

.calendar-pill.failed {
  opacity: 0.75;
  border-left: 3px solid var(--danger);
}

/* ============================================
   Engagement Page
   ============================================ */

.engagement-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.engagement-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.engagement-stat-card:hover {
  border-color: var(--accent);
}

.engagement-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.engagement-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.engagement-section {
  margin-bottom: 32px;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Platform breakdown */
.engagement-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.engagement-platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.engagement-platform-name {
  margin-bottom: 12px;
}

.engagement-platform-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Queue */
.engagement-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.queue-scheduled {
  border-left: 3px solid var(--accent);
}

.queue-failed {
  border-left: 3px solid var(--danger);
}

.queue-item-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.queue-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.queue-item-time {
  font-size: 12px;
  color: var(--text-muted);
}

.queue-item-error {
  font-size: 12px;
  color: var(--danger);
  flex-basis: 100%;
}

/* Post cards */
.engagement-posts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.engagement-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s;
}

.engagement-post-card:hover {
  border-color: var(--border-light);
}

.engagement-post-top {
  border-left: 3px solid var(--accent);
}

.engagement-post-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.engagement-rank {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
}

.engagement-post-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engagement-post-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.engagement-post-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.engagement-post-no-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.metric-total {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   Video Script Feature
   ============================================ */

/* Badge */
.badge-video-script {
  background: rgba(99, 179, 237, 0.12);
  color: #63b3ed;
}

.calendar-pill-video-script {
  background: rgba(99, 179, 237, 0.15);
  color: #63b3ed;
}

/* Video script button variant */
.btn-video-script {
  background: rgba(99, 179, 237, 0.12);
  color: #63b3ed;
  border: 1px solid rgba(99, 179, 237, 0.25);
}

.btn-video-script:hover:not(:disabled) {
  background: rgba(99, 179, 237, 0.22);
}

/* Content card highlight for video scripts */
.content-card-video-script {
  border-left: 3px solid #63b3ed;
}

/* Read time badge on content card */
.vs-read-time-badge {
  background: rgba(99, 179, 237, 0.1);
  color: #63b3ed;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(99, 179, 237, 0.2);
}

/* Filter tab video script accent */
.filter-tab-video.active {
  background: rgba(99, 179, 237, 0.12);
  color: #63b3ed;
  border: 1px solid rgba(99, 179, 237, 0.2);
}

/* Duration selector in video script modal */
.duration-selector {
  display: flex;
  gap: 8px;
}

.duration-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.duration-btn span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.duration-btn:hover {
  border-color: #63b3ed;
  color: #63b3ed;
}

.duration-btn.duration-btn-active {
  background: rgba(99, 179, 237, 0.12);
  border-color: #63b3ed;
  color: #63b3ed;
}

.duration-btn.duration-btn-active span {
  color: rgba(99, 179, 237, 0.7);
}

/* Hint box in video script modal */
.vs-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 16px 0 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.vs-hint span:first-child {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Video Script Editor Modal */
.modal-video-script {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.vs-editor-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.vs-title-input-wrapper {
  flex: 1;
  min-width: 200px;
}

.vs-title-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border);
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 4px 0 6px;
  outline: none;
  transition: border-color 0.15s;
}

.vs-title-input:focus {
  border-bottom-color: #63b3ed;
}

.vs-read-time {
  font-size: 13px;
  color: #63b3ed;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.vs-editor-area {
  flex: 1;
  min-height: 0;
}

.vs-script-textarea {
  width: 100%;
  min-height: 340px;
  max-height: 440px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  padding: 16px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.vs-script-textarea:focus {
  border-color: #63b3ed;
  box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.12);
}

/* Legend row under textarea */
.vs-editor-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.vs-editor-legend code {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  color: #63b3ed;
}

/* "Ready to Record" button */
.vs-record-btn {
  background: rgba(52, 211, 153, 0.12) !important;
  color: var(--success) !important;
  border: 1px solid rgba(52, 211, 153, 0.25) !important;
}

.vs-record-btn:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.22) !important;
}

@media (max-width: 768px) {
  .engagement-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .engagement-platform-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Onboarding Mode (full-width, no sidebar)
   ============================================ */

body.onboarding-mode .main-content {
  margin-left: 0;
  padding: 0;
}

/* ============================================
   Onboarding Flow
   ============================================ */

.onb-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
}

.onb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 56px;
  width: 100%;
  max-width: 560px;
}

.onb-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
  text-align: center;
}

.onb-logo span {
  color: var(--accent);
}

.onb-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 8px;
}

.onb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-light);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.onb-dot-active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.onb-line {
  width: 80px;
  height: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.onb-line-active {
  background: var(--accent);
}

.onb-step-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.onb-step-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.onb-step-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.6;
}

.onb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.onb-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.onb-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.onb-chip-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.onb-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

.onb-back-btn {
  font-size: 14px;
}

.onb-next-btn {
  min-width: 160px;
}

@media (max-width: 640px) {
  .onb-card {
    padding: 32px 24px;
  }
  .onb-step-title {
    font-size: 22px;
  }
}

/* ============================================
   Settings Profile Form
   ============================================ */

.settings-profile-form {
  max-width: 560px;
}

.settings-profile-form > .form-group:last-child {
  margin-bottom: 0;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 0;
  line-height: 1.5;
}

.settings-goals-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.settings-goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-goal-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-goal-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ============================================
   Settings Tabs
   ============================================ */
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }

.settings-tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  margin-bottom: -1px;
}
.settings-tab-btn:hover { color: var(--text-primary); }
.settings-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }

/* ============================================
   Profile / Avatar
   ============================================ */
.profile-avatar-area {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 36px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.profile-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-actions { flex: 1; }
.profile-avatar-actions p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================
   Password Strength Indicator
   ============================================ */
.password-strength { margin-top: 8px; }

.password-strength-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.strength-segment {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--bg-hover);
  transition: background 0.2s ease;
}

.strength-segment.filled-weak   { background: var(--danger); }
.strength-segment.filled-fair   { background: var(--warning); }
.strength-segment.filled-good   { background: #60a5fa; }
.strength-segment.filled-strong { background: var(--success); }

.password-strength-label { font-size: 12px; color: var(--text-muted); }
.strength-text-weak   { color: var(--danger); }
.strength-text-fair   { color: var(--warning); }
.strength-text-good   { color: #60a5fa; }
.strength-text-strong { color: var(--success); }

/* ============================================
   Sessions List
   ============================================ */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 12px;
}
.session-item.current-session {
  border-color: rgba(255, 107, 53, 0.3);
  background: var(--accent-dim);
}

.session-info { flex: 1; min-width: 0; }
.session-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.session-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.session-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

/* ============================================
   Danger Zone
   ============================================ */
.danger-zone {
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 12px;
  padding: 24px;
  background: rgba(248, 113, 113, 0.04);
}
.danger-zone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 8px;
}
.danger-zone-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ============================================
   Info Row
   ============================================ */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  gap: 12px;
}
.info-row-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.info-row-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Auth helpers (forgot password)
   ============================================ */
.auth-help-link {
  text-align: right;
  margin-top: -8px;
  margin-bottom: 12px;
}
.auth-help-link a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s ease;
}
.auth-help-link a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

@media (max-width: 600px) {
  .profile-avatar-area {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .info-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .info-row-value { text-align: left; }
}

/* ============================================
   Guided Recording Page (Teleprompter Flow)
   ============================================ */

.guided-record-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 0 48px;
}

.guided-record-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.btn-ghost-sm {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

.btn-ghost-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 107, 53, 0.06);
}

/* Teleprompter panel */
.teleprompter-panel {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.09), rgba(255, 107, 53, 0.03));
  border: 1px solid rgba(255, 107, 53, 0.22);
  border-radius: 16px;
  padding: 36px 40px 28px;
  text-align: center;
  margin-bottom: 20px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.prompt-counter {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 18px;
  opacity: 0.9;
}

.teleprompter-text {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text-primary);
  max-width: 520px;
  transition: opacity 0.2s ease;
}

.prompt-fading {
  opacity: 0;
}

.next-prompt-btn {
  margin-top: 24px;
  background: rgba(255, 107, 53, 0.1);
  color: var(--accent);
  border: 1.5px solid rgba(255, 107, 53, 0.3);
  padding: 9px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}

.next-prompt-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateX(2px);
}

.next-prompt-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Recording controls card */
.guided-controls-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 32px 24px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 20px;
}

.guided-controls-card .record-timer {
  margin-top: 16px;
}

.guided-controls-card .record-status {
  margin-top: 6px;
}

.guided-controls-card .waveform-viz {
  margin-top: 20px;
}

/* Post-recording result panel */
.grp-result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
}

.grp-result-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.grp-processing {
  text-align: center;
  padding: 20px 0 8px;
}

@media (max-width: 600px) {
  .teleprompter-panel {
    padding: 28px 20px 22px;
  }
  .teleprompter-text {
    font-size: 18px;
  }
  .guided-record-header {
    flex-direction: column;
    gap: 10px;
  }
}

/* ============================================
   Video Recorder with Teleprompter
   ============================================ */

.vr-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: #000;
  animation: vr-fade-in 0.25s ease;
}

@keyframes vr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Phases */
.vr-phase {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}

.vr-phase-center {
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
}

/* Camera feed */
.vr-camera {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror front camera */
}

/* Top bar — minimal to keep teleprompter near camera lens */
.vr-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  z-index: 10;
  background: none;
  pointer-events: none;
}

.vr-topbar > * {
  pointer-events: auto;
}

.vr-topbar-title {
  font-size: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.vr-close-btn {
  background: rgba(0,0,0,0.35);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease;
}

.vr-close-btn:hover {
  background: rgba(0,0,0,0.55);
}

.vr-switch-btn {
  background: rgba(0,0,0,0.35);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease;
}

.vr-switch-btn:hover {
  background: rgba(0,0,0,0.55);
}

/* Teleprompter wrap — pinned to very top so user looks at camera */
.vr-tp-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 4px;
  width: 90%;
  max-width: 600px;
  max-height: 40vh;
  overflow-y: auto;
  z-index: 5;
  border-radius: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.vr-tp-wrap::-webkit-scrollbar {
  display: none;
}

.vr-tp-fade-top,
.vr-tp-fade-bottom {
  position: sticky;
  left: 0;
  right: 0;
  height: 10px;
  z-index: 2;
  pointer-events: none;
}

.vr-tp-fade-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%);
}

.vr-tp-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
}

.vr-tp-text {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.7;
  color: #fff;
  text-align: center;
  padding: 6px 24px 20px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
  white-space: pre-wrap;
}

/* Countdown overlay */
.vr-countdown {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(0,0,0,0.55);
  font-size: 96px;
  font-weight: 700;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  text-shadow: 0 4px 24px rgba(255,107,53,0.4);
  animation: vr-countdown-pulse 0.9s ease infinite;
}

@keyframes vr-countdown-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* REC badge — top-right so it doesn't block center teleprompter text */
.vr-rec-badge {
  position: absolute;
  top: 8px;
  right: 52px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 15;
  animation: vr-rec-blink 1s ease infinite;
  backdrop-filter: blur(6px);
}

@keyframes vr-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Auto-scroll hint tooltip */
.vr-autoscroll-hint {
  position: absolute;
  bottom: 170px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 24px;
  z-index: 15;
  text-align: center;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.12);
  animation: vr-hint-show 4s ease forwards;
}

@keyframes vr-hint-show {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Bottom controls */
.vr-bottom-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 24px 36px;
  z-index: 10;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Speed row */
.vr-speed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.vr-speed-label {
  font-size: 16px;
  flex-shrink: 0;
}

.vr-speed-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
  outline: none;
  cursor: pointer;
}

.vr-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,107,53,0.35);
}

.vr-speed-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(255,107,53,0.35);
}

.vr-icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.vr-icon-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* Record row & button */
.vr-record-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vr-record-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 36px;
  border-radius: 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(255,107,53,0.35);
  letter-spacing: 0.3px;
}

.vr-record-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255,107,53,0.45);
}

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

.vr-record-btn.vr-recording {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(220,38,38,0.4);
  animation: vr-btn-recording 1.5s ease infinite;
}

.vr-record-btn.vr-recording:hover {
  background: #ef4444;
}

@keyframes vr-btn-recording {
  0%, 100% { box-shadow: 0 4px 16px rgba(220,38,38,0.4); }
  50% { box-shadow: 0 4px 28px rgba(220,38,38,0.65); }
}

/* Preview phase */
.vr-phase-preview {
  background: var(--bg-deep);
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.vr-phase-preview .vr-close-btn {
  background: rgba(255,255,255,0.12);
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.vr-phase-preview .vr-close-btn:hover {
  background: rgba(255,255,255,0.22);
}

.vr-preview-inner {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.vr-preview-header {
  text-align: center;
}

.vr-preview-header h3 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.vr-preview-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.vr-preview-video {
  width: 100%;
  max-height: 50vh;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}

.vr-preview-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.vr-script-details {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}

.vr-script-details summary {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.vr-script-details summary:hover {
  color: var(--text-primary);
}

.vr-preview-script-text {
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
}

.vr-script-collapse-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.vr-script-collapse-btn:hover {
  background: var(--bg-hover);
}

/* Center box (saving / done phases) */
.vr-center-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vr-center-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.vr-center-sub {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.5;
}

.vr-done-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

/* Spinner for saving phase */
.vr-phase-saving .spinner-lg {
  width: 48px;
  height: 48px;
}

/* ---- Mode toggle (Classic / Focus) ---- */
.vr-mode-row {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.vr-mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  backdrop-filter: blur(6px);
}

.vr-mode-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

.vr-mode-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.1);
}

.vr-mode-btn.vr-mode-btn-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,107,53,0.35);
}

/* ---- Focus (RSVP-hybrid) display ---- */
.vr-tp-wrap.vr-tp-focus-mode {
  overflow: hidden; /* no scrollbar in focus mode */
}

.vr-focus-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  min-height: 90px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.vr-focus-word {
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0,0,0,0.75), 0 0 24px rgba(255,107,53,0.2);
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.1s ease;
  flex-shrink: 0;
}

.vr-context-word {
  font-size: 22px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.vr-context-word.vr-context-near {
  font-size: 18px;
  color: rgba(255,255,255,0.28);
}

.vr-context-word.vr-context-far {
  font-size: 14px;
  color: rgba(255,255,255,0.15);
}

.vr-focus-placeholder {
  display: inline-block;
  min-width: 40px;
  flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .vr-tp-wrap {
    width: 95%;
    bottom: 180px;
    max-height: 28vh;
  }

  .vr-tp-text {
    font-size: 18px;
    padding: 16px 16px;
  }

  .vr-bottom-controls {
    padding: 16px 16px 28px;
  }

  .vr-speed-row {
    max-width: 280px;
  }

  .vr-record-btn {
    padding: 12px 28px;
    font-size: 15px;
  }

  .vr-countdown {
    font-size: 72px;
  }

  .vr-preview-inner {
    padding: 0 8px;
  }

  /* Focus mode mobile: smaller focus word, tighter context */
  .vr-focus-word {
    font-size: 32px;
  }

  .vr-context-word {
    font-size: 16px;
  }

  .vr-context-word.vr-context-near {
    font-size: 13px;
  }

  .vr-context-word.vr-context-far {
    font-size: 10px;
  }

  .vr-focus-display {
    padding: 14px 8px;
    min-height: 70px;
    gap: 4px;
  }
}

/* ============================================================
   AI Model Rich Dropdown (md-dropdown)
   ============================================================ */
.md-dropdown {
  position: relative;
  width: 100%;
}

.md-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.md-trigger:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.md-trigger:focus,
.md-dropdown.md-open .md-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.md-trigger-content {
  flex: 1;
  min-width: 0;
}

.md-trigger-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.md-trigger-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.md-trigger-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.md-arrow {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.md-dropdown.md-open .md-arrow {
  transform: rotate(180deg);
}

.md-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}

.md-dropdown.md-open .md-menu {
  display: block;
}

.md-group-label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.md-option {
  padding: 10px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.md-option:hover {
  background: var(--bg-hover);
}

.md-option--active {
  background: var(--accent-dim);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.md-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.md-option-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.md-option-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.md-option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

/* ============================================================
   Help Chatbot Widget
   ============================================================ */

/* Floating help button */
.help-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.45);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
}

.help-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255, 107, 53, 0.55);
}

.help-btn:active {
  transform: scale(0.96);
}

.help-btn-icon {
  font-size: 22px;
  line-height: 1;
}

/* Chat panel */
.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9001;
  width: 360px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat header */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.chat-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-panel-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.chat-panel-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

/* Message bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: msg-in 0.18s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.chat-msg.bot .chat-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Escalate button inside a bot message */
.chat-escalate-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.chat-escalate-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Inline contact form (appears as a bot message) */
.chat-contact-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 230px;
  max-width: 280px;
}

.chat-contact-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-contact-input,
.chat-contact-textarea {
  width: 100%;
  background: var(--bg-page, #111);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
  resize: none;
}

.chat-contact-input:focus,
.chat-contact-textarea:focus {
  border-color: var(--accent);
}

.chat-contact-input::placeholder,
.chat-contact-textarea::placeholder {
  color: var(--text-muted);
}

.chat-contact-submit {
  align-self: flex-start;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.chat-contact-submit:hover {
  opacity: 0.88;
}

.chat-contact-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px 4px;
  flex-shrink: 0;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Input row */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}

.chat-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 9px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
}

.chat-send-btn:active {
  transform: scale(0.92);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mobile backdrop */
.chat-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8999;
  background: rgba(0, 0, 0, 0.5);
}

/* Mobile: full-width panel from bottom */
@media (max-width: 600px) {
  .chat-panel {
    width: 100vw;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px 20px 0 0;
    max-height: 75vh;
    transform: translateY(40px) scale(1);
  }

  .chat-panel.open {
    transform: translateY(0) scale(1);
  }

  .chat-backdrop.open {
    display: block;
  }

  .help-btn {
    bottom: 20px;
    right: 20px;
  }
}

/* Admin support page */
.support-admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.support-admin-row:last-child {
  border-bottom: none;
}

.support-admin-row:hover {
  background: var(--bg-hover);
}

.support-admin-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.support-status-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.support-status-open {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.support-status-resolved {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.support-transcript {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-deep);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 160px;
  overflow-y: auto;
  display: none;
}

.support-transcript.visible {
  display: block;
}

.support-transcript-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.support-transcript-toggle:hover {
  text-decoration: underline;
}
