/* ZHH JavaScript Deobfuscator — Premium styles */
:root {
  /* Light theme */
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-editor: #fafbfc;
  --border: #e2e5eb;
  --border-focus: #3b82f6;
  --text: #1a1d23;
  --text-secondary: #5c6570;
  --text-muted: #8b939e;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --success: #059669;
  --error: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.06);
  --font-sans: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", "Liberation Mono", Menlo, monospace;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0d0f12;
  --bg-elevated: #161a20;
  --bg-editor: #12151a;
  --border: #2a303a;
  --border-focus: #3b82f6;
  --text: #e8eaed;
  --text-secondary: #a0a8b4;
  --text-muted: #6b7380;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.25);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 700;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

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

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

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* Privacy banner */
.privacy-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.privacy-banner svg {
  flex-shrink: 0;
  color: var(--accent);
}

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .controls {
    flex-direction: row;
    justify-content: center;
    padding: 0.5rem 0;
  }
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 420px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.panel:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-editor);
}

.panel-header h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.editor-wrap {
  flex: 1;
  position: relative;
  min-height: 280px;
}

.code-editor {
  width: 100%;
  height: 100%;
  min-height: 280px;
  padding: 1rem 1.1rem;
  border: none;
  outline: none;
  resize: none;
  background: var(--bg-editor);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  transition: background var(--transition), color var(--transition);
}

.code-editor::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.code-editor[readonly] {
  cursor: default;
}

/* Drop zone */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: var(--accent-soft);
  border: 2px dashed var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: var(--accent);
  pointer-events: none;
  z-index: 5;
  border-radius: 0;
}

.editor-wrap.drag-over .drop-overlay {
  display: flex;
}

.panel-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* Controls column */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 0.25rem;
  min-width: 180px;
}

.status-area {
  text-align: center;
  min-height: 1.5rem;
}

.status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.status.processing {
  color: var(--accent);
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--error);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

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

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.file-btn {
  cursor: pointer;
}

/* Footer */
.footer {
  text-align: center;
  padding: 0.75rem 0 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer .credit {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Focus visible for a11y */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
textarea:focus {
  outline: none;
}

/* Smooth theme transition */
body,
.panel,
.code-editor,
.btn,
.privacy-banner {
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* Mobile refinements */
@media (max-width: 640px) {
  .app {
    padding: 1rem;
  }
  .brand-text h1 {
    font-size: 1.05rem;
  }
  .panel {
    min-height: 320px;
  }
  .code-editor {
    font-size: 0.8125rem;
    min-height: 220px;
  }
  .controls {
    min-width: auto;
  }
  .btn-primary {
    width: 100%;
  }
}
