/* BetterSkin — Multi-theme Skin Manager */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ================================================================
   THEME VARIABLES
   ================================================================ */

/* Dark theme (default) */
:root, [data-theme="dark"] {
  --bg: #1a1a2e;
  --surface: #222238;
  --surface2: #2d2d48;
  --overlay: #3d3d5c;
  --text: #e0e0f0;
  --subtext: #a0a0c0;
  --blue: #89b4fa;
  --green: #a6e3a1;
  --red: #f38ba8;
  --peach: #fab387;
  --radius: 8px;
  --nav-bg: var(--surface);
  --nav-border: var(--surface2);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #e4e6ea;
  --overlay: #ccd0d5;
  --text: #1c1e21;
  --subtext: #606770;
  --blue: #1877f2;
  --green: #42b72a;
  --red: #dc3545;
  --peach: #f5793a;
  --nav-bg: #ffffff;
  --nav-border: #e4e6ea;
}

/* OLED theme */
[data-theme="oled"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface2: #151515;
  --overlay: #252525;
  --text: #e8e8e8;
  --subtext: #888888;
  --blue: #5b9bf5;
  --green: #4caf50;
  --red: #f44336;
  --peach: #ff9800;
  --nav-bg: #050505;
  --nav-border: #1a1a1a;
}

/* Minecraft theme */
[data-theme="minecraft"] {
  --bg: #2b2b2b;
  --surface: #333333;
  --surface2: #3d3d3d;
  --overlay: #505050;
  --text: #e0e0e0;
  --subtext: #aaaaaa;
  --blue: #55ff55;
  --green: #55ff55;
  --red: #ff5555;
  --peach: #ffaa00;
  --radius: 4px;
  --nav-bg: #3b6b35;
  --nav-border: #2d5229;
}

/* ================================================================
   BASE
   ================================================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

/* Minecraft theme: gradient footer */
[data-theme="minecraft"] body {
  background: linear-gradient(to bottom, #2b2b2b 70%, #3d2a1a 100%);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.hidden { display: none !important; }
.muted { color: var(--subtext); font-size: 14px; }

/* ================================================================
   NAVBAR
   ================================================================ */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border);
  transition: background .3s;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.logo { font-size: 18px; font-weight: 700; color: var(--blue); }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius); color: var(--subtext);
  font-size: 13px; cursor: pointer; transition: all .2s;
}
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); }
[data-theme="minecraft"] .nav-link:hover,
[data-theme="minecraft"] .nav-link.active { background: rgba(255,255,255,.15); color: #ffffff; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.username { color: var(--blue); font-size: 13px; font-weight: 500; }

/* Theme switcher */
.theme-switcher { display: flex; gap: 4px; }
.theme-btn {
  width: 28px; height: 28px; border: 1px solid var(--overlay); border-radius: 6px;
  background: var(--surface2); cursor: pointer; font-size: 14px; display: flex;
  align-items: center; justify-content: center; transition: all .2s;
  padding: 0; line-height: 1;
}
.theme-btn:hover { border-color: var(--blue); }
.theme-btn.theme-active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(137,180,250,.25); }

/* Language buttons */
.lang-btn {
  padding: 4px 10px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--surface2); color: var(--subtext); font-size: 12px;
}
.lang-btn:hover { background: var(--blue); color: var(--bg); }
.lang-btn.lang-active { background: var(--blue); color: var(--bg); }

/* ================================================================
   PAGES
   ================================================================ */
.page { padding: 24px; max-width: 1100px; margin: 0 auto; }

/* Login */
.login-card {
  max-width: 440px; margin: 15vh auto; background: var(--surface); border-radius: 16px;
  padding: 40px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 28px; color: var(--blue); margin-bottom: 16px; }
.desc { color: var(--subtext); font-size: 14px; margin-top: 16px; line-height: 1.6; }
.info { padding: 12px 16px; border-radius: var(--radius); background: rgba(137,180,250,.13); color: var(--blue); font-size: 14px; }
.error { padding: 12px 16px; border-radius: var(--radius); background: rgba(243,139,168,.13); color: var(--red); font-size: 14px; }
.success { padding: 12px 16px; border-radius: var(--radius); background: rgba(166,227,161,.13); color: var(--green); font-size: 14px; }

