/* ============================================================
   Global Styles — Comment Application
   Clean, dark-themed UI focused on readability
   ============================================================ */

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

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #22263a;
  --border:     #2e3350;
  --accent:     #4f6ef7;
  --accent-h:   #6b87ff;
  --danger:     #e05252;
  --success:    #3ecf8e;
  --text:       #e8eaf6;
  --text-muted: #8b91b8;
  --radius:     10px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ── Auth card (login / register) ─── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

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

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

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
}

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

/* ── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-h); }

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

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

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

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

/* ── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 0.88rem;
  margin-bottom: 18px;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(224,82,82,0.15);  border: 1px solid var(--danger);  color: #f08080; }
.alert-success { background: rgba(62,207,142,0.12); border: 1px solid var(--success); color: var(--success); }

/* ── Link row ─── */
.link-row {
  text-align: center;
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.link-row a { color: var(--accent); text-decoration: none; }
.link-row a:hover { text-decoration: underline; }

/* ── Turnstile centering ─── */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0;
}

/* ============================================================
   Comments Page
   ============================================================ */
body.comments-page {
  align-items: flex-start;
  padding: 0;
}

.app-layout {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

/* ── Top bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.topbar h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── New comment form ─── */
.new-comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.new-comment-card h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.new-comment-card .btn-primary {
  width: auto;
  margin-top: 10px;
}

/* ── Comments list ─── */
.comments-header {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.comment-card:hover { border-color: var(--surface2); }

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}

.comment-edited {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.comment-body {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Edit inline form */
.edit-form { margin-top: 12px; }
.edit-form textarea { min-height: 70px; }
.edit-form .edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}
.empty-state p { margin-top: 10px; font-size: 0.9rem; }

/* Loading spinner */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Security badge */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(79,110,247,0.12);
  border: 1px solid rgba(79,110,247,0.3);
  color: var(--accent-h);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
