/* ═══════════════════════════════════════════════════════════
   POD Wizard — Minecraft Theme
   ═══════════════════════════════════════════════════════════ */

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

@font-face {
  font-family: 'Minecraft';
  src: local('Minecraft'), local('Minecraftia'), local('Courier New');
}

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-hover: #0f3460;
  --accent: #e94560;
  --accent2: #f5a623;
  --text: #e0e0e0;
  --text-dim: #8892b0;
  --green: #4ade80;
  --pixel-size: 2px;
  --border-color: #3a3a5e;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    linear-gradient(45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a2e 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

/* Header */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: var(--pixel-size) solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title h1 {
  font-size: 22px;
  font-weight: 700;
  text-shadow: 2px 2px 0 #000;
  color: #fff;
}

.header-title h1 .accent { color: var(--accent); }
.header-title h1 .accent2 { color: var(--accent2); }

.minecraft-icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border: var(--pixel-size) solid var(--border-color);
  background: #2a2a4e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* Container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: var(--pixel-size) solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

.card h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--accent2);
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000;
}

.card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* Step indicator */
.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 10px 8px;
  background: rgba(255,255,255,0.05);
  border: var(--pixel-size) solid var(--border-color);
  font-size: 11px;
  color: var(--text-dim);
  position: relative;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s;
}

.hidden { display: none !important; }

.step.active {
  background: rgba(233,69,96,0.15);
  border-color: var(--accent);
  color: #fff;
}

.step.completed {
  background: rgba(74,222,128,0.1);
  border-color: var(--green);
  color: var(--green);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 0;
  border: var(--pixel-size) solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

/* Buttons — Minecraft style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border: var(--pixel-size) solid #000;
  cursor: pointer;
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  color: #fff;
  background: #7c7c7c;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.2),
    inset 0 -4px 0 rgba(0,0,0,0.2),
    4px 4px 0 rgba(0,0,0,0.3);
  min-height: 44px;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.1),
    inset 0 -4px 0 rgba(0,0,0,0.3),
    2px 2px 0 rgba(0,0,0,0.3);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #2d7d2d;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.3),
    inset 0 -4px 0 rgba(0,0,0,0.3),
    4px 4px 0 rgba(0,0,0,0.3);
}

.btn-accent {
  background: var(--accent);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.3),
    inset 0 -4px 0 rgba(0,0,0,0.2),
    4px 4px 0 rgba(0,0,0,0.3);
}

.btn-secondary {
  background: #4a4a6a;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,0.15),
    inset 0 -4px 0 rgba(0,0,0,0.2),
    4px 4px 0 rgba(0,0,0,0.3);
}

.btn-block { width: 100%; }

/* Form elements — Minecraft style */
select, input[type="text"], input[type="url"], textarea {
  width: 100%;
  padding: 12px;
  background: #0d1117;
  border: var(--pixel-size) solid var(--border-color);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23e0e0e0' fill='none' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.form-group {
  margin-bottom: 16px;
}

/* Preview area */
.preview-area {
  min-height: 200px;
  background: #0d1117;
  border: var(--pixel-size) solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.preview-area img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  image-rendering: pixelated;
}

.preview-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.preview-placeholder .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.3);
  border: var(--pixel-size) solid var(--border-color);
  font-size: 13px;
  margin-bottom: 16px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 0;
}

.status-dot.idle { background: #555; }
.status-dot.loading { background: var(--accent2); animation: blink 0.8s infinite; }
.status-dot.success { background: var(--green); }
.status-dot.error { background: var(--accent); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .header-title h1 { font-size: 18px; }
  .step { min-width: 60px; font-size: 10px; padding: 8px 4px; }
}

/* Loading bar */
.progress-bar {
  height: 4px;
  background: var(--border-color);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.5s;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0d1117;
  border: var(--pixel-size) solid var(--border-color);
  padding: 12px 20px;
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 360px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--accent); }

/* Responsive table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.info-table td {
  padding: 8px 12px;
  border-bottom: var(--pixel-size) solid rgba(255,255,255,0.05);
}

.info-table td:first-child {
  color: var(--text-dim);
  font-weight: 600;
  width: 40%;
}

/* Loading spinner Minecraft style */
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  background:
    linear-gradient(0deg, transparent 48%, var(--accent2) 48%, var(--accent2) 52%, transparent 52%),
    linear-gradient(90deg, transparent 48%, var(--accent2) 48%, var(--accent2) 52%, transparent 52%);
  animation: spin 1s steps(8) infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Hero section */
.hero {
  text-align: center;
  padding: 32px 16px;
  margin-bottom: 8px;
}

.hero .big-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.hero p {
  color: var(--text-dim);
  font-size: 16px;
  margin-top: 8px;
}

/* Menu items (sidebar) — unified navy theme */
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  margin: 4px 0;
  background: var(--bg-card);
  border: var(--pixel-size) solid var(--border-color);
  color: var(--text);
  cursor: pointer;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

.menu-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: #fff;
  transform: translateX(4px);
}

.menu-item.active {
  background: rgba(233,69,96,0.15);
  border-color: var(--accent);
  color: #fff;
}

/* Gallery grid — unified navy theme */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-item {
  background: var(--bg-card);
  border: var(--pixel-size) solid var(--border-color);
  padding: 10px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border: var(--pixel-size) solid var(--border-color);
  background: #0d1117;
}

