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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --text: #f0efe9;
  --text-muted: #8a8a80;
  --accent: #e8ff47;
  --accent-dim: rgba(232, 255, 71, 0.12);
  --accent-hover: rgba(232, 255, 71, 0.2);
  --coral: #ff6b4a;
  --green: #4ade80;
  --red: #ef4444;
  --blue: #60a5fa;
  --border: rgba(255,255,255,0.06);
  --border-accent: rgba(232,255,71,0.15);
  --radius: 12px;
  --radius-lg: 16px;
}

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

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

/* ─── Layout ─── */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
}

/* ─── Nav ─── */
.app-nav {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}

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

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

.nav-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-logout {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}

/* ─── Buttons ─── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 100px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: #d4eb3c;
  transform: translateY(-1px);
}

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

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

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: rgba(255,255,255,0.12);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

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

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

.btn-icon {
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 20px;
}

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

.form-group .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  transition: border-color 0.2s;
  outline: none;
}

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

textarea {
  min-height: 100px;
  resize: vertical;
}

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='%238a8a80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

select option {
  background: var(--surface);
  color: var(--text);
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255,255,255,0.1);
}

/* ─── Auth Page ─── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

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

.auth-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.auth-toggle {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

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

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible {
  display: block;
}

/* ─── Onboarding ─── */
.onboarding-page {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.onboarding-header {
  margin-bottom: 40px;
}

.onboarding-header h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.onboarding-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 36px;
}

.step-dot {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  transition: background 0.3s;
}

.step-dot.active {
  background: var(--accent);
}

.step-dot.completed {
  background: rgba(232, 255, 71, 0.4);
}

.onboarding-step {
  display: none;
}

.onboarding-step.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.step-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

/* Voice selection */
.voice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.voice-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-option:hover {
  border-color: rgba(255,255,255,0.12);
}

.voice-option.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.voice-option h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.voice-option p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Platform selection */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.platform-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.platform-option:hover {
  border-color: rgba(255,255,255,0.12);
}

.platform-option.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.platform-option .platform-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.platform-option h4 {
  font-size: 0.9rem;
}

.platform-option p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Dashboard ─── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dashboard-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-card .stat-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Post Cards ─── */
.posts-section {
  margin-top: 8px;
}

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

.section-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.post-card:hover {
  border-color: rgba(255,255,255,0.1);
}

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

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-type-badge {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent);
}

.post-status {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 100px;
}

.status-scheduled {
  background: rgba(96, 165, 250, 0.12);
  color: var(--blue);
}

.status-draft {
  background: rgba(138, 138, 128, 0.12);
  color: var(--text-muted);
}

.status-posted {
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
}

.post-card-actions {
  display: flex;
  gap: 6px;
}

.post-content {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.post-schedule {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-platform {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ─── Generate Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  display: none;
}

.modal-overlay.visible {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ─── Edit Post Modal ─── */
.edit-textarea {
  min-height: 150px;
}

/* ─── Loading States ─── */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(10,10,10,0.2);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-muted);
  gap: 16px;
}

.loading-overlay .spinner-lg {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Filter Tabs ─── */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 100px;
  padding: 4px;
  border: 1px solid var(--border);
}

.filter-tab {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 7px 16px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

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

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

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.85rem;
  color: var(--text);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 360px;
}

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

.toast.success {
  border-color: rgba(74, 222, 128, 0.3);
}

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .dashboard-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .modal {
    margin: 16px;
    max-width: calc(100% - 32px);
  }
}

/* ─── Page Transitions ─── */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ─── Settings Section ─── */
.settings-section {
  max-width: 640px;
}

.settings-section h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}
