/* Parle Web Dashboard — Styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Reset & base ────────────────────────────────────────────────────────── */

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

:root {
  --bg: #0F0F0F;
  --bg-card: #1A1A1A;
  --bg-card-hover: #222222;
  --border: #2A2A2A;
  --border-focus: #8B5CF6;
  --accent: #8B5CF6;
  --accent-hover: #7C3AED;
  --accent-dim: rgba(139, 92, 246, 0.15);
  --text: #F5F5F5;
  --text-secondary: #A0A0A0;
  --text-muted: #666666;
  --success: #22C55E;
  --error: #EF4444;
  --warning: #F59E0B;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 3rem; letter-spacing: -0.03em; }
h2 { font-size: 2rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.mono {
  font-family: var(--mono);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: #3A3A3A;
}

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

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-danger {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input, select, .input-sm {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 0.9375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s;
  outline: none;
}

.input:focus, select:focus, .input-sm:focus {
  border-color: var(--accent);
}

.input-sm {
  padding: 6px 10px;
  font-size: 0.8125rem;
}

.input-wide {
  width: 100%;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A0A0A0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}

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

/* ── Flash messages ──────────────────────────────────────────────────────── */

#flash-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  animation: flashIn 0.2s ease-out;
  max-width: 400px;
}

.flash-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.flash-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.flash-info {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent);
}

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

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px rgba(139, 92, 246, 0.1);
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */

.navbar {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  padding: 100px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  max-width: 700px;
  margin: 0 auto 24px;
  line-height: 1.1;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── How it works ────────────────────────────────────────────────────────── */

.how-section {
  padding: 80px 0;
}

.how-section h2 {
  text-align: center;
  margin-bottom: 48px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step {
  text-align: center;
  padding: 32px 24px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 16px;
}

.step h3 {
  margin-bottom: 8px;
}

.step p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ── Pricing ─────────────────────────────────────────────────────────────── */

.pricing-section {
  padding: 80px 0;
}

.pricing-section h2 {
  text-align: center;
  margin-bottom: 12px;
}

.pricing-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.pricing-card {
  text-align: center;
  padding: 32px 24px;
  position: relative;
}

.pricing-card .badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pricing-card .tier-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.pricing-card .price-unit {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.pricing-card .tier-detail {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 24px;
}

.pricing-card .btn {
  width: 100%;
}

/* ── Download section ────────────────────────────────────────────────────── */

.download-section {
  padding: 80px 0;
  text-align: center;
}

.download-section h2 {
  margin-bottom: 12px;
}

.download-section .subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.install-box {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-family: var(--mono);
  font-size: 0.9375rem;
  max-width: 100%;
  overflow-x: auto;
}

.install-box code {
  color: var(--text);
  white-space: nowrap;
}

.install-box .prompt {
  color: var(--accent);
  user-select: none;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

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

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  list-style: none;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--text);
}

/* ── Auth page ───────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card .logo {
  display: block;
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 32px;
}

.tab-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.tab-switcher button {
  flex: 1;
  padding: 10px;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-switcher button.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.api-key-display {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  word-break: break-all;
}

.api-key-display .label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.api-key-display code {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
}

.api-key-display .warning {
  font-size: 0.8125rem;
  color: var(--warning);
  margin-top: 8px;
  display: block;
}

/* ── Dashboard layout ────────────────────────────────────────────────────── */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 100;
}

.sidebar-logo {
  padding: 0 20px;
  margin-bottom: 32px;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.sidebar-nav a.active {
  color: var(--text);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.sidebar-nav .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.7;
}

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

.sidebar-footer .user-email {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  max-width: 900px;
}

.section-panel {
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hidden {
  display: none !important;
}

/* ── Credits section ─────────────────────────────────────────────────────── */

.credits-hero {
  text-align: center;
  padding: 40px 0;
  margin-bottom: 32px;
}

.credits-hero .balance {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.credits-hero .balance-unit {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-left: 8px;
  font-weight: 400;
}

.credits-hero .balance-sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.tier-card {
  text-align: center;
  padding: 24px 16px;
}

.tier-card .tier-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.tier-card .tier-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tier-card .tier-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tier-card .btn {
  width: 100%;
}

/* ── Transcriptions section ──────────────────────────────────────────────── */

.search-bar {
  margin-bottom: 20px;
}

.search-bar .input {
  background: var(--bg-card);
}

.transcription-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.transcription-item:hover {
  border-color: #3A3A3A;
  background: var(--bg-card);
}

.transcription-header {
  margin-bottom: 6px;
}

.transcription-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.transcription-preview {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.transcription-full {
  margin-top: 12px;
}

.transcription-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.transcription-raw {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.transcription-raw .label {
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ── Vocabulary section ──────────────────────────────────────────────────── */

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.vocab-table th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.vocab-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.vocab-table .empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 12px;
}

.vocab-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* ── Settings section ────────────────────────────────────────────────────── */

.settings-form {
  max-width: 500px;
}

.settings-form .form-group {
  margin-bottom: 24px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-row input[type="range"] {
  flex: 1;
}

.slider-value {
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 24px;
  text-align: center;
}

/* ── Account section ─────────────────────────────────────────────────────── */

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.account-row .label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.account-row .value {
  font-family: var(--mono);
  font-size: 0.9375rem;
}

.new-key-box {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.new-key-box .label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.new-key-box code {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  word-break: break-all;
}

.new-key-box .warning {
  font-size: 0.8125rem;
  color: var(--warning);
  margin-top: 8px;
  display: block;
}

.new-key-box .btn {
  margin-top: 12px;
}

.tx-list {
  margin-top: 24px;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.tx-type {
  font-family: var(--mono);
  font-weight: 600;
  min-width: 80px;
}

.tx-credit { color: var(--success); }
.tx-debit { color: var(--text-secondary); }

.tx-label {
  flex: 1;
  color: var(--text-secondary);
}

.tx-date {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ── Mobile menu toggle ──────────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  line-height: 1;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.5rem; }

  .hero {
    padding: 60px 0 40px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero .subtitle {
    font-size: 1.1rem;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pricing-grid,
  .tier-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin: 0 auto;
  }

  .nav-links {
    gap: 16px;
  }

  /* Dashboard mobile */
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 60px 16px 32px;
  }

  .credits-hero .balance {
    font-size: 3rem;
  }

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

  .account-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

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

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .install-box {
    font-size: 0.8125rem;
    padding: 10px 14px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }
}
