/* ============================================================
   URLPeek - Main Stylesheet
   Based on the existing design system
   ============================================================ */

:root {
  --accent:        #5865F2;
  --accent-hover:  #4752C4;
  --accent-glow:   rgba(88, 101, 242, 0.4);
  --accent-dim:    rgba(88, 101, 242, 0.15);
  --danger:        #ed4245;
  --danger-dim:    rgba(237, 66, 69, 0.12);
  --success:       #23a55a;
  --success-dim:   rgba(35, 165, 90, 0.12);

  --bg-page:       #0f0f11;
  --surface:       #1a1a1f;
  --bg-nav:        rgba(15, 15, 17, 0.85);
  --bg-btn:        #232329;
  --bg-btn-hover:  #2d2d35;

  --text:          #f0f0f2;
  --text-2:        #a0a0b0;
  --muted:         #606070;

  --border:        rgba(255, 255, 255, 0.07);
  --border-hover:  rgba(255, 255, 255, 0.14);

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-card:   0 4px 32px rgba(0, 0, 0, 0.45);
  --shadow-btn:    0 2px 12px rgba(88, 101, 242, 0.35);

  --nav-height:    60px;
  --transition:    0.2s ease;
  --font:          'Sora', 'DM Sans', system-ui, sans-serif;
}

.light-mode {
  --bg-page:       #f3f3f7;
  --surface:       #ffffff;
  --bg-nav:        rgba(243, 243, 247, 0.88);
  --bg-btn:        #eaeaf0;
  --bg-btn-hover:  #dddde8;

  --text:          #111116;
  --text-2:        #555566;
  --muted:         #9999aa;

  --border:        rgba(0, 0, 0, 0.07);
  --border-hover:  rgba(0, 0, 0, 0.14);

  --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-btn:    0 2px 12px rgba(88, 101, 242, 0.22);
  --accent-glow:   rgba(88, 101, 242, 0.25);
  --danger-dim:    rgba(237, 66, 69, 0.08);
  --success-dim:   rgba(35, 165, 90, 0.1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background-color: var(--bg-page);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 80px 24px 48px;
  max-width: 900px;
  margin: 0 auto;
}

.hero-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 40px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(36px, 8vw, 68px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 24px;
  color: var(--text);
}

.hero-title em {
  color: var(--accent);
  font-style: normal;
  border-bottom: 2px solid var(--accent-glow);
}

.hero-sub {
  font-size: 18px;
  color: var(--text-2);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ── Resolve Section ────────────────────────────────────────── */
.resolve-section {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.resolve-form {
  width: 100%;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-dim);
  border: 1px solid rgba(237, 66, 69, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.error-icon {
  font-size: 16px;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 16px 20px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.url-input::placeholder {
  color: var(--muted);
}

.url-input--error {
  color: var(--danger);
}

.resolve-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.resolve-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.resolve-btn:active {
  transform: translateY(0);
}

.btn-arrow {
  font-size: 18px;
  transition: transform var(--transition);
}

.resolve-btn:hover .btn-arrow {
  transform: translateX(3px);
}

.rate-info {
  text-align: center;
  margin-top: 16px;
}

.rate-info__text {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 40px;
  border: 1px solid var(--border);
  display: inline-block;
}

/* ── History Section ────────────────────────────────────────── */
.history-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.history-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.history-clear-btn {
  background: transparent;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.history-clear-btn:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

.history-empty {
  text-align: center;
  padding: 48px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-2);
  font-size: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-btn);
  transform: translateX(4px);
}

.history-item__input {
  flex: 2;
  font-size: 13px;
  font-family: monospace;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__arrow {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.history-item__final {
  flex: 3;
  font-size: 13px;
  font-family: monospace;
  color: var(--success);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__time {
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Result Page Styles (if needed) ─────────────────────────── */
.result-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.result-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.result-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.result-label {
  width: 120px;
  font-weight: 600;
  color: var(--text-2);
}

.result-value {
  flex: 1;
  color: var(--text);
  word-break: break-all;
  font-family: monospace;
  font-size: 14px;
}

.result-value.success {
  color: var(--success);
}

.result-value.danger {
  color: var(--danger);
}

.redirect-chain {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.chain-item {
  padding: 8px 0;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin-left: 8px;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-2);
}

.chain-item:not(:last-child) {
  border-left-color: var(--accent-dim);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

/* ── Utilities ──────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fade-up {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero, .resolve-section, .history-section {
  animation: fade-up 0.4s ease both;
}

.history-section {
  animation-delay: 0.1s;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .hero {
    padding: 48px 20px 32px;
  }

  .hero-title {
    font-size: 40px;
  }

  .hero-sub {
    font-size: 16px;
  }

  .input-row {
    flex-direction: column;
    background: transparent;
    border: none;
    gap: 12px;
  }

  .url-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%;
  }

  .resolve-btn {
    width: 100%;
    justify-content: center;
  }

  .history-item {
    flex-wrap: wrap;
  }

  .history-item__input,
  .history-item__final {
    flex: 1 1 100%;
    white-space: normal;
    word-break: break-all;
  }

  .history-item__arrow {
    display: none;
  }

  .history-item__time {
    margin-top: 6px;
  }
}

@media (max-width: 480px) {
  .result-card {
    padding: 20px;
  }

  .result-detail {
    flex-direction: column;
    gap: 4px;
  }

  .result-label {
    width: auto;
  }
}