/* ═══════════════════════════════════════════
   CSS VARIABLES & THEMES
   ═══════════════════════════════════════════ */
:root {
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'DM Mono', 'Consolas', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
  --transition: .25s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg-primary: #0c0e14;
  --bg-secondary: #141721;
  --bg-tertiary: #1a1e2e;
  --bg-elevated: #1f2437;
  --bg-hover: #252b3f;
  --border-default: #2a3048;
  --border-focus: #5b6abf;
  --text-primary: #e8eaf0;
  --text-secondary: #9499b0;
  --text-tertiary: #8a8fa6;
  --accent: #7c8aef;
  --accent-hover: #9ba5f5;
  --accent-subtle: rgba(124,138,239,.12);
  --accent-glow: rgba(124,138,239,.25);
  --success: #4ade80;
  --success-bg: rgba(74,222,128,.1);
  --error: #f87171;
  --error-bg: rgba(248,113,113,.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,.1);
  --dropzone-bg: #141721;
  --dropzone-border: #2a3048;
  --dropzone-active: rgba(124,138,239,.15);
  --code-bg: #0f1119;
  --scrollbar-track: #141721;
  --scrollbar-thumb: #2a3048;
  --tag-bg: rgba(124,138,239,.15);
  --tag-text: #9ba5f5;
  --grain-opacity: .03;
}

[data-theme="light"] {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #edf0f7;
  --bg-elevated: #ffffff;
  --bg-hover: #e8ecf5;
  --border-default: #d4d9e8;
  --border-focus: #5b6abf;
  --text-primary: #1a1e2e;
  --text-secondary: #5a6078;
  --text-tertiary: #8b90a5;
  --accent: #5b6abf;
  --accent-hover: #4a58a8;
  --accent-subtle: rgba(91,106,191,.08);
  --accent-glow: rgba(91,106,191,.2);
  --success: #16a34a;
  --success-bg: rgba(22,163,74,.08);
  --error: #dc2626;
  --error-bg: rgba(220,38,38,.08);
  --warning: #d97706;
  --warning-bg: rgba(217,119,6,.08);
  --dropzone-bg: #ffffff;
  --dropzone-border: #d4d9e8;
  --dropzone-active: rgba(91,106,191,.1);
  --code-bg: #f0f2f8;
  --scrollbar-track: #edf0f7;
  --scrollbar-thumb: #c8cde0;
  --tag-bg: rgba(91,106,191,.1);
  --tag-text: #4a58a8;
  --grain-opacity: .015;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

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

/* Skip navigation link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  z-index: 10001;
  font-size: 14px;
  font-family: var(--font-display);
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top .2s;
}
.skip-link:focus {
  top: 0;
}

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

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

::selection { background: var(--accent-subtle); color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
.app-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.logo-text span { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse-privacy 2s ease infinite;
}

@keyframes pulse-privacy {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ═══════════════════════════════════════════
   HERO / SUBTITLE
   ═══════════════════════════════════════════ */
.hero-section {
  text-align: center;
  margin-bottom: 36px;
}

.hero-section .hero-description {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

.format-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.format-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 99px;
  letter-spacing: .3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.format-tag:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.format-tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════
   MAIN CONVERTER CARD
   ═══════════════════════════════════════════ */
.converter-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
}

/* ─── Controls Bar ─── */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-tertiary);
}

.control-select {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 32px 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239499b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
  min-width: 160px;
}

.control-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.arrow-icon {
  color: var(--accent);
  font-size: 20px;
  align-self: flex-end;
  padding-bottom: 6px;
  user-select: none;
}

.controls-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-self: flex-end;
}

.btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ─── Editor Panels ─── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  position: relative;
}

.editor-panel + .editor-panel {
  border-left: 1px solid var(--border-default);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  min-height: 46px;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.panel-actions { display: flex; gap: 4px; }

.editor-area {
  flex: 1;
  position: relative;
  max-height: 500px;
  overflow-y: auto;
}

.editor-area textarea {
  width: 100%;
  height: 100%;
  min-height: 380px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--code-bg);
  border: none;
  resize: none;
  outline: none;
  tab-size: 2;
}

