/* ============================ 🟦 STATUSBAR-USERPANEL ============================
   Aufgabe: Stile für das Userpanel (Login/Logout, Navigation, Token-Balance)
   Wird von Frontend_cardexx_analytics_main_header_userpanel und der zentralen JS-Logik genutzt.
=============================================================================== */

/* Beispiel für einen zentralen Container */
.main-container {
  max-width: 1200px;   /* Passe ggf. an dein Layout an */
  margin: 0 auto;
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

/* Wrapper für die Statusbar */
.statusbar-wrapper {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  border-bottom: 2px solid;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  background-color: #f5f7fa; /* Altweiß statt reinweiß */
}

/* Zustand: User eingeloggt */
.statusbar-wrapper.logged-in {
  background-color: #001871;
  color: white;
  border-bottom-color: #ffffff;
}

/* Zustand: User ausgeloggt */
.statusbar-wrapper.logged-out {
  background: #fff;
  color: #001871;
  border-bottom: 2px solid #001871;
  justify-content: center;
  align-items: center;
  height: 64px;
  display: flex;
  gap: 24px;
  font-family: 'IBM Plex Mono', monospace;
}

/* Registrierungsbanner-Link im ausgeloggten Zustand */
.statusbar-wrapper.logged-out a {
  color: #001871;
  font-weight: 700;
  font-size: 20px;
  text-decoration: underline;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Container für linke und rechte Seite der Statusbar */
.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Links und Buttons im Userpanel */
.bar-left a,
.bar-right a,
.bar-right button {
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background-color: #ffffff;
  color: #001b60;
  border: 2px solid #001b60;
  transition: all 0.25s ease;
  cursor: pointer;
}

/* Hover-Effekt für Links und Buttons */
.bar-left a:hover,
.bar-right a:hover,
.bar-right button:hover {
  background-color: #001b60;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Bildgrößen für Icons in der Statusbar */
.bar-left a img,
.bar-right a img,
.bar-right button img {
  width: 18px;
  height: 18px;
}

/* Login/Logout Buttons (nur Text, ohne Rahmen) */
.btn-login,
.btn-logout {
  color: #001b60;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Navigation-Button für Logout */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: white;
  color: #001b60;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
}

.btn-nav:hover {
  background-color: #f0f0f0;
}

/* Gleichmäßige Verteilung der Elemente */
.statusbar-wrapper .bar-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 32px;
}

/* Token-Info als weiße Schrift, kein Button */
.token-info {
  color: #fff;
  background: none;
  font-weight: 700;
  font-size: 1.2em;
  padding: 0 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-radius: 6px;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
}

/* Buttons optisch angleichen */
.btn-nav {
  color: #001871;
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-weight: 700;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, color 0.2s;
}

.btn-nav:hover {
  background: #001871;
  color: #fff;
}

.btn-logout img,
.btn-login img {
  width: 28px;
  height: 28px;
  margin-right: 8px;
}

/* Token-Balance Anzeige im Userpanel */
#user-token-balance {
  display: none;
}

/* ============================ RESPONSIVE STATUSBAR ============================
   Aufgabe: Responsives Verhalten für die Statusbar und das Userpanel
=============================================================================== */
@media (max-width: 900px) {
  .statusbar-wrapper {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 10px;
    font-size: 13px;
  }
  .bar-left,
  .bar-right {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .statusbar-wrapper {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 4px;
    font-size: 12px;
  }
  .bar-left,
  .bar-right {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .bar-left a,
  .bar-right a,
  .bar-right button {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 10px;
    font-size: 13px;
  }
  #user-token-balance {
    margin-left: 0;
    margin-top: 6px;
    width: 100%;
    text-align: left;
  }
}

/* ============================ AUTH & NAVIGATION ============================
   Aufgabe: Styles für alternative Login-Buttons (z.B. mobile Navigation)
=============================================================================== */
.nav-login,
#nav-auth-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #001b60;
  cursor: pointer;
  padding: 8px 14px;
  background: transparent;
  border: none;
  text-decoration: none;
}

.nav-login:hover,
#nav-auth-button:hover {
  text-decoration: underline;
}

