/* PostEcho App — dark editorial aesthetic */

:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface2: #1e1e24;
  --border: #2a2a33;
  --text: #f0eff4;
  --muted: #8c8a99;
  --accent: #c8f73a;
  --accent-dim: rgba(200, 247, 58, 0.12);
  --accent-hover: #d9ff4d;
  --danger: #ff5a5a;
  --radius: 10px;
  --transition: 0.18s ease;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── typography ─────────────────────────── */
h1, h2, h3 { font-family: 'Syne', sans-serif; line-height: 1.15; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── layout ─────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

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

.nav-link svg { opacity: 0.7; flex-shrink: 0; }
.nav-link:hover svg, .nav-link.active svg { opacity: 1; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-content {
  overflow-y: auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── page header ─────────────────────────── */
.page-header { display: flex; flex-direction: column; gap: 6px; }
.page-header h1 { color: var(--text); }
.page-header p { font-size: 0.95rem; }

/* ── cards ─────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── upload zone ─────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-area h3 { color: var(--text); margin-bottom: 6px; }
.upload-area p { font-size: 0.85rem; }

.upload-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-preview img, .upload-preview video {
  max-height: 200px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.upload-preview .file-name {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

/* ── form elements ─────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 8px; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder { color: var(--muted); opacity: 0.7; }

.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
  font-size: 0.95rem;
}

.input-with-prefix input { padding-left: 30px; }

/* ── buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  letter-spacing: 0.02em;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200, 247, 58, 0.25);
}

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

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: none;
  color: var(--muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border);
}

.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }

/* ── caption cards ─────────────────────────── */
.captions-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.caption-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  position: relative;
}

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

.caption-card.approved {
  border-color: var(--accent);
  background: rgba(200, 247, 58, 0.05);
}

.caption-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 12px;
}

.caption-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  min-height: 60px;
}

.caption-text[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 4px;
  cursor: text;
}

.caption-text[contenteditable="true"]:focus {
  border-color: var(--accent);
}

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

.char-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.char-count.over {
  color: var(--danger);
  font-weight: 600;
}

.caption-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.approved-badge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.caption-card.approved .approved-badge { display: flex; }

/* ── voice profile pill strip ─────────────────────────── */
.voice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.voice-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.voice-pill strong { color: var(--text); }

/* ── status indicators ─────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-badge.processing {
  background: rgba(255, 180, 50, 0.1);
  color: #ffb432;
}

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

.status-badge.error {
  background: rgba(255, 90, 90, 0.1);
  color: var(--danger);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── progress steps ─────────────────────────── */
.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.progress-step.active { color: var(--text); }
.progress-step.active .step-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.progress-step.done { color: var(--accent); }
.progress-step.done .step-dot { background: var(--accent); }

/* ── history list ─────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover { border-color: var(--accent); }

.history-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.history-info { flex: 1; min-width: 0; }
.history-handle { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.history-date { font-size: 0.78rem; color: var(--muted); }
.history-status { flex-shrink: 0; }

/* ── auth pages ─────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(200, 247, 58, 0.08), transparent);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
}

.auth-logo .logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.error-banner {
  background: rgba(255, 90, 90, 0.1);
  border: 1px solid rgba(255, 90, 90, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--danger);
  display: none;
}

.error-banner.show { display: block; }

/* ── empty states ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; font-size: 0.9rem; }

/* ── copy toast ─────────────────────────── */
.copy-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--accent);
  color: #0d0d0f;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── responsive ─────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 16px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-bottom { display: none; }

  .main-content { padding: 24px 16px; }
}
