/* assets/css/pages/home.css */

.home-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.home-icon-lg {
    font-size: 5rem;
}

.mini-event-date-span {
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.mb-05 {
    margin-bottom: 0.5rem;
}

.mb-0 {
    margin-bottom: 0;
}

/* =========================================================================
   KIM Hero Chat Widget (Neo-Brutalism)
   Design übernommen vom FAB Chat-Widget (chat-widget.css)
   ========================================================================= */

.kim-hero-wrapper {
    position: relative;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--brutal-shadow);
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

/* Header – wie .kim-chat-header auf kim.php */
.kim-hero-header {
    background: var(--accent-kim-solid);
    color: var(--color-ink);
    border-bottom: 3px solid var(--border-color);
    padding: 0 1rem 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    flex-shrink: 0;
}

[data-theme="dark"] .kim-hero-header {
    background: var(--bg-surface-3);
    color: var(--text-main);
}

.kim-hero-header-title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.kim-hero-header-title i {
    font-size: 1.5rem;
    background: var(--bg-card);
    color: var(--color-ink);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

[data-theme="dark"] .kim-hero-header-title i {
    background: var(--bg-surface-2);
    color: var(--text-main);
    border-color: var(--border-color);
}

/* Chat-History – wie .chat-body im Widget */
.kim-hero-chat-history {
    padding: 1.5rem;
    max-height: 400px;
    min-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-card);
    background-image: radial-gradient(var(--color-ink) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Scrollbar für History */
.kim-hero-chat-history::-webkit-scrollbar {
    width: 8px;
}
.kim-hero-chat-history::-webkit-scrollbar-track {
    background: var(--bg-subtle, #f1f1f1);
    border-left: 1px solid var(--border-color);
}
.kim-hero-chat-history::-webkit-scrollbar-thumb {
    background: var(--color-ink);
}

/* Bubbles – wie .chat-message im Widget */
.kim-hero-bubble {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in-out;
}

.kim-hero-bubble-bot {
    align-self: flex-start;
}

.kim-hero-bubble-user {
    align-self: flex-end;
}

.kim-hero-avatar {
    display: none;
}

/* Message Text – wie .message-content im Widget */
.kim-hero-text {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 500;
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--brutal-shadow);
    word-wrap: break-word;
}

.kim-hero-bubble-bot .kim-hero-text {
    background: var(--bg-card);
    color: var(--color-ink);
    border-bottom-left-radius: 0;
}

.kim-hero-bubble-user .kim-hero-text {
    background: var(--chat-user-msg-bg);
    color: var(--chat-user-msg-text);
    border-bottom-right-radius: 0;
}

.kim-hero-text strong {
    font-weight: 800;
}

/* Links in Bubbles */
.kim-hero-text a {
    color: currentColor;
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.kim-hero-text a:hover {
    background-color: var(--color-yellow);
    color: var(--text-on-bright);
    text-decoration: none;
}

/* Input Area – wie .chat-input-area im Widget */
.kim-hero-input-area {
    padding: 1.5rem;
    background: var(--bg-card);
    border-top: 3px solid var(--border-color);
}

.kim-hero-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#kim-hero-input {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0;
    outline: none;
    font-weight: 500;
    background: var(--bg-subtle);
    box-shadow: inset 2px 2px 0 var(--overlay-10);
    transition: all 0.2s;
    font-family: inherit;
}

#kim-hero-input:focus {
    background: var(--bg-card);
    box-shadow: inset 2px 2px 0 var(--brutal-shadow);
}

#kim-hero-submit {
    border: 2px solid var(--border-color);
    background: var(--color-ink);
    color: var(--text-light);
    border-radius: 0;
    padding: 0 1.5rem;
    min-height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 var(--overlay-20);
    transition: all 0.1s;
}

#kim-hero-submit:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--overlay-20);
}

#kim-hero-submit:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 0 0 0 var(--overlay-0);
}

#kim-hero-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Disclaimer – nutzt .kim-disclaimer aus kim.css (gemeinsame Klasse) */

