/* ════════════════════════════════════════════
   Quotera — Base / Shared Components
   Import after tokens.css on every page.
════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Layout helpers ──────────────────────── */
.container    { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 640px;  margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container, .container-sm { padding: 0 16px; } }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px;
  border: none; border-radius: var(--r);
  font-family: var(--font); font-size: .875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--dur) var(--ease), box-shadow var(--dur), opacity var(--dur), transform .1s;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--primary-hover); box-shadow: var(--sh-primary); }

.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover:not(:disabled)  { background: var(--primary-light); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg2); }

.btn-ghost    { background: transparent; color: var(--text-sub); }
.btn-ghost:hover:not(:disabled) { background: var(--bg2); color: var(--text); }

.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-lg   { padding: 14px 28px; font-size: 1rem;  border-radius: var(--r-lg); }
.btn-sm   { padding: 7px  12px; font-size: .8rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-full { width: 100%; }

/* ── Inputs ──────────────────────────────── */
.input, .textarea, .select {
  display: block; width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: .9rem;
  transition: border-color var(--dur), box-shadow var(--dur);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 80px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 40px; }
.input-icon-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ── Labels & form groups ────────────────── */
.label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-sub); margin-bottom: 5px; }
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }
.form-hint { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--red); margin-top: 4px; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
}
.card-body   { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ── Divider ─────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Alerts ──────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--r); font-size: .85rem; line-height: 1.5; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-bd); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #c7d2fe; }

/* ── Badge ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--green-bg); color: var(--green); }

/* ── Spinner ─────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: qg-spin .7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes qg-spin { to { transform: rotate(360deg); } }

/* ── Avatar ──────────────────────────────── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gradient); color: #fff;
  font-weight: 700; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Toggle switch ───────────────────────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border2); border-radius: var(--r-full);
  cursor: pointer; transition: background .2s var(--ease);
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle-track::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track::before { transform: translateX(20px); }

/* ── Tabs ────────────────────────────────── */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); gap: 0; margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  font-size: .875rem; font-weight: 500; color: var(--muted);
  cursor: pointer; background: none;
  border: none; border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px; font-family: var(--font);
  transition: color var(--dur), border-color var(--dur);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Loading screen ──────────────────────── */
#loadingScreen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  transition: opacity .3s var(--ease);
}
#loadingScreen.hidden { opacity: 0; pointer-events: none; }

/* ── Google button ───────────────────────── */
.btn-google {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
  width: 100%; gap: 10px;
}
.btn-google:hover:not(:disabled) { background: var(--bg2); }
.btn-google svg { flex-shrink: 0; }
