/*
 * ================================
 * 1) THEME & GLOBALS
 * ================================
 */

/* Light Theme Variablen + Globale Schrift */
:root {
    --primary-color: #c8aa22;      /* DVAG-Gold */
    --secondary-color: #e9e4d2;    /* Heller Sekundärton */
    --accent-color: #c8aa22;       /* Gold als Highlight */
    --text-color: #333333;         /* Dunkle Schrift auf hellem Hintergrund */
    --background-color: #f9f9f9;   /* Grund-Hintergrundfarbe (Light) */
    --font-family: 'Poppins', sans-serif;
    --transition-speed: 0.3s;      /* Für flüssige Theme-Übergänge */
}

/* Dark Theme per data-theme="dark" */
:root[data-theme="dark"] {
    --primary-color: #c8aa22;
    --secondary-color: #2a2a2a;
    --accent-color: #c8aa22;
    --text-color: #f5f5f5;
    --background-color: #1e1e1e;
}

/* Globale Standard-Stile */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease;
    overflow-x: hidden;    /* kein Horizontal-Scroll */
    display: flex;
    flex-direction: column; 
    min-height: 100vh;
}

/* ========== HEADER ========== */
header {
    background: var(--primary-color);
    padding: 1rem 0;
    color: white;
    z-index: 10;
    position: relative;
    width: 100%;
    transition: background-color var(--transition-speed) ease;
}

/* ========== MAIN ========== */
main {
    flex: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;  /* Zentriert z.B. Formulare */
    padding: 20px;
}

/* ========== FOOTER ========== */
footer {
    background: var(--secondary-color, #e9e4d2);
    padding: 20px 0;
    width: 100%;
    z-index: 7;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;  /* zentriert den Standard-Inhalt */
    z-index: 7;

}

.footer-link {
    color: #c8aa22; /* DVAG-Gold */
    text-decoration: none;
    font-weight: 600;
    margin-right: 1rem;
    z-index: 7;

}

.footer-copy {
    display: inline-block;
    color: var(--text-color, #333);
    font-size: 0.9rem;
    z-index: 7;

}

/* ========== BUTTONS ========== */
.btn {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}
.btn:hover {
    background: var(--primary-color);
}

/* ========== FORMS ========== */
form {
    background: #ffffff; 
    color: var(--text-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 0 auto;
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease;
}

.input-field {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}
.input-field i {
    padding: 1rem;
    background: var(--background-color);
    color: var(--primary-color);
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease;
}
.input-field input {
    flex: 1;
    padding: 1rem;
    border: none;
    outline: none;
    background-color: white;
    transition: background-color var(--transition-speed) ease,
                color var(--transition-speed) ease;
}
.input-field:focus-within {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 5px rgba(200, 170, 34, 0.5);
}
.input-field input:focus {
    font-size: 1.05rem;
}

h1, h2 {
    color: var(--text-color);
    transition: color var(--transition-speed) ease;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}
.auth-links a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ========== ERROR MESSAGES ========== */
.errorlist, .error {
    color: #d9534f;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.alert-danger {
    color: #d9534f;
    background-color: #d9534f;
    padding: 15px;
    border-radius: 5px;
    margin: 0 auto 1.5rem;
    border: 1px solid #f5c2c7;
    max-width: 450px;
    animation: fadeInDown 0.4s ease-in-out;
}
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== WRAPPER ========== */
.form-wrapper {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%; 
    max-width: 450px;
    min-height: 400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .form-wrapper {
        max-width: 100%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
    }
    footer {
        font-size: 0.9rem;
    }
}

/*
 * ================================
 * 2) CHATBOT-STYLES (inkl. Theme-Anpassung)
 * ================================
 */

/*
   Hier wurde der Z-Index verändert (9998), damit das Burger-Menü
   darüber liegen kann (z-index: 10000).
   Außerdem werden Theme-Variablen genutzt, damit der Chatbot
   im Dark/Light Mode automatisch wechselt.
*/
#chatbot-button {
    z-index: 8;
    position: fixed;
    bottom: 90px;
    right: 70px;
    background-color: var(--primary-color);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s ease, background-color var(--transition-speed) ease;
}
#chatbot-button:hover {
    transform: scale(1.1);
}

#chatbot-window {
    z-index: 9998;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 400px;
    background-color: var(--background-color);
    color: var(--text-color);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    min-width: 250px;
    min-height: 300px;
    max-width: 90vw;
    max-height: 80vh;
}
@media (max-width: 600px) {
    #chatbot-window {
        bottom: 20px;
        right: 10px;
        width: 80vw;     
        height: 50vh;    
        z-index: 9998;
    }
}