/* ================================================================
   DASHBOARD
   ================================================================ */
.dashboard-layout { display: flex; gap: 32px; flex-wrap: wrap; }
.preview-section { flex: 0 0 300px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.actions-section { flex: 1; min-width: 300px; }
.skin-info { display: flex; flex-direction: column; gap: 4px; text-align: center; color: var(--subtext); font-size: 13px; }
.quick-actions { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.action-btn {
  padding: 12px 20px; border-radius: var(--radius); border: none;
  background: var(--surface2); color: var(--text); font-weight: 500;
  cursor: pointer; font-size: 14px; transition: all .2s;
}
.action-btn:hover { background: var(--overlay); }

/* History list */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--surface2);
}
.history-item.active-skin { border-color: var(--blue); }
.history-left { display: flex; align-items: center; gap: 12px; }
.history-thumb {
  width: 40px; height: 40px; border-radius: 4px; image-rendering: pixelated;
  background: var(--surface2); flex-shrink: 0;
}
.history-meta { display: flex; gap: 10px; align-items: center; }
.tag { background: var(--overlay); padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.apply-btn {
  padding: 6px 14px; border-radius: 6px; border: none;
  background: var(--blue); color: var(--bg); font-weight: 600; cursor: pointer; font-size: 12px;
}
.active-badge { color: var(--green); font-size: 12px; font-weight: 600; }

/* ================================================================
   EDITOR
   ================================================================ */
.editor-top-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 8px;
}
.editor-import-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.outline-btn-sm {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--overlay);
  background: transparent; color: var(--subtext); cursor: pointer; font-size: 12px;
  transition: all .15s;
}
.outline-btn-sm:hover { border-color: var(--blue); color: var(--blue); }

.editor-layout { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; }
.editor-model-select { display: flex; gap: 16px; }
.editor-model-select label { display: flex; align-items: center; gap: 4px; cursor: pointer; }

.toolbar {
  display: flex; flex-direction: column; gap: 6px; padding: 12px;
  background: var(--surface); border-radius: 12px; min-width: 56px; align-items: center;
}
.toolbar hr { width: 100%; border: none; border-top: 1px solid var(--overlay); margin: 4px 0; }
.tool-btn {
  width: 44px; height: 44px; border: none; border-radius: var(--radius);
  background: var(--surface2); cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.tool-btn.active { background: var(--blue); box-shadow: 0 0 0 2px rgba(137,180,250,.3); }
.action-btn-sm {
  width: 44px; height: 36px; border: none; border-radius: var(--radius);
  background: var(--surface2); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.action-btn-sm:hover { background: var(--overlay); }
.action-btn-sm.active { background: var(--blue); box-shadow: 0 0 0 2px rgba(137,180,250,.3); }
#color-picker { width: 44px; height: 32px; border: none; cursor: pointer; background: none; }
.color-preview { width: 36px; height: 36px; border-radius: 6px; border: 2px solid var(--overlay); }
.palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
.palette-color {
  width: 20px; height: 20px; border: 1px solid var(--overlay); border-radius: 3px;
  cursor: pointer; padding: 0;
}

.canvas-area { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 300px; }
#editor-display {
  image-rendering: pixelated; cursor: crosshair;
  border: 2px solid var(--overlay); border-radius: 4px;
}
.zoom-controls { display: flex; align-items: center; gap: 8px; }
.zoom-controls button {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: var(--surface2); color: var(--text); cursor: pointer; font-size: 16px;
}
.editor-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.editor-preview h3 { color: var(--subtext); font-size: 14px; }
.editor-footer { margin-top: 24px; text-align: center; }
.save-btn {
  padding: 14px 40px; border-radius: 10px; border: none;
  background: var(--green); color: var(--bg); font-weight: 700;
  cursor: pointer; font-size: 16px; transition: transform .1s;
}
.save-btn:hover { transform: scale(1.02); }
.save-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ================================================================
   IMPORT
   ================================================================ */
.import-model-select { display: flex; gap: 16px; margin-bottom: 16px; }
.import-model-select label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.import-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px 12px; border: none; border-radius: var(--radius);
  background: var(--surface2); color: var(--text); cursor: pointer; font-size: 13px; text-align: center;
}
.tab.active { background: var(--blue); color: var(--bg); }
.tab-content { min-height: 80px; }
.input-group { display: flex; gap: 8px; }
.input-group input {
  flex: 1; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--overlay); background: var(--surface2);
  color: var(--text); font-size: 14px; outline: none;
}
.input-group input:focus { border-color: var(--blue); }
.primary-btn {
  padding: 10px 20px; border-radius: var(--radius); border: none;
  background: var(--blue); color: var(--bg); font-weight: 600;
  cursor: pointer; font-size: 14px; white-space: nowrap;
}
.secondary-btn {
  padding: 10px 20px; border-radius: var(--radius); border: none;
  background: var(--overlay); color: var(--text); cursor: pointer; font-size: 14px;
}
.outline-btn {
  padding: 10px 20px; border-radius: var(--radius); border: 2px dashed var(--overlay);
  background: transparent; color: var(--subtext); cursor: pointer; font-size: 14px;
}
.dropzone {
  border: 2px dashed var(--overlay); border-radius: var(--radius);
  padding: 40px; text-align: center; cursor: pointer; transition: border-color .2s;
}
.dropzone:hover { border-color: var(--blue); }

