/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #222222;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --text-muted: #999999;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 8px;
  --max-width: 560px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1rem; }
.centered { text-align: center; }

/* --- Header --- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
}
.header-logo { font-weight: 700; font-size: 1.1rem; }
.header-nav { display: flex; gap: 1rem; align-items: center; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.625rem 1.25rem; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Forms --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.375rem; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 0.625rem 0.75rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; font-family: inherit;
  transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* --- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}

/* --- Link List Items --- */
.link-item-wrapper {
  margin-bottom: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color 0.15s;
}
.link-item-wrapper:hover { border-color: var(--accent); }
.link-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.link-item:hover { }
.link-reorder {
  display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.reorder-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.6rem; padding: 0.1rem 0.3rem; line-height: 1;
  transition: color 0.15s;
}
.reorder-btn:hover:not(:disabled) { color: var(--accent); }
.reorder-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.link-edit-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 0.3rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.link-edit-btn:hover { color: var(--accent); background: rgba(99,102,241,0.1); }
.link-edit-btn.expanded { color: var(--accent); }
.link-edit-panel {
  padding: 0 1rem 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  border-top: 1px solid var(--border);
}
.link-item-content { flex: 1; min-width: 0; }
.link-item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-item-url { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-item-actions { display: flex; gap: 0.375rem; flex-shrink: 0; }
.link-platform-badge {
  display: inline-block; font-size: 0.65rem; font-weight: 600;
  background: var(--accent); color: white; padding: 0.1rem 0.4rem;
  border-radius: 4px; margin-left: 0.4rem; vertical-align: middle;
  text-transform: uppercase; letter-spacing: 0.03em;
}

/* --- Toggle Switch --- */
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 11px; cursor: pointer; transition: background 0.2s;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 16px; height: 16px;
  left: 3px; top: 3px; background: white;
  border-radius: 50%; transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* --- Landing Page --- */
.hero { padding: 4rem 0 2rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 2rem; max-width: 440px; margin-left: auto; margin-right: auto; }
.claim-form { display: flex; gap: 0; max-width: 400px; margin: 0 auto; }
.claim-prefix {
  display: flex; align-items: center; padding: 0 0.75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.9rem; color: var(--text-muted); white-space: nowrap;
}
.claim-form .form-input {
  border-radius: 0; flex: 1;
}
.claim-form .btn {
  border-radius: 0 var(--radius) var(--radius) 0; white-space: nowrap;
}

.features { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 3rem 0; }
.feature { padding: 1.25rem; }
.feature-icon { margin-bottom: 0.75rem; line-height: 1; }
.feature-icon svg { width: 28px; height: 28px; }
.feature h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.feature p { font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 500px) {
  .hero h1 { font-size: 1.75rem; }
  .features { grid-template-columns: 1fr; }
  .claim-form { flex-direction: column; }
  .claim-prefix { border-radius: var(--radius) var(--radius) 0 0; justify-content: center; }
  .claim-form .form-input { border-radius: 0; }
  .claim-form .btn { border-radius: 0 0 var(--radius) var(--radius); }
}

/* --- Alert / Toast --- */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius);
  font-size: 0.9rem; margin-bottom: 1rem;
}
.alert-error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }

/* --- Public URL Bar --- */
.url-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
}
.url-bar-link { flex: 1; font-size: 0.9rem; color: var(--accent); word-break: break-all; }
.url-bar .btn { flex-shrink: 0; }

/* --- Section Headings --- */
.section-title { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }

/* --- Theme Selector --- */
.theme-options { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.theme-option {
  width: 80px; height: 56px; border-radius: var(--radius);
  border: 2px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; transition: border-color 0.15s;
}
.theme-option:hover { border-color: var(--text-muted); }
.theme-option.active { border-color: var(--accent); }
.theme-light { background: #ffffff; color: #111111; }
.theme-dark { background: #0f0f0f; color: #f5f5f5; }
.theme-bold { background: #1e1b4b; color: #f59e0b; }

/* --- Footer --- */
.footer { text-align: center; padding: 2rem 0; font-size: 0.8rem; color: var(--text-muted); }
.footer a { color: var(--text-muted); text-decoration: underline; }