#chatbot-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}
#chatbot-header h3 {
    margin: 0;
}
#chatbot-header button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

#chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--background-color);
    color: var(--text-color);
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}
.chat-message.user {
    justify-content: flex-end;
}
.chat-message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
}
.chat-message.user .chat-message-bubble {
    background-color: var(--accent-color);
    color: #fff;
    border-top-right-radius: 0;
}
.chat-message.bot .chat-message-bubble {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-top-left-radius: 0;
}

#chatbot-input {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #ddd;
    color: var(--text-color);
}
#chatbot-user-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: var(--secondary-color);
    color: var(--text-color);
}
#chatbot-send, #chatbot-reset {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
}
#chatbot-send:hover, #chatbot-reset:hover {
    color: #9c8e1b; /* dunkleres Gold */
}
#chatbot-footer {
    text-align: center;
    padding: 10px;
    background-color: var(--background-color);
    border-top: 1px solid #ddd;
}
#chatbot-reset {
    color: #ff4d4d; /* rotes Icon */
}
#chatbot-reset:hover {
    color: #cc0000;
}
.typing-indicator {
    display: inline-block;
    font-weight: bold;
    color: #999;
    animation: dots 1.5s infinite;
}
@keyframes dots {
    0%, 20% { content: '.'; }
    40%     { content: '..'; }
    60%     { content: '...'; }
    80%,100%{ content: '.'; }
}

/*
 * ================================
 * 3) NAVBAR & DROPDOWN
 * ================================
 */

/* LOGO => Weiß, fett, kein Underline */
.navbar {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between; /* Logo links, Navigation rechts */
}
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    margin-left: 10px;
}

/* Burger icon => Standardmäßig hidden (Desktop) */
.burger-icon {
    display: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* nav-container => Desktop: alles in einer Zeile */
.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 10000;
}

/* .nav-links => horizontale Liste */
.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}
.nav-links li a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: transform 0.2s ease, font-weight 0.2s ease;
    display: block;
    padding: 0.5rem 0.75rem;
}
.nav-links li a:hover {
    font-weight: bold;
    transform: scale(1.05);
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.nav-container {
    position: relative;  /* oder static */
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 2rem;
}
.nav-container.nav-open {
    z-index: 10000;
}
.nav-container.nav-open .nav-links li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10000;
}
.user-info {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 2px solid white;
}
.user-name {
    margin-right: 0.5rem;
    font-weight: 600;
}
.user-info:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 2px 6px;
}

/* Dropdown */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--primary-color);
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 5px;
    display: none;
    min-width: 140px;
    z-index: 1999;
}

.dropdown li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.dropdown li a{
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info:hover .dropdown {
    display: block;
}
.dropdown li a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    transition: background 0.3s ease, transform 0.2s ease;
    font-size: 0.9rem;
    z-index: 1900;
}
.dropdown li a:hover {
    background: rgba(255,255,255,0.2);
    color: var(--text-color);
    transform: scale(1.05);
    border-radius: 5px;
}

