/* ═══ Font Faces ═══ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../shared/fonts/Inter.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../shared/fonts/JetBrainsMono.woff2') format('woff2');
}

/* ═══ Reset ═══ */
*, *::before, *::after { box-sizing: border-box; }
html { transition: background-color 0.5s ease, color 0.3s ease; scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* ═══ Background Mesh (default blue/indigo — tools override via --mesh-1, --mesh-2) ═══ */
:root {
  --mesh-1: rgba(99,102,241,0.12);
  --mesh-1-dark: rgba(99,102,241,0.08);
  --mesh-2: rgba(139,92,246,0.10);
  --mesh-2-dark: rgba(139,92,246,0.06);
  --accent: rgba(99,102,241,0.3);
  --accent-hover: rgba(99,102,241,0.2);
  --accent-glow: rgba(99,102,241,0.4);
  --accent-glow2: rgba(139,92,246,0.3);
  --btn-start: #6366f1;
  --btn-end: #8b5cf6;
  --btn-shadow: rgba(99,102,241,0.3);
  --btn-shadow-hover: rgba(99,102,241,0.45);
  --caret: #6366f1;
  --caret-dark: #818cf8;
  --border-hover: rgba(99,102,241,0.3);
  --border-hover-dark: rgba(99,102,241,0.2);
  --shadow-hover: rgba(99,102,241,0.1);
  --shadow-hover-dark: rgba(99,102,241,0.05);
  --gradient-start: rgba(99,102,241,0.2);
  --gradient-mid: rgba(139,92,246,0.15);
}

.bg-mesh { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-mesh::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  top: -150px; right: -100px;
  background: radial-gradient(circle, var(--mesh-1) 0%, transparent 70%);
  border-radius: 50%; animation: float 8s ease-in-out infinite;
}
.bg-mesh::after {
  content: ''; position: absolute; width: 500px; height: 500px;
  bottom: -100px; left: -80px;
  background: radial-gradient(circle, var(--mesh-2) 0%, transparent 70%);
  border-radius: 50%; animation: float 10s ease-in-out infinite reverse;
}
.dark .bg-mesh::before { background: radial-gradient(circle, var(--mesh-1-dark) 0%, transparent 70%); }
.dark .bg-mesh::after { background: radial-gradient(circle, var(--mesh-2-dark) 0%, transparent 70%); }

/* ═══ Noise Overlay ═══ */
.noise-overlay {
  position: fixed; inset: 0; z-index: -1; opacity: 0.025; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ═══ Glassmorphism ═══ */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.dark .glass {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark .glass-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 1px var(--shadow-hover), 0 8px 32px rgba(0, 0, 0, 0.06);
}
.dark .glass-card:hover {
  border-color: var(--border-hover-dark);
  box-shadow: 0 0 0 1px var(--shadow-hover-dark), 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); }

/* ═══ Editor Textarea ═══ */
.editor-area {
  resize: none; border: none; outline: none; background: transparent; width: 100%;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.8125rem; line-height: 1.7;
  color: #1e293b; caret-color: var(--caret); transition: color 0.2s;
}
.dark .editor-area { color: #e2e8f0; caret-color: var(--caret-dark); }
.editor-area::placeholder { color: #94a3b8; }
.dark .editor-area::placeholder { color: #475569; }

.editor-container {
  position: relative; border-radius: 1rem; overflow: hidden;
}
.editor-container::before {
  content: ''; position: absolute; inset: 0; border-radius: 1rem; padding: 1px;
  background: linear-gradient(135deg, var(--accent), rgba(139,92,246,0.1), rgba(99,102,241,0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; opacity: 0; transition: opacity 0.3s ease;
}
.editor-container:focus-within::before { opacity: 1; }

/* ═══ Toast ═══ */
@keyframes toast-in { from { transform: translateY(16px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toast-out { from { transform: translateY(0) scale(1); opacity: 1; } to { transform: translateY(16px) scale(0.95); opacity: 0; } }
.toast-enter { animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast-exit { animation: toast-out 0.25s ease-in forwards; }

/* ═══ Animations ═══ */
@keyframes float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30px) scale(1.02); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 20px var(--btn-shadow); } 50% { box-shadow: 0 0 40px var(--btn-shadow-hover); } }
@keyframes shimmer { 0% { background-position: -200% center; } 100% { background-position: 200% center; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.fade-up { animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.scale-in { animation: scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s; opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }

/* ═══ Buttons ═══ */
.btn-base {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 1rem; font-size: 0.8125rem; font-weight: 500;
  border-radius: 0.625rem; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer; position: relative; overflow: hidden; text-decoration: none;
}
.btn-base:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--btn-start) 0%, var(--btn-end) 100%);
  color: white; box-shadow: 0 2px 12px var(--btn-shadow);
}
.btn-primary:hover {
  box-shadow: 0 4px 20px var(--btn-shadow-hover);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.06); color: #475569;
}
.dark .btn-secondary {
  background: rgba(30, 41, 59, 0.6); border-color: rgba(255, 255, 255, 0.08); color: #94a3b8;
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--btn-start); }
.dark .btn-secondary:hover { color: var(--caret-dark); }

.btn-ghost { color: #94a3b8; }
.btn-ghost:hover { color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.dark .btn-ghost { color: #64748b; }
.dark .btn-ghost:hover { color: #f87171; background: rgba(239, 68, 68, 0.1); }

/* ═══ Status Pills ═══ */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0.5rem; border-radius: 9999px;
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.01em;
  transition: all 0.3s ease;
}
.status-pill-valid { background: rgba(34,197,94,0.1); color: #16a34a; border: 1px solid rgba(34,197,94,0.2); }
.dark .status-pill-valid { color: #4ade80; background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.15); }
.status-pill-invalid { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.dark .status-pill-invalid { color: #f87171; background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.15); }
.status-pill-empty { background: rgba(100,116,139,0.08); color: #94a3b8; border: 1px solid rgba(100,116,139,0.12); }
.dark .status-pill-empty { color: #475569; background: rgba(100,116,139,0.1); border-color: rgba(100,116,139,0.1); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot-valid { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot-invalid { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.status-dot-empty { background: #94a3b8; }

/* ═══ Character Counter ═══ */
.char-counter {
  font-size: 0.6875rem; font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: #94a3b8; transition: color 0.2s;
}
.dark .char-counter { color: #475569; }

/* ═══ Gradient Line ═══ */
.gradient-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gradient-start), var(--gradient-mid), transparent);
}

/* ═══ Logo Glow ═══ */
.logo-glow { position: relative; }
.logo-glow::after {
  content: ''; position: absolute; inset: -4px; border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-glow), var(--accent-glow2));
  filter: blur(12px); opacity: 0.5; z-index: -1; transition: opacity 0.3s;
}
.logo-glow:hover::after { opacity: 0.8; }

/* ╀══ Theme Toggle ╀══ */
.theme-btn {
  position: relative; width: 40px; height: 40px; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.3s;
}
.theme-btn:hover { background: rgba(99, 102, 241, 0.08); }
.dark .theme-btn:hover { background: rgba(99, 102, 241, 0.12); }
.theme-btn svg { transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.theme-btn:hover svg { transform: rotate(15deg) scale(1.1); }

/* ═══ Drop Zone ═══ */
.drop-zone-inner {
  position: relative; border: 2px dashed rgba(148, 163, 184, 0.3);
  border-radius: 1.25rem; padding: 2.5rem 2rem; text-align: center;
  cursor: pointer; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.3);
}
.dark .drop-zone-inner {
  border-color: rgba(71, 85, 105, 0.4); background: rgba(30, 41, 59, 0.3);
}
.drop-zone-inner:hover {
  border-color: var(--border-hover); background: rgba(99, 102, 241, 0.02);
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.04) inset;
}

/* ═══ Tab Indicator ═══ */
.tab-indicator {
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ Preview Image ═══ */
.preview-img {
  max-height: 180px; object-fit: contain; border-radius: 0.75rem;
  border: 1px solid rgba(0,0,0,0.06);
}
.dark .preview-img { border-color: rgba(255,255,255,0.06); }

/* ═══ Toggle Pill ═══ */
.toggle-pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.375rem 0.75rem; border-radius: 0.625rem;
  font-size: 0.75rem; font-weight: 500; border: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.7); color: #64748b; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); backdrop-filter: blur(8px);
}
.dark .toggle-pill {
  background: rgba(30,41,59,0.6); border-color: rgba(255,255,255,0.08); color: #94a3b8;
}
.toggle-pill.active {
  background: linear-gradient(135deg, var(--btn-start) 0%, var(--btn-end) 100%);
  color: white; border-color: transparent; box-shadow: 0 2px 8px var(--btn-shadow);
}
.toggle-pill:hover:not(.active) { border-color: var(--border-hover); color: var(--btn-start); }
.dark .toggle-pill:hover:not(.active) { color: var(--caret-dark); }

/* ═══ Gradient Separator ═══ */
.gradient-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gradient-start), var(--gradient-mid), transparent);
}

/* ═══ Select ═══ */
.editor-area option, select {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}
