@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

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

:root {
  --bg:             #FFFFFF;
  --surface:        #F4F8FF;
  --surface-raised: #FFFFFF;
  --surface-hover:  #E0E7F1;
  --border:         #E0E7F1;
  --border-subtle:  #F4F8FF;
  --accent:         #0254EC;
  --accent-dim:     #173AAA;
  --accent-hover:   #137AF4;
  --accent-glow:    rgba(2, 84, 236, 0.08);
  --pink:           #C56BA4;
  --pink-bright:    #FFBFFF;
  --text:           #01123F;
  --text-secondary: #25242F;
  --text-muted:     #717783;
  --success:        #16a34a;
  --danger:         #dc2626;
  --radius:         8px;
  --radius-sm:      5px;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(2,84,236,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(255,191,255,0.08) 0%, transparent 50%),
              var(--bg);
}

.login-card {
  text-align: center;
  padding: 48px 36px;
}

.login-logo {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ─── Setup wizard ────────────────────────────────────────────────────────── */

.setup-wizard {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(2,84,236,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(255,191,255,0.08) 0%, transparent 50%),
              var(--bg);
}

.setup-card {
  max-width: 480px;
  width: 100%;
  padding: 48px 36px;
}

.setup-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

.setup-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.setup-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  gap: 12px;
}

.setup-actions .btn-secondary {
  min-width: 80px;
}

.setup-actions .btn-primary {
  margin-left: auto;
  min-width: 120px;
}

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

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 740px;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px;
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 16px 0;
}

.user-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 2px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 16px 14px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

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

.main {
  flex: 1;
  padding: 28px 0 60px;
}

.panel { display: block; }
.hidden { display: none !important; }

/* ─── Fields ──────────────────────────────────────────────────────────────── */

.field { margin-bottom: 16px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
}

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

.optional {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

input, textarea, select {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

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

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

#content-input { min-height: 110px; }
#champion-notes { min-height: 70px; }

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2301123F' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

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

.btn-primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.scan-btn-width { max-width: 220px; margin: 0 auto; }

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 4px;
  cursor: pointer;
  transition: color 0.15s;
}

.btn-danger:hover { color: var(--danger); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

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

/* ─── Toggle group ────────────────────────────────────────────────────────── */

.toggle-group {
  display: flex;
  gap: 3px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
}

.toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toggle.active { background: var(--accent); color: #fff; }
.toggle:not(.active):hover { color: var(--text); }

/* ─── Chips ───────────────────────────────────────────────────────────────── */

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ─── Draft results ───────────────────────────────────────────────────────── */

.draft-results {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

@media (max-width: 620px) {
  .draft-results { grid-template-columns: 1fr; }
}

.draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

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

.draft-angle {
  font-size: 10px;
  font-weight: 700;
  color: var(--pink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.draft-content {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
  flex: 1;
}

.draft-card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.btn-deposit {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-deposit:hover { border-color: var(--success); color: var(--success); }

/* ─── Suggestions tab ─────────────────────────────────────────────────────── */

.scan-area {
  text-align: center;
  padding: 20px 0 24px;
}

.scan-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 20px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.suggestion-results {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

@media (max-width: 620px) {
  .suggestion-results { grid-template-columns: 1fr; }
}

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

.suggestion-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.suggestion-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.suggestion-pill {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

.suggestion-insight {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 7px;
}

.suggestion-angle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}

.suggestion-angle strong { color: var(--text); }

.use-suggestion-btn { width: 100%; font-size: 12px; padding: 7px 12px; }

/* ─── Champions tab ───────────────────────────────────────────────────────── */

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

.champions-count { font-size: 12px; color: var(--text-muted); }

.champions-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-select {
  flex: 1;
  max-width: 200px;
  font-size: 12px;
  padding: 6px 28px 6px 10px;
}

.champions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.champion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s;
}

.champion-card:hover { border-color: var(--accent); }

.champion-info { display: flex; align-items: center; gap: 10px; min-width: 0; }

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

.champion-details { min-width: 0; }

.champion-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champion-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champion-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── Deposit dots ────────────────────────────────────────────────────────── */

.deposit-dots { display: flex; gap: 3px; align-items: center; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}

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

/* ─── Champion drafts (inline on cards) ───────────────────────────────────── */

.champion-card-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.champion-card-wrapper:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(2,84,236,0.08); }

.champion-card-wrapper .champion-card {
  border: none;
  background: none;
}

.champion-card-wrapper .champion-card:hover { border-color: transparent; }

.draft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  padding: 0 5px;
}

.champion-drafts {
  padding: 0 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.champion-draft {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.champion-draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.champion-draft-source {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.champion-draft-date {
  font-size: 10px;
  color: var(--text-muted);
}

.champion-draft-reason {
  font-size: 11px;
  color: var(--success);
  font-style: italic;
  margin-bottom: 6px;
}

.champion-draft-message {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
  white-space: pre-line;
}

.champion-draft-link {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 8px;
  word-break: break-all;
}

.champion-draft-link:hover { text-decoration: underline; }

.champion-draft-actions {
  display: flex;
  gap: 4px;
}

.champion-draft-actions .btn-icon { font-size: 11px; padding: 3px 7px; }

.use-draft-btn:hover { color: var(--success) !important; }
.dismiss-draft-btn:hover { color: var(--danger) !important; }

/* ─── Empty state ─────────────────────────────────────────────────────────── */

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; margin-bottom: 6px; }
.empty-state .hint { color: var(--text-muted); font-size: 13px; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */

.modal { position: fixed; inset: 0; z-index: 100; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 18, 63, 0.3);
}

.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(1, 18, 63, 0.12);
}

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

.modal-header h2 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.modal-save-btn { flex: 1; margin-left: 12px; }

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

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--text);
  border: none;
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 200;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

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

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

.btn-primary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

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

.settings-section {
  max-width: 420px;
}

.settings-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.settings-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.settings-save-width {
  max-width: 160px;
}

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

.btn-primary.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