/* Gastlinks (Login, Register) */
.guest-links {
    list-style: none;
    display: flex; /* Desktop nebeneinander */
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}
.guest-links li a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    display: block;
    padding: 0.5rem 0.75rem;
    transition: background 0.2s ease, transform 0.2s ease;
}
.guest-links li a:hover {
    font-weight: bold;
    transform: scale(1.05);
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* ---------- RESPONSIVE BURGER-MENU ---------- */
/* Hier auf max-width: 992px erhöht, 
   damit das Burger-Menü früher erscheint. */
@media (max-width: 1250px) {
    .burger-icon {
        display: block;
    }
    .nav-container {
        display: none;
        position: absolute;
        top: 60px;
        right: 10px;
        background: var(--primary-color);
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        border-radius: 8px;
        /* Hier z-index auf 10000 gesetzt, damit
           das Burger-Menü alles andere überdeckt */
    }
    .nav-container.nav-open {
        display: flex;
    }
    .nav-container.nav-open {
        z-index: 10000;
    }
    .nav-links {
        flex-direction: column;
    }
    /* Visuelle Trennung zwischen Links im Burger-Menü */
    .nav-links li:not(:last-child) {
        border-bottom: 1px solid rgba(255,255,255,0.3);
    }
    .user-info {
        margin-top: 0.5rem;
    }
    /* Gastlinks in Spalte anordnen */
    .guest-links {
        flex-direction: column;
        align-items: flex-start;
    }
}

/*
 * ================================
 * 4) COOKIE-BANNER & MODAL
 * ================================
 */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary-color);
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    display: none;  /* Wird per JS eingeblendet */
    z-index: 9999;
}
.cookie-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.cookie-actions {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}
.cookie-settings {
    background: transparent;
    border: 1px solid #c8aa22;
    color: #c8aa22;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}
.cookie-settings:hover {
    background: #c8aa22;
    color: #fff;
}

.modal {
    display: none; /* Standardmäßig versteckt */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: var(--secondary-color);
}
.modal-content {
    background-color: var(--secondary-color);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    text-align: center;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

#cookie-settings-form {
    background: var(--background-color);
    color: var(--text-color);
}

/* === Desktop caret + hover cue for grouped nav items === */
@media (min-width: 1251px) {
  .nav-links .has-sub > a::after {
    content: "▾";
    margin-left: 8px;
    font-size: .8em;
    vertical-align: middle;
    opacity: .9;
  }
  /* Highlight parent while submenu open */
  .nav-links .has-sub:hover > a {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-weight: 600;
  }
  /* Keep submenu visible when moving mouse down into it */
  .nav-links .has-sub:hover > .subnav {
    display: block;
    pointer-events: auto;
  }
  }

/* Make sure top-level items are always visible inline */
.nav-links > li.has-sub > a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}


/* ===== Strong default-hide for all subnavs; show only on hover (desktop) or when .open (mobile) ===== */
.nav-links .has-sub > .subnav { display: none !important; }

@media (min-width: 1251px) {
  .nav-links .has-sub > .subnav {
    position: absolute !important;
    top: calc(100% + 6px);
    left: 0;
  }
  .nav-links .has-sub:hover > .subnav { display: block !important; }
}

@media (max-width: 1250px) {
  .nav-container.nav-open .nav-links .has-sub.open > .subnav { display: block !important; }
  .nav-container.nav-open .nav-links .has-sub > .subnav { position: static !important; }
}


/* === Fix: make subnav interactive and reliably hoverable on desktop === */
@media (min-width: 1251px) {
  .nav-links .has-sub { position: relative; }
  .nav-links .has-sub > .subnav { 
    pointer-events: auto; 
    z-index: 10050;
  }
  /* Slightly extend hover area downward to avoid flicker when moving into submenu */
  .nav-links .has-sub::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px; /* small buffer zone */
  }
}

/* === Ensure burger and expanded menu sit on top and are clickable === */
.burger-icon { position: relative; z-index: 10060; }
.nav-container.nav-open { z-index: 10055; }


/* === Force submenus to DVAG gold background and highest stacking === */
.nav-links .has-sub > .subnav {
  background-color: #c8aa22 !important;
  z-index: 2147483647 !important; /* highest possible */
}


/* === Mobile Burger Flyout on Hover (opens to the LEFT of the tray) === */
@media (max-width: 1250px) {
  .nav-container.nav-open { position: absolute; }
  .nav-container.nav-open .nav-links .has-sub { position: relative; }
  /* Default hidden; we already enforce display:none elsewhere */
  .nav-container.nav-open .nav-links .has-sub:hover > .subnav {
    display: block !important;
    position: absolute !important;
    top: 0;
    right: 100%;              /* fly out to the LEFT side */
    left: auto;
    min-width: 220px;
    background: #c8aa22;      /* DVAG Gold */
    border-radius: 8px;
    padding: 8px 0;
    list-style: none;
    z-index: 2147483647;      /* on top of everything */
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    pointer-events: auto;
  }
  .nav-container.nav-open .nav-links .has-sub:hover > a {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-weight: 600;
  }
  .nav-container.nav-open .nav-links .has-sub > .subnav li {
    border-bottom: 1px solid rgba(255,255,255,.25);
  }
  .nav-container.nav-open .nav-links .has-sub > .subnav li:last-child {
    border-bottom: none;
  }
  .nav-container.nav-open .nav-links .has-sub > .subnav li a {
    display: block;
    padding: 10px 14px;
    white-space: nowrap;
    color: #fff;
    text-decoration: none;
  }
  .nav-container.nav-open .nav-links .has-sub > .subnav li a:hover {
    background: rgba(255,255,255,0.18);
    border-radius: 4px;
  }
}

.nav-links .has-sub > .subnav {
    list-style: none !important;
    margin: 0;
    padding: 0;
}