/* Close-Button: nur auf Mobile (expanded) nötig */
.kim-hero-close-btn {
    display: none;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .kim-hero-wrapper {
        box-shadow: 4px 4px 0 var(--brutal-shadow);
    }

    .kim-hero-input-wrapper {
        flex-direction: row;
        gap: 0.5rem;
    }

    #kim-hero-input {
        padding: 0.75rem;
        flex: 1;
    }

    #kim-hero-submit {
        width: auto;
        height: 48px;
        padding: 0 1.25rem;
    }

    .kim-hero-bubble {
        max-width: 95%;
    }

    .kim-hero-chat-history {
        padding: 1rem;
        max-height: 40vh;
        -webkit-overflow-scrolling: touch;
    }

    .kim-hero-input-area {
        padding: 0.4rem 0.75rem 0.75rem;
    }

    #kim-hero-input {
        font-size: 16px; /* Explizit 16px - verhindert iOS Zoom */
    }

    .kim-hero-header {
        height: 50px;
        padding: 0 1rem;
    }


    /* =================================================================
       Expanded State – 1:1 Kopie des Flex-Layouts aus kim.css Mobile
       KEIN position:fixed → kein iOS-Keyboard-Sprung
       ================================================================= */

    /* 1. Body sperren – exakt wie body:has(.kim-page-container) in kim.css */
    body:has(.kim-hero-expanded) {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    /* 2. <main> mitflexen – exakt wie in kim.css */
    body:has(.kim-hero-expanded) > main {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* 3. Copyright-Footer ausblenden */
    body:has(.kim-hero-expanded) > .footer {
        display: none;
    }

    /* 4. Container füllt den Platz – wie .kim-page-container > .container */
    body:has(.kim-hero-expanded) > main > .container {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        max-width: 100%;
        /* Platz für fixierte Bottom-Nav */
        padding-bottom: calc(56px + env(safe-area-inset-bottom)) !important;
    }

    /* 5. lp-header füllt den Platz, alles außer Hero verstecken */
    body:has(.kim-hero-expanded) .lp-header {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    body:has(.kim-hero-expanded) .lp-header > *:not(.kim-hero-wrapper) {
        display: none !important;
    }

    /* 6. Alles nach lp-header verstecken (Grid, News, etc.) */
    body:has(.kim-hero-expanded) .lp-header ~ * {
        display: none !important;
    }

    /* 7. Hero-Wrapper füllt den Platz – wie .kim-chat-wrapper in kim.css */
    .kim-hero-wrapper.kim-hero-expanded {
        flex: 1;
        min-height: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        max-height: none;
    }

    .kim-hero-wrapper.kim-hero-expanded .kim-hero-close-btn {
        display: inline-flex !important;
    }

    .kim-hero-wrapper.kim-hero-expanded .kim-hero-header {
        height: 50px;
        flex-shrink: 0;
    }

    /* 8. Chat-History füllt den Rest – wie .kim-chat-body in kim.css */
    .kim-hero-wrapper.kim-hero-expanded .kim-hero-chat-history {
        flex: 1;
        min-height: 0;
        max-height: none;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    /* 9. Input-Bereich kompakt – wie .kim-chat-footer in kim.css */
    .kim-hero-wrapper.kim-hero-expanded .kim-hero-input-area {
        padding: 0.4rem 0.75rem 0.75rem;
        flex-shrink: 0;
    }

    /* 10. Disclaimer: lesbar und mit Abstand */
    .kim-hero-wrapper .kim-disclaimer {
        font-size: 0.65rem;
        margin-top: 0.5rem;
        margin-bottom: 0.25rem;
        line-height: 1.3;
    }

    /* ===== Guest-Bar: Im Flex-Flow statt als Overlay (expanded) =====
       Sitzt zwischen Chat-Footer und Bottom-Nav.
       Beim Schließen expandiert der Chat bis zur Bottom-Nav. */
    body:has(.kim-hero-expanded) .guest-bar {
        position: relative;
        bottom: auto;
        flex-shrink: 0;
        z-index: auto;
        margin-bottom: calc(56px + env(safe-area-inset-bottom));
    }

    body:has(.kim-hero-expanded) .guest-bar.guest-bar--hidden {
        display: none;
    }

    body:has(.kim-hero-expanded):has(.guest-bar:not(.guest-bar--hidden)) > main > .container {
        padding-bottom: 0 !important;
    }
}

/* Loading Dots – wie .typing-dots im Widget */
.kim-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--color-ink);
    border-radius: 50%;
    margin: 0 3px;
    animation: typing 1.4s infinite ease-in-out;
}

.kim-typing-dot:nth-child(1) { animation-delay: 0s; }
.kim-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.kim-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Hero Consent Overlay – wie .chat-consent-overlay im Widget ===== */
.kim-hero-consent-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--color-bg-canvas), transparent 2%);
    backdrop-filter: blur(4px);
    z-index: 10;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.kim-needs-consent .kim-hero-consent-overlay {
    display: flex;
}

.kim-hero-consent-box {
    background: var(--accent-marktplatz-bg);
    border: 2px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--brutal-shadow);
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

.kim-hero-consent-box h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--color-ink);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    justify-content: center;
}

.kim-hero-consent-box p {
    font-size: 0.85rem;
    color: var(--color-ink);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.kim-hero-consent-box a {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: underline;
}

.kim-hero-consent-box a:hover {
    background-color: var(--color-yellow);
    color: var(--color-text-on-yellow);
    text-decoration: none;
}
/* Interaktive Action Buttons in Hero Bubble */
.kim-hero-action-buttons {
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
    animation: fadeIn 0.3s ease-in-out;
}
.kim-hero-action-buttons.visible {
    display: flex;
}
.kim-hero-action-btn {
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
    text-transform: none;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    box-shadow: 2px 2px 0 var(--brutal-shadow);
    color: var(--color-ink);
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    z-index: 2;
}
.kim-hero-action-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--brutal-shadow);
    background-color: var(--color-yellow);
    color: var(--text-on-bright);
}
.kim-hero-action-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0 0 0 var(--brutal-shadow);
}

/* Linksbündig erzwingen in allen Bubbles (lp-header erbt text-align:center) */
.kim-hero-text {
    text-align: left;
}

/* Disclaimer-Styles (kim.css lädt nicht auf der Startseite) – Werte aus kim.css */
.kim-hero-wrapper .kim-disclaimer {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
    font-weight: 500;
    margin-top: 0.5rem;
}

.kim-hero-wrapper .kim-disclaimer a {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: underline;
}

.kim-hero-wrapper .kim-disclaimer a:hover {
    background: var(--color-yellow);
    color: var(--color-text-on-yellow);
    text-decoration: none;
}
