/* Core & Typography */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0f;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-wrapper { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 20px; }

/* Header & Navigation */
.site-header { background: #121222; border-bottom: 1px solid #2a2a4e; padding: 0 20px; }
.header-container { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 75px; }
.site-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: bold; font-size: 24px; }
.site-logo .logo-icon { color: #4ecca3; font-size: 28px; }
.site-logo span { color: #4ecca3; }
.site-nav { display: flex; gap: 25px; align-items: center; }
.nav-link { color: #d0d0e0; text-decoration: none; font-size: 16px; font-weight: 500; transition: color 0.2s; }
.nav-link:hover, .nav-link.active { color: #4ecca3; }

/* Dropdown Menu */
.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; top: 100%; left: 0; background: #1a1a2e; min-width: 220px; box-shadow: 0 8px 16px rgba(0,0,0,0.5); border: 1px solid #2a2a4e; border-radius: 8px; padding: 10px 0; z-index: 100; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown-item { color: #d0d0e0; padding: 12px 18px; text-decoration: none; display: block; font-size: 15px; }
.dropdown-item:hover { background: #2a2a4e; color: #4ecca3; }
.dropdown-item.active { color: #4ecca3; font-weight: bold; }

/* Global UI Components */
.box { background: #1a1a2e; padding: 35px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); border: 1px solid #2a2a4e; margin-bottom: 20px; }
h1 { color: #4ecca3; margin-top: 0; font-size: 32px; }
h2 { color: #4ecca3; margin-top: 0; font-size: 26px; }
h3 { color: #fcc419; margin-top: 20px; margin-bottom: 12px; font-size: 20px; }
button { font-size: 16px; padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition: all 0.2s; }
button:hover { transform: scale(1.01); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-repair, .btn-primary { background: #4ecca3; color: #0a0a0f; }
.btn-repair:hover, .btn-primary:hover { background: #3db890; }
.btn-test { background: #fcc419; color: #0a0a0f; }
.btn-secondary { background: #27273a; color: #e0e0e0; border: 1px solid #3f3f56; }
.btn-secondary:hover { background: #3f3f56; }

/* STL Repair Dashboard Tables & Badges */
table { border-collapse: collapse; width: 100%; margin: 15px 0; font-size: 16px; }
td { padding: 10px; border-bottom: 1px solid #2a2a4e; color: #e0e0e0; }
td:first-child { font-weight: bold; color: #4ecca3; }
.error { padding: 18px; background: #2a1a1a; margin-bottom: 20px; border-radius: 6px; border-left: 4px solid #ff6b6b; }
.success { padding: 18px; background: #1a2a1a; margin-bottom: 20px; border-radius: 6px; border-left: 4px solid #4ecca3; }
.download { display: inline-block; padding: 16px 32px; background: #4ecca3; color: #0a0a0f; text-decoration: none; border-radius: 8px; font-weight: bold; font-size: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin: 20px 0; }
.stat-card { background: #1a1a2e; padding: 18px; border-radius: 8px; text-align: center; border: 1px solid #2a2a4e; }
.stat-value { font-size: 32px; font-weight: bold; display: block; }
.stat-label { font-size: 14px; color: #c0c0d0; margin-top: 5px; }
.bad { color: #ff6b6b; }
.good { color: #4ecca3; }
.watertight-badge { background: #1a2a1a; padding: 30px; border-radius: 12px; text-align: center; margin: 20px 0; border: 3px solid #4ecca3; }

/* Collapsible Section */
.collapsible { background: #1a1a2e; border: 1px solid #2a2a4e; border-radius: 8px; margin: 10px 0; }
.collapsible-header { background: #0f0f1a; padding: 14px 20px; cursor: pointer; border-radius: 8px; font-weight: bold; color: #fcc419; display: flex; justify-content: space-between; }
.collapsible-content { padding: 18px; display: none; border-top: 1px solid #2a2a4e; }
.collapsible-content.open { display: block; }

/* Universal Drag & Drop Area */
.drop-zone { background: #0f0f1a; border: 3px dashed #3a3a6e; border-radius: 12px; padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.3s; margin: 15px 0; }
.drop-zone:hover, .drop-zone.dragover, .drop-zone.drag-active { background: #1a2a1a; border-color: #4ecca3; }
.drop-zone .icon { font-size: 42px; display: block; margin-bottom: 8px; }
.drop-zone .text { color: #d0d0e0; font-size: 16px; }

/* Mesh Reducer Workspace Layout */
.reducer-workspace { display: flex; height: 700px; border-radius: 12px; overflow: hidden; border: 1px solid #2a2a4e; background: #121214; }
#sidebar { width: 330px; background: #1a1a2e; padding: 20px; border-right: 1px solid #2a2a4e; display: flex; flex-direction: column; gap: 18px; z-index: 10; }
#sidebar h1 { font-size: 1.25rem; font-weight: 600; color: #ffffff; }
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-group label { font-size: 0.85rem; color: #a0a0ab; text-transform: uppercase; font-weight: 600; }
.range-container { display: flex; align-items: center; gap: 10px; }
input[type="range"] { flex: 1; accent-color: #4ecca3; }
.stats-card { background: #0f0f1a; border: 1px solid #2a2a4e; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; }
.stat-row { display: flex; justify-content: space-between; }
.stat-val { font-weight: 600; color: #4ecca3; }
#viewport { flex: 1; position: relative; }
#canvas-container { width: 100%; height: 100%; }
#drop-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(10, 10, 15, 0.85); border: 3px dashed #4ecca3; display: none; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 600; color: #4ecca3; z-index: 20; pointer-events: none; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; text-transform: none; }

/* Footer */
.site-footer { background: #121222; border-top: 1px solid #2a2a4e; padding: 45px 20px 25px; margin-top: auto; }
.footer-container { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 35px; margin-bottom: 30px; }
.footer-col h4 { color: #4ecca3; margin-top: 0; margin-bottom: 15px; font-size: 18px; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: #d0d0e0; text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: #4ecca3; }
.footer-bottom { max-width: 1100px; margin: 0 auto; padding-top: 25px; border-top: 1px solid #2a2a4e; text-align: center; color: #b0b0c0; }



/* PNG Converter specific styles */
.png-converter-workspace {
  display: flex;
  height: calc(100vh - 120px);
  min-height: 500px;
  gap: 0;
  background: var(--bg);
}

#sidebar {
  width: 340px;
  min-width: 300px;
  background: var(--panel);
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#sidebar h1 {
  font-size: 20px;
  margin: 0;
  color: var(--text);
}

#sidebar .subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: -4px 0 8px 0;
}

#viewport {
  flex: 1;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

#canvas-container {
  width: 100%;
  height: 100%;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  background: var(--bg);
}

.drop-zone:hover {
  border-color: var(--accent);
}

.drop-zone .icon {
  font-size: 32px;
  display: block;
}

.drop-zone .text {
  font-size: 0.9rem;
  color: var(--text-dim);
}

#drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
}

.range-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-container label {
  font-size: 0.8rem;
  min-width: 60px;
  color: var(--text-dim);
}

.range-container input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.range-container span {
  min-width: 40px;
  font-size: 0.8rem;
  color: var(--text);
  text-align: right;
}

.mode-selector {
  display: flex;
  gap: 6px;
}

.mode-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.mode-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.mode-btn:hover:not(.active) {
  border-color: var(--text-dim);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.stats-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 2px 0;
  color: var(--text-dim);
}

.stat-val {
  color: var(--text);
  font-weight: 500;
}

.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-dim);
  background: var(--bg-hover);
}

.hidden {
  display: none !important;
}