@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bg: #14161a;
  --bg-glow: radial-gradient(circle at 20% 0%, #241d16 0%, #14161a 45%);
  --panel: #1c1f24;
  --panel-alt: #22262c;
  --border: #33383f;
  --border-light: #40464f;
  --text: #e9e6e0;
  --text-muted: #9ba0a8;
  --accent: #d9622b;
  --accent-bright: #ff7a33;
  --accent-dim: #5a3620;
  --danger: #c0392b;
  --danger-bright: #e74c3c;
  --success: #3fae6a;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(0,0,0,0.45);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', 'Segoe UI', Arial, sans-serif;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  padding: 30px 16px;
  color: var(--text);
  min-height: 100vh;
}

h1, h2 {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

h1 {
  font-size: 34px;
  margin: 0 0 24px;
  color: var(--text);
  text-shadow: 0 0 18px rgba(217, 98, 43, 0.35);
}

h1::after {
  content: "";
  display: block;
  width: 70px;
  height: 3px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

h2 {
  font-size: 20px;
  margin: 32px 0 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  background: var(--panel);
  padding: 30px 32px 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 11px 14px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="password"]::placeholder {
  color: #6b6f76;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 98, 43, 0.2);
}

/* Native Zahlen-Pfeile ausblenden (wirken wie unstylbare weiße Kästen) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Item-Grid: responsives Wrap-Grid statt horizontalem Scroll-Grid */
#itemList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 12px;
  padding: 4px 2px 6px;
  max-height: 480px;
  overflow-y: auto;
}

#itemList::-webkit-scrollbar {
  width: 8px;
}
#itemList::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 8px;
}
#itemList::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 8px;
}

.item-box {
  padding: 12px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-alt);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.item-box:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(217, 98, 43, 0.25);
}

.item-box img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 8px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.item-box span {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

/* Liste der ausgewählten Items */
#selectedItems {
  list-style: none;
  padding: 0;
  margin: 0;
}

#selectedItems:empty::before {
  content: "—";
  display: block;
  text-align: center;
  color: var(--text-muted);
  padding: 14px 0;
}

#selectedItems li {
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-alt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

#selectedItems li button {
  background: transparent;
  color: var(--danger-bright);
  border: 1px solid var(--danger-bright);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.2s ease, color 0.2s ease;
}

#selectedItems li button:hover {
  background: var(--danger-bright);
  color: #fff;
}

/* Terminal-Look für die Code-Ausgabe */
.code-box {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--panel-alt);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  word-break: break-all;
  text-align: left;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 14px;
  color: #8fe39c;
  min-height: 20px;
  position: relative;
}

.code-box:empty::before {
  content: "—";
  color: #4d5158;
}

#generateBtn {
  display: block;
  margin: 22px auto 6px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #fff;
  border: none;
  padding: 13px 34px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(217, 98, 43, 0.35);
}

#generateBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 98, 43, 0.5);
}

#generateBtn:active {
  transform: translateY(0);
}

.copy-btn {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  margin: 10px 0 20px;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}

#notification {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 320px;
  background: var(--panel);
  color: var(--text);
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  font-weight: 600;
}

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

#notification.error {
  border-left-color: var(--danger-bright);
}

.hidden {
  display: none;
}

/* Sprachumschalter */
.language-selector {
  text-align: right;
  margin-bottom: 6px;
}

.language-selector .lang-flag {
  cursor: pointer;
  margin-left: 10px;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border-radius: 3px;
}

.language-selector .lang-flag.selected,
.language-selector .lang-flag:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.lang-flag {
  width: 28px;
  height: auto;
}

/* Mengen-Auswahl-Modal (ersetzt den nativen prompt()) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 26px 28px 22px;
  width: 90%;
  max-width: 320px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: scale(0.94);
  transition: transform 0.2s ease;
}

.modal-overlay.show .modal-box {
  transform: scale(1);
}

.modal-box img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.modal-box h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  text-transform: none;
  color: var(--text);
}

.modal-box p.modal-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.modal-qty-control {
  position: relative;
  margin-bottom: 18px;
}

.modal-box .modal-qty-control input[type="number"] {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 0;
  padding-right: 40px;
}

.modal-qty-steppers {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 34px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  overflow: hidden;
}

.modal-qty-step {
  flex: 1;
  border: none;
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}

.modal-qty-step + .modal-qty-step {
  border-top: 1px solid var(--border);
}

.modal-qty-step::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.modal-qty-step[data-step="up"]::before {
  border-bottom: 5px solid var(--text-muted);
}

.modal-qty-step[data-step="down"]::before {
  border-top: 5px solid var(--text-muted);
}

.modal-qty-step:hover {
  background: var(--accent);
}

.modal-qty-step:hover::before {
  border-bottom-color: #fff;
  border-top-color: #fff;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  border: 1px solid var(--border-light);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.modal-actions .modal-confirm {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(217, 98, 43, 0.35);
}

.modal-actions .modal-confirm:hover {
  transform: translateY(-1px);
}

.modal-actions .modal-cancel {
  background: transparent;
  color: var(--text-muted);
}

.modal-actions .modal-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Mobile Ansicht */
@media screen and (max-width: 600px) {
  body {
    padding: 14px 8px;
  }

  .container {
    padding: 18px 16px 24px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 18px;
  }

  #itemList {
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    max-height: 420px;
  }

  .item-box img {
    width: 52px;
    height: 52px;
  }

  #notification {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
