/* ==========================================================
   MINECRAFT TITLE GENERATOR - STYLESHEET
   Cherry Hosting Aesthetic & Pixel Art Architecture
   ========================================================== */

/* --- Font Faces --- */
@font-face {
  font-family: 'MinecraftTen';
  src: url('/fonts/MinecraftTen.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MinecraftRegular';
  src: url('/fonts/Minecraft-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MinecraftBold';
  src: url('/fonts/Minecraft-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MinecraftFive';
  src: url('/fonts/MinecraftFive.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MinecraftFiveBold';
  src: url('/fonts/MinecraftFiveBold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Monocraft';
  src: url('/fonts/Monocraft.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Minecraft10Alt';
  src: url('/fonts/minecraft10.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Theme Variables --- */
:root {
  --bg-root: #0a0408;
  --bg-sidebar: #120610;
  --bg-card: rgba(28, 11, 23, 0.72);
  --bg-card-hover: rgba(42, 17, 35, 0.85);
  --bg-input: #1a0b18;
  --border-color: rgba(244, 63, 94, 0.18);
  --border-focus: #f43f5e;
  
  --accent: #f43f5e;
  --accent-hover: #fb7185;
  --accent-glow: rgba(244, 63, 94, 0.45);
  --accent-dark: #be123c;
  
  --gold: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Monocraft', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-root);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(225, 29, 72, 0.12) 0%, transparent 65%),
              linear-gradient(180deg, #12050e 0%, #080307 100%);
}

/* --- Navbar --- */
.navbar {
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(18, 6, 16, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  gap: 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #fff;
  transition: transform 0.15s ease;
}

.brand-link:hover {
  transform: scale(1.02);
}

.brand-icon {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.6));
}

.brand-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fff;
}

.brand-sub {
  color: var(--accent);
  margin-left: 2px;
}

.badge-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: var(--accent-hover);
}

/* Presets Bar */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preset-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-right: 4px;
}

.preset-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.preset-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.preset-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Nav Right */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
}

.export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #180916;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  display: none;
  flex-direction: column;
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}

.export-dropdown:hover .export-menu {
  display: flex;
}

.export-menu button {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-menu button:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fff;
}

.export-menu button.recommended::after {
  content: "BEST";
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
}

/* --- Workspace Split --- */
.workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: 440px;
  min-width: 400px;
  max-width: 480px;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

/* Tabs Header */
.sidebar-tabs {
  display: flex;
  background: rgba(10, 4, 8, 0.8);
  border-bottom: 1px solid var(--border-color);
  padding: 4px;
  gap: 2px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(244, 63, 94, 0.18);
  color: var(--accent-hover);
  border-bottom: 2px solid var(--accent);
}

/* Tab Panes */
.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  gap: 16px;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(244, 63, 94, 0.35);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.form-row {
  display: flex;
  gap: 12px;
}

.col-4 { flex: 1; }
.col-6 { flex: 1; }

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 10px var(--accent-glow);
}

.form-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Color Pickers */
.color-picker-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  gap: 8px;
}

.color-picker-wrap input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.hex-text {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 12px;
  font-family: monospace;
  width: 65px;
  outline: none;
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-toggle {
  -webkit-appearance: none;
  width: 42px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.form-toggle:checked {
  background: var(--accent);
}

.form-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.form-toggle:checked::after {
  transform: translateX(20px);
}

/* Material Preset Grid */
.material-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.mat-card:hover {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fff;
}

.mat-card.active {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.15);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}

.mat-preview {
  width: 32px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mat-stone { background: linear-gradient(180deg, #a6a6a6, #535353); }
.mat-cherry { background: linear-gradient(180deg, #fbb6ce, #e11d48, #881337); }
.mat-diamond { background: linear-gradient(180deg, #a5f3fc, #0284c7); }
.mat-gold { background: linear-gradient(180deg, #fef08a, #ca8a04); }
.mat-emerald { background: linear-gradient(180deg, #86efac, #15803d); }
.mat-netherite { background: linear-gradient(180deg, #64748b, #1e293b); }
.mat-amethyst { background: linear-gradient(180deg, #f0abfc, #7e22ce); }
.mat-lava { background: linear-gradient(180deg, #fde047, #b91c1c); }
.mat-custom { background: linear-gradient(135deg, #f43f5e, #38bdf8); }

/* Font Upload Box */
.font-upload-box {
  border: 2px dashed rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.font-upload-box:hover, .font-upload-box.drag-over {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.08);
  color: #fff;
}

.font-upload-box .upload-trigger {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.font-upload-box .subtext {
  font-size: 11px;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.1);
}

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

.btn-ghost:hover {
  color: #fff;
}

.text-danger {
  color: #f87171 !important;
}

.btn-group-full {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Viewport Workspace --- */
.viewport-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: #080307;
}

/* Viewport Toolbar */
.viewport-toolbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(14, 5, 12, 0.85);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dim-badge, .scale-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.tool-btn.active {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--accent);
  color: #fff;
}

/* Canvas Viewport */
.viewport-canvas-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  background-color: #0b0409;
}

.viewport-canvas-wrapper:active {
  cursor: grabbing;
}

/* Canvas Backdrops */
.viewport-canvas-wrapper.bg-checker {
  background-image: linear-gradient(45deg, #160a14 25%, transparent 25%),
                    linear-gradient(-45deg, #160a14 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #160a14 75%),
                    linear-gradient(-45deg, transparent 75%, #160a14 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
  background-color: #0e040c;
}

.viewport-canvas-wrapper.bg-campfire {
  background-image: url('/assets/campfire_night.jpg');
  background-size: cover;
  background-position: center;
}

.viewport-canvas-wrapper.bg-dirt {
  background-color: #583d28;
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.06) 0px, rgba(0,0,0,0.06) 8px, transparent 8px, transparent 16px);
}

.viewport-canvas-wrapper.bg-stone {
  background-color: #4b4b4b;
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.08) 6px, transparent 6px, transparent 12px);
}

.viewport-canvas-wrapper.bg-dark {
  background-color: #0c0409;
}

.canvas-stage {
  position: absolute;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#mainCanvas {
  max-width: none;
  max-height: none;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.45));
}

#mainCanvas.pixel-crisp {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Viewport Footer */
.viewport-footer {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(14, 5, 12, 0.95);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-dim);
}

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

.viewport-footer a:hover {
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(24, 8, 20, 0.95);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-glow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

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

/* Responsive */
@media (max-width: 900px) {
  .workspace {
    flex-direction: column-reverse;
  }
  .sidebar {
    width: 100%;
    max-width: 100%;
    height: 50vh;
  }
  .viewport-area {
    height: 50vh;
  }
  .presets-bar {
    display: none;
  }
}
