/* ============================================================
   wp-config.pro — Design System
   Dark mode by default, light mode via [data-theme="light"]
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg-base:       #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-input:      #0d1117;
  --border:        #30363d;
  --border-focus:  #58a6ff;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;
  --accent:        #58a6ff;
  --accent-hover:  #79baff;
  --accent-green:  #3fb950;
  --accent-green-h:#56d364;
  --accent-red:    #f85149;
  --accent-yellow: #d29922;
  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.3);
  --radius:        6px;
  --radius-lg:     8px;
  --sidebar-w:     220px;
  --font-sans:     -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:     "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --transition:    .15s ease;
}

[data-theme="light"] {
  --bg-base:       #ffffff;
  --bg-surface:    #f6f8fa;
  --bg-elevated:   #ffffff;
  --bg-input:      #ffffff;
  --border:        #d0d7de;
  --border-focus:  #0969da;
  --text-primary:  #1f2328;
  --text-secondary:#656d76;
  --text-muted:    #9198a1;
  --accent:        #0969da;
  --accent-hover:  #0550ae;
  --accent-green:  #1a7f37;
  --accent-green-h:#117d35;
  --accent-red:    #cf222e;
  --accent-yellow: #9a6700;
  --shadow:        0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.08);
}

/* ── Reset / Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5em; font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.15rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }

p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }

code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 .3em;
  color: var(--accent);
}

small { font-size: .85em; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 48px;
  gap: 1rem;
}

.topbar-brand {
  font-family: var(--font-mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .4em;
}
.topbar-brand:hover { color: var(--text-primary); text-decoration: none; }

.topbar-brand .brand-php { color: var(--text-muted); font-weight: 400; }

.topbar-tagline {
  font-size: .875rem;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Upload notification */
.upload-notice {
  background: var(--accent-green);
  color: #fff;
  padding: .4rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(0,0,0,.2);
}

/* ── Layout ──────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 48px);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: .5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Navigation list */
.nav-list { list-style: none; margin: 0; padding: 0; }

.nav-item {
  display: block;
  width: 100%;
  padding: .5rem .75rem .5rem 1rem;
  font-size: .875rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  text-decoration: none;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  text-decoration: none;
}

.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(88, 166, 255, .08);
  font-weight: 500;
}

.nav-item.nav-generate {
  color: var(--accent-green);
  font-weight: 600;
}
.nav-item.nav-generate:hover {
  color: var(--accent-green-h);
  background: rgba(63, 185, 80, .08);
}

.nav-item.nav-reset { color: var(--text-muted); }

.nav-item.nav-divider {
  border-left-color: transparent;
  border-top: 1px solid var(--border);
  margin: .3rem 0;
  padding: 0;
  cursor: default;
  height: 1px;
}
.nav-item.nav-divider:hover { background: none; }

.nav-section-label {
  display: block;
  padding: .6rem .75rem .2rem 1rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

/* ── Main content ────────────────────────────────────────── */
.app-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
}

/* ── Tab panes ───────────────────────────────────────────── */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Theme toggle */
.theme-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 1rem;
  line-height: 1;
}
.theme-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.card-body { padding: 1.25rem; }

.card-text { color: var(--text-secondary); line-height: 1.65; margin-bottom: .6em; }
.card-text:last-child { margin-bottom: 0; }

/* ── Form fields ─────────────────────────────────────────── */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}

.field-group { display: flex; flex-direction: column; gap: .3rem; }

.field-group label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

.field-input {
  width: 100%;
  padding: .5rem .7rem;
  font-size: .95rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.field-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}

.field-input::placeholder { color: var(--text-muted); }

select.field-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236e7681'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  padding-right: 2rem;
}

textarea.field-input { resize: vertical; min-height: 80px; }

.field-help {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.field-help code { font-size: .8em; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .5rem 1.1rem;
  font-size: .9rem;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-green-h);
  border-color: var(--accent-green-h);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0 0 3px rgba(63,185,80,.2);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg-elevated);
  border-color: var(--text-secondary);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0 0 3px rgba(88,166,255,.2);
}

.btn-ghost {
  background: none;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-sm {
  padding: .3rem .7rem;
  font-size: .8rem;
}

.btn-center { display: flex; justify-content: center; margin-top: 1rem; }

/* ── Code output ─────────────────────────────────────────── */
.code-wrap {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
}

.code-toolbar-title {
  font-family: var(--font-mono);
  font-size: .75rem;
}

.code-output {
  margin: 0;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.code-output::-webkit-scrollbar { width: 6px; height: 6px; }
.code-output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* PHP syntax highlighting overrides */
.code-output span { font-family: var(--font-mono) !important; }

/* Dark mode highlight_string colors */
body:not([data-theme="light"]) .code-output {
  filter: none;
}

/* Light mode: default PHP colors work */

.copy-btn {
  padding: .25rem .6rem;
  font-size: .75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3em;
  transition: all var(--transition);
}
.copy-btn:hover {
  background: var(--bg-base);
  color: var(--text-primary);
}
.copy-btn.copied {
  color: var(--accent-green);
  border-color: var(--accent-green);
}

/* ── Intro panel ─────────────────────────────────────────── */
.intro-panel { margin-bottom: 1.5rem; }

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success {
  background: rgba(63,185,80,.12);
  border-color: rgba(63,185,80,.3);
  color: var(--accent-green);
}
.alert-info {
  background: rgba(88,166,255,.1);
  border-color: rgba(88,166,255,.25);
  color: var(--accent);
}

/* ── Footer ──────────────────────────────────────────────── */
.app-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-surface);
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--text-secondary); }

/* ── Upload page ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-surface);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(88,166,255,.05);
}
.upload-zone input[type="file"] {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}
.upload-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  color: var(--text-muted);
}
.upload-label { color: var(--text-secondary); font-size: .9rem; line-height: 1.6; }
.upload-hint { font-size: .78rem; color: var(--text-muted); margin-top: .4rem; }
.upload-selected { color: var(--accent-green); font-weight: 500; margin-top: .5rem; font-size: .85rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .app-sidebar {
    position: fixed;
    left: -100%;
    top: 48px;
    width: 240px;
    height: calc(100vh - 48px);
    z-index: 200;
    transition: left .2s ease;
    box-shadow: var(--shadow);
  }

  .app-sidebar.open { left: 0; }

  .app-content { padding: 1rem; }

  .topbar-tagline { display: none; }

  .hamburger {
    display: flex !important;
  }

  .field-row { grid-template-columns: 1fr; }
}

.hamburger {
  display: none;
  width: 32px; height: 32px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform .2s;
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 48px;
  background: rgba(0,0,0,.5);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── PHP highlight overrides (dark) ──────────────────────── */
body:not([data-theme="light"]) .code-output {
  color: #e6edf3;
}
body:not([data-theme="light"]) .code-output .comment,
body:not([data-theme="light"]) .code-output font[color="#FF8000"] { color: #8b949e !important; }
body:not([data-theme="light"]) .code-output font[color="#007700"] { color: #3fb950 !important; }
body:not([data-theme="light"]) .code-output font[color="#0000BB"] { color: #79b8ff !important; }
body:not([data-theme="light"]) .code-output font[color="#DD0000"] { color: #f0a070 !important; }
