/* ── Settings page styles ─────────────────────────────────────────────────── */

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

:root {
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --muted:        #64748b;
  --primary:      #4f46e5;
  --primary-dark: #4338ca;
  --success:      #059669;
  --success-bg:   #d1fae5;
  --error:        #dc2626;
  --error-bg:     #fee2e2;
  --warning:      #d97706;
  --meta-blue:    #1877F2;
  --meta-dark:    #1558b0;
  --google-blue:  #4285F4;
  --google-dark:  #2c6fcd;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --font:         "Plus Jakarta Sans", "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Plus Jakarta Sans", "Avenir Next", "Segoe UI", sans-serif;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 16px 20px 10px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, #3c5cc5, #284290);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
.logo-text  {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.2px;
}

.header-tagline {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
}

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

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-link:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Main layout ─────────────────────────────────────────────────────────── */

.settings-main {
  max-width: 1120px;
  margin: 20px auto;
  padding: 0 20px 60px;
}

.settings-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 28px;
  color: var(--text);
}

/* ── Section ─────────────────────────────────────────────────────────────── */

.settings-section {
  margin-bottom: 32px;
}

.section-header {
  margin-bottom: 16px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
}

.section-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* ── Integration card ────────────────────────────────────────────────────── */

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
  transition: box-shadow .15s;
}
.integration-card:hover {
  box-shadow: var(--shadow-md);
}

.integration-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
}

.integration-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

.integration-info {
  flex: 1;
  min-width: 0;
}

.integration-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.integration-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.integration-status-wrap {
  flex-shrink: 0;
}

/* ── Status badges ───────────────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-loading    { background: #f1f5f9; color: var(--muted); }
.status-connected  { background: var(--success-bg); color: var(--success); }
.status-disconnected { background: #f1f5f9; color: var(--muted); }
.status-error      { background: var(--error-bg); color: var(--error); }

/* ── Integration body ────────────────────────────────────────────────────── */

.integration-body {
  padding: 0 20px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.connected-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.account-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.account-id {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
}

.linked-at {
  font-size: 12px;
  color: var(--muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-connect {
  color: #fff;
}

.btn-meta {
  background: var(--meta-blue);
}
.btn-meta:hover { background: var(--meta-dark); }

.btn-google {
  background: var(--google-blue);
}
.btn-google:hover { background: var(--google-dark); }

.btn-disconnect {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 7px 14px;
  font-size: 13px;
}
.btn-disconnect:hover {
  background: var(--error-bg);
}

/* ── Setup hint ──────────────────────────────────────────────────────────── */

.setup-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #92400e;
  flex: 1;
}

.setup-hint code {
  font-family: monospace;
  background: #fef3c7;
  padding: 1px 5px;
  border-radius: 3px;
}

.hint-icon { font-size: 16px; flex-shrink: 0; }

/* ── About list ──────────────────────────────────────────────────────────── */

.info-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.info-section .section-title {
  margin-bottom: 14px;
}

.about-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.about-icon {
  font-size: 17px;
  flex-shrink: 0;
  margin-top: 1px;
}

.about-list a {
  color: var(--primary);
  text-decoration: none;
}
.about-list a:hover { text-decoration: underline; }

/* ── Setup steps ─────────────────────────────────────────────────────────── */

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
}

.step-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.step-content code {
  font-family: monospace;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.step-content a {
  color: var(--primary);
  text-decoration: none;
}
.step-content a:hover { text-decoration: underline; }

.env-block {
  margin: 8px 0;
  background: #1e293b;
  color: #e2e8f0;
  font-family: monospace;
  font-size: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.7;
  white-space: pre;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(12px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  pointer-events: auto;
}

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

.toast-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.toast-error   { background: var(--error-bg);   color: #991b1b; border: 1px solid #fca5a5; }
.toast-info    { background: #eff6ff;            color: #1e40af; border: 1px solid #bfdbfe; }

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

@media (max-width: 600px) {
  .settings-main { margin: 16px auto; padding: 0 12px 40px; }
  .settings-title { font-size: 20px; }
  .integration-header { flex-wrap: wrap; gap: 12px; }
  .integration-status-wrap { order: -1; width: 100%; }
  .header-nav { gap: 6px; }
  .nav-link { padding: 5px 8px; font-size: 12px; }
  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  max-width: 1120px;
  margin: 0 auto 20px;
  padding: 0 20px;
}

.site-footer-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.site-footer-brand {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}

.site-footer-links {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.site-footer-links a {
  color: #475569;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

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