/* ShareURL – Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg:           #080810;
  --bg2:          #0d0d18;
  --primary:      #5b4fef;
  --primary-h:    #4f46e5;
  --border:       rgba(255,255,255,0.07);
  --border2:      rgba(255,255,255,0.12);
  --glass-bg:     rgba(255,255,255,0.03);
  --card-bg:      rgba(13,13,22,0.97);
  --text-muted:   rgba(255,255,255,0.5);
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── Dot-grid background pattern ──────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  z-index: 0;
}

/* ── Top gradient glow ─────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  top: -25%;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, 140vw);
  height: 900px;
  background: radial-gradient(ellipse at 50% 30%,
    rgba(88,70,220,0.22) 0%,
    rgba(120,60,200,0.10) 38%,
    rgba(60,40,140,0.04) 62%,
    transparent 78%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.09); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Glass panel ───────────────────────────────────────── */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

/* ── Upload card ───────────────────────────────────────── */
.upload-card {
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.035) inset,
    0 1px 0 rgba(255,255,255,0.07) inset;
}

/* ── Tab buttons ───────────────────────────────────────── */
.tab-btn {
  transition: all 0.22s cubic-bezier(.22,.68,0,1.1);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.42);
  border: 1px solid transparent;
  flex: 1;
  user-select: none;
}
.tab-btn:hover:not(.active-tab) {
  background: rgba(255,255,255,0.045);
  color: rgba(255,255,255,0.72);
  border-color: rgba(255,255,255,0.06);
}
.active-tab {
  background: linear-gradient(135deg, #5b4fef 0%, #7c3aed 100%) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 20px rgba(91,79,239,0.38), 0 1px 0 rgba(255,255,255,0.15) inset;
}

/* ── Toggle switch ─────────────────────────────────────── */
.toggle-track {
  width: 40px; height: 22px;
  background: rgba(255,255,255,0.12);
  border-radius: 9999px;
  position: relative;
  transition: background 0.25s;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-track.on { background: #5b4fef; }
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.toggle-track.on .toggle-thumb { transform: translateX(18px); }

/* ── Option row inputs ─────────────────────────────────── */
.opt-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  width: 100%;
  -moz-appearance: textfield;
}
.opt-input::placeholder { color: rgba(255,255,255,0.26); }
.opt-input:focus {
  border-color: rgba(91,79,239,0.5);
  background: rgba(91,79,239,0.04);
  box-shadow: 0 0 0 3px rgba(91,79,239,0.08);
}
.opt-input::-webkit-outer-spin-button,
.opt-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.opt-select {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.opt-select option { background: #0d0d18; color: #fff; }

/* ── Generate / main button ────────────────────────────── */
.btn-generate {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #5b4fef 0%, #7c3aed 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(91,79,239,0.38);
  white-space: nowrap;
  user-select: none;
}
.btn-generate::after {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 60%; height: 200%;
  background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: btn-shimmer 3s ease-in-out infinite;
}
@keyframes btn-shimmer {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  50%  { left: 130%; opacity: 0; }
  100% { left: 130%; opacity: 0; }
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 10px 36px rgba(91,79,239,0.55); }
.btn-generate:active { transform: translateY(0); box-shadow: 0 2px 12px rgba(91,79,239,0.28); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-generate:disabled::after { display: none; }

/* ── Dropzone ──────────────────────────────────────────── */
.dropzone {
  border: 1.5px dashed rgba(255,255,255,0.13);
  border-radius: 16px;
  min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255,255,255,0.012), rgba(255,255,255,0.006));
}
.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(91,79,239,0.05) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.dropzone:hover { border-color: rgba(91,79,239,0.45); }
.dropzone:hover::before { opacity: 1; }
.dropzone.drag-over {
  border-color: #6366f1;
  border-style: solid;
  background: rgba(91,79,239,0.04);
  transform: scale(1.008);
  box-shadow: inset 0 0 40px rgba(91,79,239,0.06);
}
.dropzone.drag-over::before { opacity: 1; }

/* ── Secret mode — pulsing card border ─────────────────── */
.secret-mode-active {
  border-color: rgba(245,158,11,0.3) !important;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.55),
    0 0 0 1px rgba(245,158,11,0.1) inset,
    0 0 30px rgba(245,158,11,0.04) !important;
  animation: secret-pulse 2s ease-in-out infinite;
}
@keyframes secret-pulse {
  0%, 100% { box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(245,158,11,0.1) inset, 0 0 20px rgba(245,158,11,0.04); }
  50%       { box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(245,158,11,0.2) inset, 0 0 40px rgba(245,158,11,0.08); }
}

/* ── Shake animation for errors ────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  90%  { transform: translateX(2px); }
}
.shake { animation: shake 0.45s ease-out; }

/* ── Upload progress bar ───────────────────────────────── */
.progress-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #5b4fef, #818cf8, #7c3aed);
  background-size: 200% 100%;
  border-radius: 9999px;
  transition: width 0.25s ease;
  animation: progress-shimmer 1.5s linear infinite;
}
@keyframes progress-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Image preview in dropzone ─────────────────────────── */
#img-preview-wrap {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#img-preview {
  max-height: 200px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ── Fullscreen image viewer ───────────────────────────── */
#fullscreen-viewer {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.94);
  backdrop-filter: blur(24px) saturate(120%);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
#fullscreen-viewer img {
  max-width: 94vw;
  max-height: 94vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 32px 120px rgba(0,0,0,0.7);
  animation: zoom-in 0.2s cubic-bezier(.22,.68,0,1.2);
}
@keyframes zoom-in { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#fullscreen-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  transition: all 0.15s;
}
#fullscreen-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Social share buttons ──────────────────────────────── */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
.share-btn:hover { transform: translateY(-1px); }
.share-btn-twitter  { background: rgba(29,161,242,0.10); border-color: rgba(29,161,242,0.22); color: #1da1f2; }
.share-btn-twitter:hover  { background: rgba(29,161,242,0.18); }
.share-btn-whatsapp { background: rgba(37,211,102,0.10); border-color: rgba(37,211,102,0.22); color: #25d366; }
.share-btn-whatsapp:hover { background: rgba(37,211,102,0.18); }
.share-btn-email    { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.55); }
.share-btn-email:hover    { background: rgba(255,255,255,0.09); color: #fff; }
.share-btn-telegram { background: rgba(0,136,204,0.10); border-color: rgba(0,136,204,0.22); color: #0088cc; }
.share-btn-telegram:hover { background: rgba(0,136,204,0.18); }

/* ── Code editors ──────────────────────────────────────── */
.code-editor {
  caret-color: #818cf8;
  color: rgba(255,255,255,0.85);
  line-height: 1.75;
  tab-size: 2;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.845rem;
}
.code-editor:focus { outline: none; }

/* ── Nav links (admin) ─────────────────────────────────── */
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500;
  color: rgba(255,255,255,0.42);
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); }
.nav-link.active {
  background: rgba(91,79,239,0.14);
  color: #a5b4fc;
  border-color: rgba(91,79,239,0.25);
}

/* ── Character counter ─────────────────────────────────── */
.char-counter {
  font-size: 0.69rem;
  color: rgba(255,255,255,0.22);
  text-align: right;
  padding: 3px 4px;
  transition: color 0.2s;
  font-variant-numeric: tabular-nums;
}
.char-counter.warn { color: rgba(245,158,11,0.65); }
.char-counter.over { color: rgba(239,68,68,0.75); }

/* ── Markdown / Prose ──────────────────────────────────── */
.prose-invert { color: rgba(255,255,255,0.78); line-height: 1.8; }
.prose-invert h1,.prose-invert h2,.prose-invert h3,.prose-invert h4 { color: #fff; margin: 1.75rem 0 0.6rem; font-weight: 700; line-height: 1.2; }
.prose-invert h1 { font-size: 2rem; }
.prose-invert h2 { font-size: 1.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.prose-invert h3 { font-size: 1.25rem; }
.prose-invert h4 { font-size: 1.05rem; }
.prose-invert p  { margin: 0.8rem 0; }
.prose-invert a  { color: #818cf8; text-decoration: underline; text-underline-offset: 2px; }
.prose-invert a:hover { color: #a5b4fc; }
.prose-invert code { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); border-radius: 5px; padding: 2px 7px; font-size: 0.875em; font-family: 'JetBrains Mono', monospace; color: #c4b5fd; }
.prose-invert pre { background: #0a0a14; border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1.2rem 0; }
.prose-invert pre code { background: none; border: none; padding: 0; color: rgba(255,255,255,0.8); font-size: 0.83rem; }
.prose-invert ul,.prose-invert ol { margin: 0.8rem 0; padding-left: 1.8rem; }
.prose-invert li { margin: 0.35rem 0; }
.prose-invert blockquote { border-left: 3px solid rgba(91,79,239,0.5); background: rgba(91,79,239,0.06); padding: 0.75rem 1.25rem; margin: 1.2rem 0; border-radius: 0 12px 12px 0; color: rgba(255,255,255,0.62); }
.prose-invert hr { border: none; border-top: 1px solid rgba(255,255,255,0.09); margin: 2rem 0; }
.prose-invert img { max-width: 100%; border-radius: 12px; margin: 0.5rem 0; }
.prose-invert table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: 0.9rem; }
.prose-invert th { background: rgba(255,255,255,0.06); padding: 0.65rem 1rem; text-align: left; font-weight: 600; border: 1px solid rgba(255,255,255,0.1); }
.prose-invert td { padding: 0.6rem 1rem; border: 1px solid rgba(255,255,255,0.07); }
.prose-invert tr:hover td { background: rgba(255,255,255,0.02); }
.prose-invert strong { color: #fff; }
.prose-invert em { color: rgba(255,255,255,0.72); }

/* ── Animations ────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.5s cubic-bezier(.22,.68,0,1.2) both; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
.pop-in { animation: pop-in 0.3s cubic-bezier(.34,1.56,.64,1) both; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.float { animation: float 3s ease-in-out infinite; }

/* ── File type badge ───────────────────────────────────── */
.file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Host project toolbar ──────────────────────────────── */
.host-toolbar {
  background: rgba(13,13,22,0.99);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.editor-pane  { background: #0a0a12; }
.preview-pane { background: #fff; }

/* ── Reading time badge ────────────────────────────────── */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.3);
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
}

/* ── Stat pill ─────────────────────────────────────────── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  color: rgba(255,255,255,0.42);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ── Step number circles ───────────────────────────────── */
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.875rem; flex-shrink: 0;
  background: linear-gradient(135deg, #5b4fef, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 12px rgba(91,79,239,0.35);
}

/* ── View page image zoom hint ─────────────────────────── */
.img-zoom-hint {
  position: absolute;
  bottom: 16px; right: 16px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  display: flex; align-items: center; gap: 5px;
  pointer-events: none;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s;
}
.img-container:hover .img-zoom-hint { opacity: 1; }
.img-container img { cursor: zoom-in; transition: transform 0.25s; }
.img-container:hover img { transform: scale(1.005); }

/* ── "How it works" step connector ────────────────────── */
.step-connector {
  width: 1px;
  background: linear-gradient(to bottom, rgba(91,79,239,0.4), transparent);
  height: 30px;
  margin: 2px auto;
}

/* ── Feature grid item ─────────────────────────────────── */
.feature-item {
  transition: all 0.25s;
}
.feature-item:hover {
  border-color: rgba(91,79,239,0.28) !important;
  background: rgba(91,79,239,0.035) !important;
  transform: translateY(-2px);
}

/* ── Keyboard shortcut badge ───────────────────────────── */
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom-width: 2px;
  color: rgba(255,255,255,0.5);
}

/* ── QR container ──────────────────────────────────────── */
#qr-container { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ── Ripple button effect ──────────────────────────────── */
.ripple-wrap { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  animation: ripple-anim 0.5s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .upload-card { border-radius: 16px !important; }
  .btn-generate { font-size: 0.875rem; padding: 11px 20px; }
  .btn-generate::after { display: none; }
}

/* ── Toast ─────────────────────────────────────────────── */
#toast { pointer-events: none; }

/* ── Admin table ───────────────────────────────────────── */
.admin-table tr td, .admin-table tr th { border-color: rgba(255,255,255,0.05); }
