/* --- Globale Einstellungen --- */
:root {
  /* DARK MODE (Standard) */
  --bg-main: #0f172a;        
  --bg-card: #1e293b;        
  --text-main: #f8fafc;      
  --text-muted: #94a3b8;     
  --accent-color: #3b82f6;   
  --accent-glow: rgba(59, 130, 246, 0.25);
  --border-color: #334155;
  --bg-hover: #2dd4bf15;     
}

/* LIGHT MODE Variablen */
:root[data-theme="light"] {
  --bg-main: #f4f4f9;        
  --bg-card: #ffffff;        
  --text-main: #1e293b;      
  --text-muted: #64748b;     
  --accent-color: #3b82f6;   
  --accent-glow: rgba(59, 130, 246, 0.25);
  --border-color: #cbd5e1;
  --bg-hover: #f1f5f9;   
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================
   HEADER / NAVIGATIONS DESIGN
========================================== */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-main) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 3rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.main-header .logo {
  text-decoration: none;
}

.main-header h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-btn {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.nav-btn:hover {
  background-color: var(--bg-hover);
}

.nav-btn.login-btn {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.nav-btn.login-btn:hover {
  background-color: var(--accent-color);
  color: #fff;
}

.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  margin-left: 10px;
}

.theme-toggle:hover {
  background-color: var(--border-color);
  transform: scale(1.1);
}

/* ==========================================
   STARTSEITE ZUSÄTZE
========================================== */
.home-container {
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
}

.prebuilds-placeholder {
  text-align: center;
  width: 100%;
  margin-top: 10vh;
}

.prebuilds-placeholder h2 {
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================
   MODALS (Popups)
========================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  width: 90%;
  max-width: 450px;
  position: relative;
  flex-direction: column;
  align-items: center;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  z-index: 10;
}

.close-modal:hover {
  color: var(--accent-color);
}

/* --- Layout Konfigurator --- */
.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px; 
  margin: 0 auto;
}

@media (min-width: 1000px) {
  .container { flex-direction: row; }
}

.config-section {
  flex: 2.5;
  display: flex;
  flex-direction: column;
  gap: 1.5rem; 
}

/* --- Komponenten-Karten --- */
.component {
  background: var(--bg-card);
  padding: 2rem; 
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.component:hover {
  border-color: var(--text-muted);
}

@media (min-width: 700px) {
  .component {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.component label {
  font-weight: 700;
  font-size: 1.25rem; 
  color: var(--text-main);
  width: 100%;
  margin-top: 15px;
}

@media (min-width: 700px) {
  .component label { width: 25%; }
}

/* NEU: Flex Row für Dropdown + Button */
.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.input-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative; 
}

@media (min-width: 700px) {
  .input-wrapper { width: 75%; }
}

.part-select {
  display: none !important;
}

/* ==========================================
   CUSTOM BILDER DROPDOWN DESIGN
========================================== */

.custom-select-wrapper {
  position: relative;
  flex: 1; /* Nimmt den restlichen Platz in der Reihe */
  user-select: none;
}

/* Der neue Button für den Katalog */
.advanced-btn {
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  border-radius: 10px;
  padding: 0 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
}

.advanced-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--bg-hover);
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  min-height: 75px; 
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.custom-select-trigger:hover {
  border-color: var(--accent-color);
}

.custom-select-trigger.open {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-glow);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.custom-select-trigger.open.open-up {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.trigger-content {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.trigger-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.trigger-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.custom-select-trigger.open .trigger-arrow {
  transform: rotate(180deg);
}

/* Der Farb-Picker */
.color-picker {
  display: flex;
  gap: 6px;
  padding-right: 15px;
  border-right: 1px solid var(--border-color);
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  box-shadow: 0 0 0 2px var(--accent-color), inset 0 0 0 2px var(--bg-main);
  transform: scale(1.15);
}

/* Die ausklappbare Liste */
.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 2px solid var(--accent-color);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  max-height: 400px; 
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}

.custom-select-options.open-up {
  top: auto;
  bottom: 100%;
  border-top: 2px solid var(--accent-color);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -20px 25px -5px rgba(0,0,0,0.3);
}

.custom-select-options.open {
  display: block;
}

.custom-select-optgroup {
  padding: 12px 20px;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-color);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.custom-select-optgroup:first-child { border-top: none; }

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.custom-select-option:last-child { border-bottom: none; }

.custom-select-option:hover, .custom-select-option.selected {
  background-color: var(--bg-hover);
}

.option-img {
  width: 70px; 
  height: 70px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff; 
  padding: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.option-img:hover {
  transform: scale(1.05);
}

.option-img-placeholder {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: var(--bg-main);
  border-radius: 8px;
  border: 2px dashed var(--border-color);
  color: var(--text-muted);
}

.option-text {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
}

.custom-input {
  width: 100%;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: rgba(59, 130, 246, 0.05);
  border: 2px dashed var(--accent-color);
  border-radius: 10px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  margin-top: 10px;
}
.custom-input:focus {
  outline: none;
  background-color: var(--bg-main);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ==========================================
   ERWEITERTER KATALOG (GRID)
========================================== */
.advanced-controls {
  display: flex;
  gap: 15px;
  width: 100%;
  margin-bottom: 20px;
}

.sort-select {
  width: auto; 
  margin: 0; 
  cursor: pointer;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  width: 100%;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 10px;
}

.advanced-card {
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.advanced-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.advanced-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
}

.card-title {
  font-weight: bold;
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 0;
  flex-grow: 1; /* Drückt Preis nach unten */
}

.card-category {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.card-price {
  color: var(--accent-color);
  font-size: 1.3rem;
  font-weight: 800;
}

.card-demand {
  color: #f59e0b;
  font-size: 0.9rem;
}


/* --- Zusammenfassung --- */
.summary-section {
  flex: 1;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
  height: fit-content;
  position: sticky;
  top: 2rem;
}

.summary-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.8rem;
  color: var(--text-main);
}

#build-summary {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#build-summary li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 1.1rem;
}

#build-summary li:last-child { border-bottom: none; }
#build-summary li strong { color: var(--text-muted); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* --- Absenden Button --- */
.submit-btn {
  width: 100%;
  padding: 1.2rem;
  margin-top: 1.5rem;
  background-color: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.submit-btn:hover { background-color: #2563eb; transform: translateY(-2px); }
.submit-btn:active { transform: translateY(0); }

/* --- Kompatibilitäts Box --- */
.compatibility-box {
  margin-top: 1.5rem;
  padding: 1.2rem;
  border-radius: 8px;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.compat-success { background-color: rgba(16, 185, 129, 0.1); border: 1px solid #10b981; color: #10b981; }
.compat-error { background-color: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #ef4444; }
.compat-warning { background-color: rgba(245, 158, 11, 0.1); border: 1px solid #f59e0b; color: #f59e0b; }
.compatibility-box p { margin: 0; display: flex; align-items: flex-start; gap: 0.5rem; }

/* ==========================================
   LIGHTBOX FÜR GROßE BILDER
========================================== */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  background: #fff;
  padding: 10px;
}

.lightbox-overlay.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.lightbox-close:hover {
  color: var(--accent-color);
}