/* ================================================================
   PRESETS
   ================================================================ */
.preset-save-section { margin-bottom: 24px; }
#save-preset-form { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
#save-preset-form input {
  flex: 1; max-width: 300px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--overlay); background: var(--surface2);
  color: var(--text); font-size: 14px; outline: none;
}
.preset-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }
.preset-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--surface); border-radius: 10px;
  border: 1px solid var(--surface2);
}
.preset-name { font-size: 15px; font-weight: 500; }
.preset-meta { display: flex; gap: 6px; margin-top: 4px; }
.preset-actions { display: flex; gap: 6px; }
.delete-btn {
  padding: 6px 10px; border-radius: 6px; border: none;
  background: rgba(243,139,168,.13); cursor: pointer; font-size: 14px;
}

/* ================================================================
   EXPLORE
   ================================================================ */
.explore-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.explore-card {
  background: var(--surface); border: 1px solid var(--surface2);
  border-radius: 12px; padding: 24px; transition: all .2s;
  display: flex; flex-direction: column; gap: 12px;
}
.explore-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.explore-card-header { display: flex; align-items: center; gap: 12px; }
.explore-icon { font-size: 32px; }
.explore-title { font-size: 16px; font-weight: 600; }
.explore-desc { color: var(--subtext); font-size: 13px; line-height: 1.5; }
.explore-link {
  display: inline-block; padding: 8px 16px; border-radius: var(--radius);
  background: var(--blue); color: var(--bg); font-weight: 600; font-size: 13px;
  text-align: center; transition: opacity .2s;
}
.explore-link:hover { opacity: .85; }
.explore-tip {
  font-size: 11px; color: var(--subtext); background: var(--surface2);
  padding: 6px 10px; border-radius: 6px; line-height: 1.4;
}

/* ================================================================
   CANVAS for 3D preview
   ================================================================ */
#skin-preview-canvas, #editor-preview-canvas {
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface), var(--surface2));
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  nav { flex-direction: column; gap: 8px; }
  .nav-left { flex-wrap: wrap; justify-content: center; }
  .nav-right { flex-wrap: wrap; justify-content: center; }
  .dashboard-layout { flex-direction: column; }
  .preview-section { flex: auto; }
  .editor-layout { flex-direction: column; }
  .toolbar { flex-direction: row; flex-wrap: wrap; }
  .editor-top-bar { flex-direction: column; align-items: flex-start; }
  .theme-switcher { order: -1; }
}

