/* =========================================================
   MD TRADE – Globaler Layer (auf JEDER Seite geladen)
   Enthält: einheitliches Menü-Button-Design + Livechat.
   Wird über app/includes/header.php eingebunden.
   ========================================================= */

:root {
  --hm-accent: #ff4a26;
  --hm-accent-2: #ff7a45;
  --hm-ink: #0d1a1c;
  --hm-muted: #55636b;
  --hm-line: #e7ecee;
  --hm-soft: #f5f8f9;
  --hm-radius: 18px;
  --hm-shadow: 0 24px 60px rgba(6, 20, 24, 0.18);
  --hm-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* =========================================================
   MENÜ-BUTTONS – einheitliches „Start"-Design (gefüllte Pille)
   Gilt für alle Menüpunkte (nur horizontales Menü ab 992px).
   ========================================================= */
@media (min-width: 992px) {
  .theme-main-menu .navbar-nav > .nav-item { margin: 0 6px; }

  .theme-main-menu .navbar-nav .nav-link {
    background: linear-gradient(100deg, var(--hm-accent), var(--hm-accent-2));
    color: #fff !important;
    border-radius: 999px;
    padding: 9px 22px !important;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 8px 18px rgba(255, 74, 38, 0.35);
    transition: all 0.22s ease;
  }
  .theme-main-menu .navbar-nav .nav-link:hover,
  .theme-main-menu .navbar-nav .nav-link:focus {
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 74, 38, 0.5);
  }

  /* Menüleiste im Desktop-Design: dunkler Hintergrund mit 80% Deckkraft
     (nur ab 992px; im Mobil-Menü bleibt die Leiste unverändert). */
  .theme-main-menu.menu-overlay,
  .theme-main-menu.fixed {
    background: rgba(13, 26, 28, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  /* Balken ~1/3 dünner: weniger Innenabstand */
  .theme-main-menu .gap-two {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  /* Logo größer, ragt aber über den Balken hinaus, ohne ihn höher zu machen. */
  .theme-main-menu .logo {
    height: 66px;
    display: flex;
    align-items: flex-start;
    overflow: visible;
  }
  .theme-main-menu .logo img {
    height: 92px !important;
    width: auto;
  }
}

/* ================= LIVECHAT ================= */
.mdc-root { position: fixed; right: 22px; bottom: 22px; z-index: 99990; font-family: var(--hm-font); }
@media (max-width: 520px) { .mdc-root { right: 14px; bottom: 14px; } }

.mdc-launcher {
  width: 62px; height: 62px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--hm-accent), var(--hm-accent-2));
  color: #fff; font-size: 1.6rem;
  box-shadow: 0 14px 32px rgba(255, 74, 38, 0.42);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease;
  position: relative;
}
.mdc-launcher:hover { transform: scale(1.06); }
.mdc-launcher .close-ic { display: none; }
.mdc-root.open .mdc-launcher .chat-ic { display: none; }
.mdc-root.open .mdc-launcher .close-ic { display: block; }

.mdc-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #16a34a; color: #fff; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; line-height: 20px; text-align: center;
  border: 2px solid #fff; display: none;
}
.mdc-badge.show { display: block; }

@keyframes mdc-shake {
  0%,100% { transform: rotate(0); }
  15% { transform: rotate(-14deg); }
  30% { transform: rotate(12deg); }
  45% { transform: rotate(-10deg); }
  60% { transform: rotate(8deg); }
  75% { transform: rotate(-5deg); }
}
.mdc-launcher.shake { animation: mdc-shake 0.8s ease; }

/* Teaser-Bubble */
.mdc-teaser {
  position: absolute; bottom: 76px; right: 0;
  width: 268px; background: #fff; color: var(--hm-ink);
  border-radius: 16px; padding: 14px 16px 14px;
  box-shadow: var(--hm-shadow);
  opacity: 0; transform: translateY(10px) scale(0.96); pointer-events: none;
  transition: all 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid var(--hm-line);
}
.mdc-teaser.show { opacity: 1; transform: none; pointer-events: auto; }
.mdc-root .mdc-teaser p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--hm-ink); }
.mdc-teaser .who { font-weight: 700; font-size: 0.82rem; color: var(--hm-accent); margin-bottom: 3px; display: block; }
.mdc-teaser .x {
  position: absolute; top: 8px; right: 10px; cursor: pointer;
  color: #aab4b8; font-size: 1rem; line-height: 1; border: none; background: none;
}

/* Panel */
.mdc-panel {
  position: absolute; bottom: 78px; right: 0;
  width: 350px; max-width: calc(100vw - 28px);
  height: 480px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 20px;
  box-shadow: var(--hm-shadow);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(0.97); pointer-events: none;
  transition: all 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid var(--hm-line);
}
.mdc-root.open .mdc-panel { opacity: 1; transform: none; pointer-events: auto; }

.mdc-header {
  background: linear-gradient(120deg, #12232a, #0d1a1c);
  color: #fff; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.mdc-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--hm-accent), var(--hm-accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; flex: none;
}
.mdc-header .t { font-weight: 700; font-size: 0.98rem; line-height: 1.1; }
.mdc-header .s { font-size: 0.76rem; opacity: 0.8; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.mdc-header .s .live { width: 8px; height: 8px; border-radius: 50%; background: #35d07f; }

.mdc-body {
  flex: 1; overflow-y: auto; padding: 18px 16px;
  background: #f4f7f8;
  display: flex; flex-direction: column; gap: 10px;
}
.mdc-msg { max-width: 82%; font-size: 0.92rem; line-height: 1.5; padding: 10px 13px; border-radius: 14px; }
.mdc-msg.bot { background: #fff; color: var(--hm-ink); border: 1px solid var(--hm-line); border-bottom-left-radius: 4px; align-self: flex-start; box-shadow: 0 3px 8px rgba(6,20,24,0.05); }
.mdc-msg.user { background: linear-gradient(120deg, var(--hm-accent), var(--hm-accent-2)); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.mdc-typing { display: flex; gap: 4px; align-self: flex-start; background: #fff; border: 1px solid var(--hm-line); padding: 12px 14px; border-radius: 14px; border-bottom-left-radius: 4px; }
.mdc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #c2ccd0; animation: mdc-bounce 1.2s infinite; }
.mdc-typing span:nth-child(2) { animation-delay: 0.18s; }
.mdc-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes mdc-bounce { 0%,60%,100% { transform: translateY(0); opacity: 0.6; } 30% { transform: translateY(-5px); opacity: 1; } }

.mdc-foot { border-top: 1px solid var(--hm-line); padding: 10px 12px; background: #fff; }
.mdc-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.mdc-input {
  flex: 1; border: 1.5px solid var(--hm-line); border-radius: 12px;
  padding: 10px 12px; font-size: 0.92rem; font-family: inherit; resize: none;
  max-height: 92px; line-height: 1.4; color: var(--hm-ink);
}
.mdc-input:focus { outline: none; border-color: var(--hm-accent); box-shadow: 0 0 0 3px rgba(255,74,38,0.12); }
.mdc-send {
  width: 44px; height: 44px; flex: none; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(120deg, var(--hm-accent), var(--hm-accent-2)); color: #fff; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease;
}
.mdc-send:hover { transform: scale(1.05); }
.mdc-privacy { text-align: center; font-size: 0.72rem; color: #9aa6ab; margin: 8px 0 2px; }
.mdc-privacy a { color: #9aa6ab; text-decoration: underline; }
