/**
 * Handy Hüllen Generator - Stylesheet
 * Dark cyberpunk/maker theme (same as Armor Plate Generator)
 */

:root {
  --bg: #0b0f14;
  --panel: #0f1620;
  --card: #121c28;
  --text: #e8f0ff;
  --muted: #9fb0c8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --warn: #ffcc00;
  --err: #ff4d6d;
  --ok: #57d163;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(ellipse 1200px 800px at 15% 10%, #15243a 0%, var(--bg) 50%, #070a0f 100%);
  color: var(--text);
  min-height: 100vh;
}

/* Main Layout */
.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Left Panel */
.panel {
  background: linear-gradient(180deg, rgba(18, 28, 40, 0.95), rgba(10, 14, 20, 0.95));
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--card);
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-track {
  background: var(--card);
}

.panel::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

/* Header */
h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1::before {
  content: '📱';
}

/* Cards */
.card {
  background: rgba(18, 28, 40, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Form Elements */
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 20, 29, 0.8);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input[type="number"]::-webkit-inner-spin-button {
  opacity: 0.5;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239fb0c8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background-color: #121c28;
  color: #e8f0ff;
  padding: 8px;
}

/* Checkbox Labels */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-label span {
  margin-bottom: 0;
  display: inline;
}

/* Grid Layouts */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.08));
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.3), rgba(59, 130, 246, 0.15));
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.btnrow {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btnrow button {
  flex: 1;
}

/* Warnings Panel */
.warnings {
  font-size: 12px;
  line-height: 1.5;
}

.warnings > div {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.warn {
  color: var(--warn);
  background: rgba(255, 204, 0, 0.1);
  border-left: 3px solid var(--warn);
}

.err {
  color: var(--err);
  background: rgba(255, 77, 109, 0.1);
  border-left: 3px solid var(--err);
}

.ok {
  color: var(--ok);
  background: rgba(87, 209, 99, 0.1);
  border-left: 3px solid var(--ok);
}

.hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
  line-height: 1.4;
}

/* 3D View */
.view {
  position: relative;
  background: radial-gradient(ellipse at center, #0d1825 0%, #070a0f 100%);
}

#c {
  width: 100%;
  height: 100%;
  display: block;
}

/* Viewport Toolbar */
.viewport-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.viewport-toolbar button {
  width: 36px;
  height: 36px;
  padding: 0;
  min-height: unset;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  background: rgba(15, 22, 32, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
}

.viewport-toolbar button:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--accent);
}

/* Color Picker */
input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 20, 29, 0.8);
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

/* Info overlay */
.info-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(15, 22, 32, 0.9);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.info-overlay strong {
  color: var(--text);
}

/* Footer */
.foot {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mini {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
  line-height: 1.5;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease;
}

.toast.success { border-left: 4px solid var(--ok); }
.toast.error { border-left: 4px solid var(--err); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Focus States for Accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Wizard Modal */
.wizard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.wizard-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.wizard-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.wizard-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}

.wizard-step {
  padding: 20px;
}

.wizard-step h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

.wizard-diagram {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 16px;
}

.wizard-fields {
  margin-bottom: 8px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.wizard-preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.wizard-preview td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.wizard-preview td:first-child {
  color: var(--muted);
  width: 40%;
}

/* Decoration Thumbnails */
.deco-thumb {
  display: block;
  max-width: 80px;
  max-height: 60px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  object-fit: contain;
  background: #0a0e14;
}

/* Range slider styling */
input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin-top: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

/* Wizard Cutout Row */
.wiz-cut-row {
  display: flex;
  gap: 4px;
  align-items: end;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.wiz-cut-row input[type="number"],
.wiz-cut-row input[type="text"],
.wiz-cut-row select {
  min-height: unset;
  padding: 4px 6px;
  font-size: 11px;
}

.wiz-cut-row label {
  margin-bottom: 0;
}

/* Cutout Advanced Details */
details summary {
  user-select: none;
  padding: 2px 0;
}

details summary:hover {
  color: var(--accent);
}

/* Pattern Preview in Decoration */
.deco-pattern-preview {
  display: block;
  width: 60px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Responsive */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(40vh, 1fr) auto;
    height: 100dvh;
  }

  .panel {
    order: 2;
    max-height: 60vh;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .view {
    order: 1;
    min-height: 40vh;
  }

  button {
    min-height: 48px;
    padding: 14px 18px;
  }

  input[type="number"],
  select {
    min-height: 48px;
    font-size: 16px;
  }

  .btnrow {
    flex-wrap: wrap;
  }

  .btnrow button {
    flex: 1 1 calc(50% - 5px);
  }

  .toast-container {
    left: 20px;
    right: 20px;
    bottom: 10px;
  }

  .toast {
    max-width: none;
  }

  .viewport-toolbar {
    top: 10px;
    right: 10px;
  }

  .viewport-toolbar button {
    min-height: unset;
    width: 40px;
    height: 40px;
  }
}