.editor-area textarea::placeholder { color: var(--text-tertiary); }

.output-display {
  width: 100%;
  height: 100%;
  min-height: 380px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--code-bg);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Drop Zone ─── */
.dropzone {
  border: 2px dashed var(--dropzone-border);
  border-radius: var(--radius-lg);
  background: var(--dropzone-bg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin: 20px;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--dropzone-active);
}

.dropzone-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: .6;
}

.dropzone-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.dropzone input[type="file"] { display: none; }

/* ─── Status Bar ─── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-tertiary);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  min-height: 40px;
}

.status-message {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.status-dot.success { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.error { background: var(--error); box-shadow: 0 0 6px var(--error); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }

.status-meta { display: flex; gap: 16px; }

/* ═══════════════════════════════════════════
   QUICK CONVERTERS (Text Encoding Section)
   ═══════════════════════════════════════════ */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  font-family: var(--font-display);
  font-size: 13px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .3s ease-out;
  max-width: 360px;
}

.toast.success { border-color: var(--success); background: var(--success-bg); }
.toast.error { border-color: var(--error); background: var(--error-bg); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.app-footer {
  text-align: center;
  padding: 24px 0 32px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-default);
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .app-wrapper { padding: 0 12px; }
  .header-inner { height: 56px; }
  .logo-text { font-size: 17px; }
  .hero-section .hero-description { font-size: 13px; }
  .format-tags { gap: 5px; }
  .format-tag { font-size: 10px; padding: 3px 8px; }
  .controls-bar { padding: 14px 16px; flex-direction: column; align-items: stretch; }
  .control-select { min-width: 100%; }
  .arrow-icon { text-align: center; transform: rotate(90deg); padding: 0; align-self: center; }
  .controls-actions { justify-content: stretch; }
  .controls-actions .btn { flex: 1; justify-content: center; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-panel + .editor-panel { border-left: none; border-top: 1px solid var(--border-default); }
  .editor-area textarea, .output-display { min-height: 240px; }
  .dropzone { margin: 12px; padding: 24px 16px; }
  .status-bar { flex-direction: column; gap: 4px; text-align: center; }
}

@media (max-width: 480px) {
  .hero-section { margin-bottom: 20px; }
  .format-tags { display: none; }
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.converter-card { animation: fadeIn .5s ease-out; }

/* Pulse on convert */
.pulse {
  animation: pulse .4s ease-out;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

/* ===== SITE FOOTER ===== */
.site-footer{
  margin-top:60px;padding:48px 28px 36px;
  border-top:1px solid var(--border-default);
  background:var(--bg-primary);color:var(--text-secondary);
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  font-size:14px;line-height:1.6;
}
.site-footer .footer-inner{max-width:1100px;margin:0 auto}
.site-footer .footer-grid{
  display:grid;grid-template-columns:2fr 1fr 1fr 1fr;
  gap:40px;margin-bottom:40px;
}
.site-footer .footer-brand{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.site-footer .footer-brand svg{width:32px;height:32px;color:#a855f7;flex-shrink:0}
.site-footer .footer-brand-name{
  font-size:20px;font-weight:700;
  background:linear-gradient(90deg,#8B5CF6,#EC4899,#3B82F6);
  -webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;
}
.site-footer .footer-desc{color:var(--text-tertiary);margin-bottom:16px;max-width:360px}
.site-footer .footer-copy{font-size:12px;color:var(--text-tertiary);opacity:.7}
.site-footer h2{font-weight:700;margin-bottom:16px;color:var(--text-primary);font-size:15px}
.site-footer ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:10px}
.site-footer a{color:var(--text-secondary);text-decoration:none;transition:color .2s}
.site-footer a:hover{color:#a855f7}
.site-footer .footer-bottom{
  border-top:1px solid var(--border-default);
  padding-top:20px;text-align:center;
}
.site-footer .footer-bottom p{color:var(--text-tertiary);font-size:13px;opacity:.7}
.site-footer .footer-bottom span{color:#a855f7}

@media(max-width:768px){
  .site-footer .footer-grid{grid-template-columns:1fr;gap:32px}
  .site-footer{padding:36px 16px 28px}
}
.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}