.nav-login img,
#nav-auth-button img {
  width: 18px;
  height: 18px;
}

/* ============================ TOKEN-BALANCE (zentral) ============================
   Aufgabe: Einheitliche Darstellung der Token-Balance, auch außerhalb des Userpanels
=============================================================================== */
#user-token-balance {
  display: none;
}

/* ============================ USER-GREETING ============================
   Aufgabe: Begrüßungstext für eingeloggte User auf der Startseite
=============================================================================== */
#user-greeting {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: #001b60;
  margin-top: 60px;
  margin-bottom: 30px;
  text-align: left;
  padding-left: 32px;
}

@media (max-width: 768px) {
  #user-greeting {
    font-size: 2rem;
    text-align: center;
    padding-left: 0;
  }
}

/* ============================ DROPDOWNS & INPUTS ============================
   Aufgabe: Styles für die Fahrzeugauswahl und das Freitextformular
=============================================================================== */
#embed-brand,
#embed-model,
#embed-bodytype,
#embed-variant,
.manual-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 2px solid #00b0b9;
  color: #001b60;
  background-color: #fff;
  margin-bottom: 16px;
  width: 100%;
  min-width: 320px;
  max-width: 520px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.manual-input::placeholder {
  color: #999;
}

#embed-brand:hover,
#embed-model:hover,
#embed-bodytype:hover,
#embed-variant:hover,
.manual-input:hover {
  border-color: #4cc9f0;
  box-shadow: 0 0 0 4px rgba(76, 201, 240, 0.2);
}

#embed-brand:focus,
#embed-model:focus,
#embed-bodytype:focus,
#embed-variant:focus,
.manual-input:focus {
  outline: none;
  border-color: #4cc9f0;
}

select option {
  color: #001b60;
}

select option[disabled] {
  color: #999;
}

/* ============================ BUTTONS ============================
   Aufgabe: Einheitliche Buttons für Aktionen, Reset, Login etc.
=============================================================================== */
button,
.manual-btn,
.button-action,
.button-secondary,
.button-login {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  padding: 14px 20px;
  cursor: pointer;
  display: block;
  width: 100%;
  min-width: 240px;
  max-width: 360px;
  margin: 10px auto;
  transition: all 0.25s;
}

button:disabled,
.manual-btn:disabled {
  background-color: #ccc !important;
  color: #999 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

#embed-reset-button {
  background-color: #00b0b9;
  color: white;
}

#embed-reset-button:hover {
  background-color: #4cc9f0;
}

#embed-confirm-button,
#chart-preorder-button,
.button-login {
  background-color: #8c4cde;
  color: white;
}

#embed-confirm-button:disabled {
  background-color: #ccc !important;
  color: #999 !important;
  cursor: not-allowed;
}

#embed-confirm-button:hover,
#chart-preorder-button:hover,
.button-login:hover {
  background-color: #5e2ca5;
  transform: translateY(-1px);
}

.button-secondary {
  background: white;
  border: 2px solid #4c4cde;
  color: #4c4cde;
}

.button-secondary:hover {
  background-color: #4c4cde;
  color: white;
}

/* ============================ FEEDBACK-MESSAGES ============================
   Aufgabe: Styles für Fehler- und Erfolgsmeldungen im UI
=============================================================================== */
.embed-feedback-message {
  font-family: 'IBM Plex Mono', monospace;
  margin: 20px auto;
  padding: 14px 20px;
  max-width: 480px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  display: none;
}

.embed-error {
  background-color: #fdecea;
  border: 1px solid #f5c6cb;
  color: #c62828;
}

.embed-success {
  background-color: #e6f4ea;
  border: 1px solid #81c784;
  color: #2e7d32;
}

/* ============================ FREITEXT-FORMULAR ============================
   Aufgabe: Styles für das manuelle Anfrageformular
=============================================================================== */
.manual-input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 20px auto;
}

.manual-form-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: #4c4cde;
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: center;
}

