/* ============================================================
   AI Code Splitter — Stylesheet
   Dark developer-tool theme with an editor-tab metaphor.
   ============================================================ */

:root {
  /* Color */
  --bg: #0a0f1c;
  --bg-panel: #101827;
  --bg-panel-alt: #0d1420;
  --bg-inset: #0a1120;
  --border: #1f2a44;
  --border-soft: #182034;

  --text-primary: #e7ecf5;
  --text-muted: #8a96ae;
  --text-faint: #5b667e;

  --accent: #f2a93b;
  --accent-hover: #ffc15e;
  --accent-text: #1a1206;

  --success: #34d399;
  --danger: #f2665f;

  --dot-html: #e36c4e;
  --dot-css: #4c9fe8;
  --dot-js: #f0c94a;

  /* Type */
  --font-heading: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  /* Layout */
  --radius-sm: 4px;
  --radius-md: 8px;
  --max-width: 1240px;

  --shadow-panel: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);
}

/* ---------- Reset ---------- */
*, *::before, *::after { 
  box-sizing: border-box; 
}

html, body { 
  min-height: 100%; 
  overflow-x: hidden;
}

/* ---------- Background & Base ---------- */
body {
  margin: 0;
  background-color: #0b0f17;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  color: #f1f5f9;
  font-family: var(--font-body);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-heading); margin: 0; }
p { margin: 0; }
button { font-family: inherit; }
textarea, input, button { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Layout Shell ---------- */
.skip-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.app-header {
  border-bottom: 1px solid #1e293b;
  background-color: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(12px);
}

.app-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 48px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__icon {
  width: 36px;
  height: 36px;
  background: #161f30;
  border: 1px solid #2d3b55;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.brand__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.badge-secure {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #111a28;
  border: 1px solid #23354d;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.01em;
}

.badge-secure svg {
  color: #38bdf8;
}

.brand__subtitle {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.82rem;
}

/* ---------- Main Container ---------- */
.app-main {
  flex: 1 0 auto;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 16px 48px;
  box-sizing: border-box;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 920px) {
  .grid { 
    grid-template-columns: 1fr; 
  }
}

/* ---------- Pane ---------- */
.pane {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
}

.pane__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 54px;
}

.pane__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.pane__hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.pane__body { 
  padding: 14px 16px 16px; 
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
  padding: 8px 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel-alt);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(242,169,59,0.06);
}

.dropzone__input {
  position: absolute;
  width: 1px; 
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone__icon { 
  color: var(--text-muted); 
}

.dropzone.is-dragover .dropzone__icon,
.dropzone:hover .dropzone__icon { 
  color: var(--accent); 
}

.dropzone__text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dropzone__text strong { 
  color: var(--text-primary); 
}

/* ---------- File Status ---------- */
.file-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 10px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.file-status__dot {
  width: 6px; 
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.file-status.has-file .file-status__dot { 
  background: var(--success); 
}

.file-status.has-file .file-status__label { 
  color: var(--text-primary); 
}

/* ---------- Input Code Editor ---------- */
.code-editor {
  position: relative;
  width: 100%;
  height: 340px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  overflow: hidden;
  transition: border-color 150ms ease;
}

.code-editor:focus-within {
  border-color: var(--accent);
}

.code-editor__textarea {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.code-editor__textarea::placeholder {
  color: var(--text-faint);
}

.code-editor__textarea::-webkit-scrollbar,
.code-block::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.code-editor__textarea::-webkit-scrollbar-track,
.code-block::-webkit-scrollbar-track {
  background: transparent;
}

.code-editor__textarea::-webkit-scrollbar-thumb,
.code-block::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 2px solid var(--bg-inset);
}

.code-editor__textarea::-webkit-scrollbar-thumb:hover,
.code-block::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ---------- Output Pane & Tabs ---------- */
.pane__header--output {
  align-items: center;
}

.editor {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.editor[aria-disabled="true"] {
  opacity: 0.55;
}

.tabstrip {
  display: flex;
  gap: 2px;
  padding: 6px 10px 0;
  background: var(--bg-panel-alt);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
  white-space: nowrap;
}

.tab:hover { 
  color: var(--text-primary); 
}

.tab--active {
  background: var(--bg-panel);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

.tab__dot {
  width: 6px; 
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tab__dot--html { background: var(--dot-html); }
.tab__dot--css  { background: var(--dot-css); }
.tab__dot--js   { background: var(--dot-js); }

.panel { 
  display: none; 
}

.panel--active { 
  display: block; 
}

.panel__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel-alt);
}

.panel__filename {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.panel__buttons { 
  display: flex; 
  gap: 6px; 
}

/* Output Code Block */
.code-block {
  margin: 0 !important;
  height: 340px !important;
  max-height: 340px !important;
  overflow: auto !important;
  padding: 12px 14px !important;
  background: var(--bg-inset);
}

.code-block code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
}

.code-block code[class*="language-"] {
  padding: 0 !important;
  margin: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  background: none !important;
  text-shadow: none !important;
}

/* ---------- Action Buttons ---------- */
.pane__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  white-space: nowrap;
}

.btn:active { 
  transform: translateY(1px); 
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn--primary:hover:not(:disabled) { 
  background: var(--accent-hover); 
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--text-faint);
  color: var(--text-primary);
}

.btn--zip {
  background: var(--bg-panel-alt);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--zip:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--small {
  padding: 4px 8px;
  font-size: 0.74rem;
}

.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn--outline:hover:not(:disabled) {
  border-color: var(--text-faint);
  color: var(--text-primary);
}

.copy-btn {
  background: var(--bg-inset);
  border-color: var(--border);
  color: var(--text-muted);
}

.copy-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.is-copied {
  background: rgba(52,211,153,0.12);
  border-color: var(--success);
  color: var(--success);
}

.error-message {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(242,102,95,0.35);
  background: rgba(242,102,95,0.08);
  color: #ffb3ae;
  font-size: 0.78rem;
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid #1e293b;
  padding: 10px 48px;
  background-color: rgba(11, 15, 23, 0.8);
  box-sizing: border-box;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 500;
}

.privacy-badge svg {
  color: #10b981;
}

@media (max-width: 560px) {
  .app-header__inner,
  .app-main,
  .app-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .pane__header, 
  .pane__body { 
    padding-left: 12px; 
    padding-right: 12px; 
  }
  .btn--zip span { 
    display: none; 
  }
}

/* ---------- Privacy Link & Modal ---------- */
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.footer-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: underline;
}

.footer-link:hover {
  color: var(--text-primary);
}

.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-primary);
  max-width: 480px;
  padding: 0;
  margin: auto;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal__card {
  padding: 20px;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal__header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal__body strong {
  color: var(--text-primary);
}