.gallery-item .title {
  color: var(--accent2);
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

.gallery-item .filename {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

/* Page shell overlay — unified navy checkerboard like homepage */
.page-shell {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 998;
  overflow-y: auto;
  padding: 20px 16px 48px;
  background: var(--bg);
  background-image:
    linear-gradient(45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a2e 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
}

.page-shell.open {
  display: block;
}

.page-shell-header {
  max-width: 960px;
  margin: 0 auto 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: var(--pixel-size) solid var(--border-color);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  padding: 14px 18px;
}

.page-shell-header h2 {
  color: var(--accent2);
  margin: 0;
  font-size: 17px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 #000;
}

.page-shell-header .back-btn {
  background: #4a4a6a;
  border: var(--pixel-size) solid #000;
  color: #fff;
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,0.15),
    inset 0 -3px 0 rgba(0,0,0,0.2),
    3px 3px 0 rgba(0,0,0,0.3);
}

.page-shell-header .back-btn:active {
  transform: translate(2px, 2px);
}

#pageContent {
  max-width: 960px;
  margin: 0 auto;
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.sidebar-overlay.open {
  display: block;
}

/* ═══════════════════════════════════════════════════════════
   Sub-page utilities — unified with homepage theme
   ═══════════════════════════════════════════════════════════ */

/* Sidebar panel (navy theme, matches .header) */
.sidebar-panel {
  position: fixed;
  top: 0;
  left: -340px;
  width: 320px;
  height: 100vh;
  background: linear-gradient(160deg, #16213e 0%, #111a30 100%);
  border-right: var(--pixel-size) solid var(--border-color);
  box-shadow: 8px 0 0 rgba(0,0,0,0.25);
  transition: left 0.25s;
  z-index: 1000;
  overflow-y: auto;
  padding: 16px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: var(--pixel-size) solid var(--border-color);
  padding-bottom: 10px;
}

.sidebar-title {
  color: #fff;
  margin: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000;
}

.sidebar-title .accent { color: var(--accent); }
.sidebar-title .accent2 { color: var(--accent2); }

.sidebar-close {
  background: #4a4a6a;
  border: var(--pixel-size) solid #000;
  color: #fff;
  padding: 5px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,0.15),
    inset 0 -3px 0 rgba(0,0,0,0.2),
    2px 2px 0 rgba(0,0,0,0.3);
}

.sidebar-close:active { transform: translate(2px, 2px); }

.sidebar-section {
  font-size: 11px;
  color: var(--text-dim);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.sidebar-section:first-of-type { margin-top: 4px; }

/* Small button variant */
.btn-sm {
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
}

/* Console / JSON output blocks */
.pw-pre {
  background: #0d1117;
  border: var(--pixel-size) solid var(--border-color);
  color: var(--text);
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  margin: 0;
}

.pw-loading {
  color: var(--accent2);
  animation: blink 0.8s infinite;
}

.pw-error {
  color: var(--accent);
}

.pw-msg {
  padding: 16px 0;
  font-size: 14px;
  font-weight: 600;
}

.pw-dim {
  color: var(--text-dim);
  font-size: 12px;
}

/* Stat cards (Dashboard page) */
.pw-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.pw-stat {
  background: var(--bg-card);
  border: var(--pixel-size) solid var(--border-color);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  padding: 20px;
  text-align: center;
}

.pw-stat-label {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.pw-stat-value {
  color: var(--accent2);
  font-size: 34px;
  font-weight: bold;
  margin-top: 8px;
  text-shadow: 1px 1px 0 #000;
}

.pw-stat-value.green { color: var(--green); }
.pw-stat-value.plain { color: var(--text); font-size: 22px; }

/* Card grids inside sub-pages */
.pw-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.pw-grid-cards > .card { margin-bottom: 0; }

.pw-card-title {
  color: var(--accent2);
  margin: 0 0 10px;
  font-size: 15px;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000;
}

.pw-dim-line {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 4px;
}

.pw-dim-line code { color: var(--accent2); }

.pw-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ── pw tabs + style chips (story library) ── */
.pw-tabs { display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
.pw-tab { padding:12px 20px; background:var(--bg-card); border:var(--pixel-size) solid var(--border-color);
  color:var(--text-dim); font-family:'Minecraft',monospace; font-size:11px; cursor:pointer;
  box-shadow:4px 4px 0 rgba(0,0,0,.35); transition:all .1s; }
.pw-tab:hover { background:var(--bg-hover); color:#fff; }
.pw-tab.active { background:var(--bg-hover); color:#fff; border-color:var(--accent2); }
.pw-chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.chip { padding:8px 14px; background:#0d1117; border:2px solid var(--border-color); color:var(--text-dim);
  cursor:pointer; font-size:13px; border-radius:6px; transition:all .1s; }
.chip:hover { border-color:var(--accent2); color:#fff; }
.chip.active { border-color:var(--accent); color:#fff; background:rgba(233,69,96,.15); }
.pw-book-badge { display:inline-block; padding:3px 10px; border-radius:10px; background:rgba(245,166,35,.15);
  border:1px solid rgba(245,166,35,.4); color:var(--accent2); font-size:11px; margin-top:6px; }
