/* =============================================
   SAPLingo — secretshare.me design system
   ============================================= */

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

:root {
  --bg:        #06080d;
  --bg2:       #0c1018;
  --surface:   #111827;
  --surface2:  #1a2235;

  --border:    rgba(255, 255, 255, 0.06);
  --border2:   rgba(255, 255, 255, 0.10);

  --text:      #e2e8f0;
  --text2:     #b0bdd0;
  --text3:     #8b9bb5;

  --accent:    #a855f7;
  --accent-h:  #9333ea;
  --cyan:      #06b6d4;
  --rose:      #f43f5e;
  --green:     #10b981;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --blue:      #3b82f6;

  --grad:        linear-gradient(135deg, #06b6d4, #a855f7, #f43f5e);
  --grad-subtle: linear-gradient(135deg,
                   rgba(6,182,212,0.15),
                   rgba(168,85,247,0.15),
                   rgba(244,63,94,0.15));

  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --r:    12px;
  --r-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── BACKGROUND EFFECTS ──────────────────── */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(168,85,247,0.07) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 85% 50%, rgba(6,182,212,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 15% 70%, rgba(244,63,94,0.04) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

body::after {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none; z-index: 0;
}

/* ── SKIP LINK ──────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus { top: 16px; }

/* ── NAV ─────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: rgba(6, 8, 13, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--cyan);
  text-decoration: none;
  font-size: 15px;
}

.nav-links { display: flex; gap: 16px; align-items: center; }

.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ── HERO ────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 24px 48px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
  width: 700px; height: 400px;
  background:
    radial-gradient(ellipse 40% 60% at 30% 50%, rgba(6,182,212,0.1) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 50% 40%, rgba(168,85,247,0.1) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 70% 50%, rgba(244,63,94,0.08) 0%, transparent 70%);
  pointer-events: none;
  animation: heroPulse 6s ease-in-out infinite alternate;
}

@keyframes heroPulse {
  from { opacity: 0.6; transform: translateX(-50%) scale(1); }
  to   { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border: 1px solid rgba(168,85,247,0.25); border-radius: 100px;
  background: rgba(168,85,247,0.06);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 20px;
  animation: fadeDown 0.5s ease-out both;
}

.hero-badge .pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulseDot 2s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 12px;
  animation: fadeDown 0.6s 0.1s ease-out both;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #06b6d4 0%, #a855f7 40%, #f43f5e 80%, #06b6d4 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s linear infinite;
}

.hero-sub {
  font-size: 15px;
  color: var(--text2);
  max-width: 480px;
  margin: 0 auto 20px;
  line-height: 1.6;
  animation: fadeDown 0.6s 0.2s ease-out both;
}

.module-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeDown 0.6s 0.3s ease-out both;
}

.tag {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text3);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.tag:hover {
  border-color: rgba(168,85,247,0.35);
  color: var(--accent);
}

/* ── CONTAINER ───────────────────────────── */
.container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1;
  position: relative;
  z-index: 1;
}

/* ── EXAMPLES ────────────────────────────── */
.examples-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  font-weight: 600;
}

.examples {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ex {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.ex:hover {
  border-color: rgba(168,85,247,0.4);
  color: var(--text);
  background: rgba(168,85,247,0.04);
  transform: translateY(-1px);
}

.ex:active { transform: scale(0.97); }

/* ── INPUT ───────────────────────────────── */
.input-wrap {
  background: rgba(12,16,24,0.7);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
  border-color: rgba(168,85,247,0.4);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.08);
}

.query-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.7;
  padding: 16px 20px;
  resize: none;
}

.query-input::placeholder { color: var(--text3); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}

.translate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.translate-btn:hover { background: var(--accent-h); }
.translate-btn:active { transform: scale(0.97); }
.translate-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-shortcut {
  font-size: 10px;
  opacity: 0.6;
  font-family: var(--mono);
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-spinner.active { display: block; }

/* ── OUTPUT ──────────────────────────────── */
.output {
  background: rgba(12,16,24,0.7);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  animation: fadeUp 0.4s ease;
}

.result-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.result-header::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad);
  opacity: 0.6;
}

.entity-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.entity-module {
  background: rgba(168,85,247,0.1);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(168,85,247,0.2);
}

.entity-name {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.result-explanation {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

/* ── TABS ────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 13, 0.5);
}

.tab {
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text2); }

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

/* ── PANELS ──────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.code-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text3);
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 14px;
  min-height: 44px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s;
}

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

.code-block {
  padding: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  tab-size: 2;
}

/* ── BREAKDOWN ───────────────────────────── */
.breakdown {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bd-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
}

.bd-key {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 90px;
}

.bd-val {
  color: var(--text2);
  line-height: 1.5;
}

/* ── ERROR ───────────────────────────────── */
.error-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--r);
  padding: 16px 20px;
  color: var(--red);
  font-size: 13px;
  margin-top: 16px;
  animation: fadeUp 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.retry-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.retry-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ── HISTORY ─────────────────────────────── */
.history {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

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

.history-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.history-clear {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text3);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.history-clear:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--red);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(12,16,24,0.7);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  font-family: var(--font);
}

.history-item:hover {
  border-color: rgba(168,85,247,0.3);
  background: rgba(26,34,53,0.8);
}

.history-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.history-query {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-module {
  background: rgba(168,85,247,0.1);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.history-time {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── FOOTER ──────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text3);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

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

.footer-copy { font-size: 12px; color: var(--text3); }

/* ── FOCUS STYLES ────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── ANIMATIONS ──────────────────────────── */
@keyframes shimmer { to { background-position: 300% center; } }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseDot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.5; transform: scale(0.7); }
}

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

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 40px 20px 32px; }
  .hero-title { font-size: 24px; }
  .container { padding: 24px 16px; }
  .examples { gap: 6px; }
  .ex { font-size: 11px; padding: 5px 12px; }
  .tab { padding: 10px 14px; font-size: 12px; }
  .code-block { padding: 16px; font-size: 11px; }
  .hero::before { width: min(700px, 90vw); height: min(400px, 50vh); }
}

/* ── SCROLLBAR ──────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── SELECTION ──────────────────────────── */
::selection { background: rgba(168,85,247,0.3); color: #fff; }

/* ── REDUCED MOTION ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