.manual-form-subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  padding: 20px;
  color: #1a1a1a;
  margin-top: 30px;
  text-align: center;
}

.manual-warning-box {
  background-color: #f9f7ff;
  border: 2px solid #cdb4f5;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #4b1f94;
  margin-bottom: 16px;
  text-align: center;
}

.info-warning-box {
  background: #fffbe6;
  color: #b8860b;
  border: 1.5px solid #ffe58f;
  border-radius: 8px;
  padding: 12px 18px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.07);
  font-weight: 500;
  text-align: left;
  line-height: 1.5;
}

/* ============================ PREORDER BOX ============================
   Aufgabe: Box für Preorder-Informationen im UI
=============================================================================== */
#embed-preorder-message {
  max-width: 540px;
  margin: 30px auto;
  border-radius: 12px;
  padding: 0;
  text-align: center;
  display: block;
  background: transparent;
  border: none;
  transition: background 0.3s;
}

#embed-preorder-message.visible {
  background: #f9f7ff;
  border: 2px solid #cdb4f5;
  padding: 24px;
}

#embed-preorder-message p {
  color: #4b1f94;
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================ TOGGLE BUTTON MANUELLE ANFRAGE ============================
   Aufgabe: Button zum Öffnen/Schließen des Freitextformulars
=============================================================================== */
.manual-btn-toggle {
  background: white;
  color: #4c4cde;
  border: 2px solid #4c4cde;
  font-weight: 600;
  border-radius: 8px;
  padding: 14px 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  max-width: 360px;
  width: 100%;
  margin: 10px auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  transition: all 0.3s;
  cursor: pointer;
  display: block;
}

.manual-btn-toggle:hover {
  background-color: #4c4cde;
  color: white;
  transform: translateY(-1px);
}

.manual-btn.secondary:disabled {
  background-color: white !important;
  color: #4c4cde !important;
  border: 2px solid #4c4cde !important;
  cursor: not-allowed;
  opacity: 0.7;
}

.manual-btn.secondary.active {
  background-color: #4c4cde;
  color: white;
  border: 2px solid #4c4cde;
  cursor: pointer;
  opacity: 1;
  transform: translateY(-1px);
}

/* Hinweisbox für Preorder-Info unter dem Bestell-Button */
.cardexx-preorder-hint {
  margin-top: 16px;
  background: #fffbe6;
  color: #b8860b;
  border: 1.5px solid #ffe58f;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-family: 'IBM Plex Mono', monospace;
  width: 100;
  min-width: 320px;
  max-width: 520px;
  box-shadow: 0 2px 12px rgba(76, 76, 222, 0.07);
  line-height: 1.6;
  text-align: left;
}

/* ============================ MODAL STYLES ============================
   Aufgabe: Styles für die Login-Modal und deren Elemente
=============================================================================== */
/* Modal-Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.13);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Modal-Box */
.manual-login-modal {
  background: white;
  padding: 32px 28px;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.09);
  max-width: 380px;
  margin: auto;
  text-align: center;
}

/* Modal-Titel */
.manual-login-modal-title {
  color: #001b60; /* oder #222 für fast schwarz */
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  font-family: 'IBM Plex Mono', monospace;
  text-align: center;
}

/* Button-Container */
.manual-login-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Haupt-Button */
.button-action {
  background: #4c4cde;
  color: white;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 14px 0;
  width: 100%;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.button-action:hover,
.button-action:focus {
  background: #001b60;
  transform: translateY(-1px);
}

/* Sekundär-Button */
.button-secondary {
  background: #e0e0e0;
  color: #222;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 12px 0;
  width: 100%;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.button-secondary:hover,
.button-secondary:focus {
  background: #d1d1d1;
  color: #111;
  transform: translateY(-1px);
}

/* Cancel-Button */
.button-cancel {
  background: none;
  color: #222;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.18s, transform 0.18s;
}
.button-cancel:hover,
.button-cancel:focus {
  color: #4c4cde;
  transform: translateY(-1px);
}

const BASE_API_URL = window.BASE_API_URL || "https://api.digitalmarketservices.de";