/* ClawHub Dashboard — style.css */

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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-dim: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-bg: #f5f3ff;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --orange-border: #fed7aa;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Login screen ─────────────────────────────────────────────────────────── */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

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

.login-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-card input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 16px;
}

.login-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.login-message.success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.login-message.error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

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

.app-layout {
  display: none;
}

.app-layout.active {
  display: block;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.app-header-logo span { color: var(--text); }

.app-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header-plan {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  text-transform: capitalize;
}

.app-header-email {
  font-size: 14px;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

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

/* ─── Navigation tabs ──────────────────────────────────────────────────────── */

.app-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0 24px;
  overflow-x: auto;
}

.app-nav button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.app-nav button:hover {
  color: var(--text);
}

.app-nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Main content ─────────────────────────────────────────────────────────── */

.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.btn-green { background: var(--green); }
.btn-green:hover { background: #15803d; }

.btn-red {
  background: var(--surface);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-red:hover { background: var(--red-bg); }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
}

.label-review { background: var(--blue-bg); color: var(--blue); }
.label-enquiry { background: var(--green-bg); color: var(--green); }
.label-social { background: var(--orange-bg); color: var(--orange); }

.label-pending { background: var(--orange-bg); color: var(--orange); }
.label-approved { background: var(--green-bg); color: var(--green); }
.label-rejected { background: var(--red-bg); color: var(--red); }
.label-edited { background: var(--blue-bg); color: var(--blue); }

.card-time {
  font-size: 13px;
  color: var(--text-dim);
}

.card-input {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.card-input::before {
  content: 'Input: ';
  font-weight: 600;
  color: var(--text-dim);
}

.card-draft {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Generate panel ───────────────────────────────────────────────────────── */

.generate-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.generate-panel h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.generate-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.generate-row select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 180px;
}

.generate-row select:focus {
  border-color: var(--accent);
}

.generate-row textarea {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  outline: none;
}

.generate-row textarea:focus {
  border-color: var(--accent);
}

/* ─── 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.3;
}

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

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

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

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

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group .form-hint {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

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

.settings-saved {
  display: none;
  padding: 12px 16px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 12px;
}

.settings-saved.show { display: block; }

/* ─── Subscription card ────────────────────────────────────────────────────── */

.plan-card {
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.plan-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.plan-card p {
  font-size: 14px;
  color: var(--text-muted);
}

.plan-inactive {
  background: var(--orange-bg);
  border-color: var(--orange-border);
}

.plan-inactive h3 { color: var(--orange); }

/* ─── Edit modal ───────────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.modal textarea:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ─── Loading ──────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-bar {
  height: 2px;
  background: var(--accent);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 300;
  animation: loading 1.5s ease-in-out infinite;
  display: none;
}

.loading-bar.active { display: block; }

@keyframes loading {
  0% { width: 0; }
  50% { width: 60%; }
  100% { width: 100%; opacity: 0; }
}

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

@media (max-width: 640px) {
  .app-header { padding: 0 16px; }
  .app-nav { padding: 0 16px; }
  .app-main { padding: 16px; }
  .login-card { padding: 32px 24px; }
  .app-header-email { display: none; }
  .generate-row { flex-direction: column; }
  .generate-row select { min-width: auto; }
  .card-actions { flex-direction: column; }
  .card-actions button { width: 100%; justify-content: center; }
}
