/**
 * NE Vorort Verfügbar – Frontend-Styles
 *
 * Styling für Button, Tooltip, Badge und Shop-Info im Webshop.
 * Farben werden per CSS-Variablen aus den Plugin-Einstellungen befüllt.
 * Responsive: Mobile-first, kompatibel mit allen modernen Browsern.
 *
 * @package NE_Vorort_Verfuegbar
 */

/* ==========================================================================
   1. CSS-Variablen (Fallback-Werte – werden durch PHP überschrieben)
   ========================================================================== */
:root {
    --ne-vv-btn-bg:       #4a90d9;
    --ne-vv-btn-color:    #ffffff;
    --ne-vv-btn-hover-bg: #357abd;
    --ne-vv-tt-bg:        #333333;
    --ne-vv-tt-color:     #ffffff;
    --ne-vv-badge-bg:     #e74c3c;
    --ne-vv-badge-color:  #ffffff;
}

/* ==========================================================================
   2. Wrapper
   ========================================================================== */
.ne-vv-wrapper {
    display: inline-block;
    position: relative;
}

.ne-vv-wrapper--single {
    display: block;
    margin: 8px 0;
}

/* ==========================================================================
   3. Button
   ========================================================================== */
.ne-vv-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background-color: var(--ne-vv-btn-bg);
    color: var(--ne-vv-btn-color);
    border: none;
    border-radius: 4px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, transform .1s ease;
    white-space: nowrap;
    line-height: 1.4;
    text-decoration: none;
}

.ne-vv-button:hover,
.ne-vv-button:focus {
    background-color: var(--ne-vv-btn-hover-bg);
    color: var(--ne-vv-btn-color);
    outline: none;
}

.ne-vv-button:active {
    transform: scale(.97);
}

.ne-vv-button--deaktiviert {
    background-color: #aaa !important;
    cursor: not-allowed;
    opacity: .75;
}

.ne-vv-button--ausgeblendet {
    display: none !important;
}

.ne-vv-icon {
    font-style: normal;
    font-size: 1em;
    line-height: 1;
    flex-shrink: 0;
}

/* ==========================================================================
   4. Tooltip
   ========================================================================== */
.ne-vv-tooltip {
    position: absolute;
    z-index: 9999;
    min-width: 220px;
    max-width: 320px;
    background: var(--ne-vv-tt-bg);
    color: var(--ne-vv-tt-color);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: .83rem;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    pointer-events: none;   /* Tooltip blockiert keine Klicks */
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

/* Tooltip sichtbar (via JS) */
.ne-vv-tooltip.ne-vv-tooltip--aktiv {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Animation deaktiviert */
.ne-vv-no-animation .ne-vv-tooltip {
    transition: none;
}

/* --- Positionen --- */
.ne-vv-tooltip--oben {
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
}
.ne-vv-tooltip--oben.ne-vv-tooltip--aktiv {
    transform: translateX(-50%) translateY(0);
}

.ne-vv-tooltip--unten {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
}
.ne-vv-tooltip--unten.ne-vv-tooltip--aktiv {
    transform: translateX(-50%) translateY(0);
}

.ne-vv-tooltip--links {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
}
.ne-vv-tooltip--links.ne-vv-tooltip--aktiv {
    transform: translateY(-50%) translateX(0);
}

.ne-vv-tooltip--rechts {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
}
.ne-vv-tooltip--rechts.ne-vv-tooltip--aktiv {
    transform: translateY(-50%) translateX(0);
}

/* --- Pfeil --- */
.ne-vv-tooltip__arrow {
    position: absolute;
    width: 0;
    height: 0;
}

.ne-vv-tooltip--oben .ne-vv-tooltip__arrow {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--ne-vv-tt-bg);
}

.ne-vv-tooltip--unten .ne-vv-tooltip__arrow {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--ne-vv-tt-bg);
}

.ne-vv-tooltip--links .ne-vv-tooltip__arrow {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid var(--ne-vv-tt-bg);
}

.ne-vv-tooltip--rechts .ne-vv-tooltip__arrow {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid var(--ne-vv-tt-bg);
}

/* --- Inhalt --- */
.ne-vv-tooltip__content {
    position: relative;
    z-index: 1;
}

.ne-vv-tooltip__text {
    margin: 0 0 8px;
}
.ne-vv-tooltip__text:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   5. Shop-Info im Tooltip
   ========================================================================== */
.ne-vv-shopinfo {
    border-top: 1px solid rgba(255,255,255,.2);
    padding-top: 8px;
    margin-top: 6px;
    font-size: .8rem;
    line-height: 1.6;
}

.ne-vv-shopinfo__name {
    display: block;
    margin-bottom: 4px;
    font-size: .85rem;
}

.ne-vv-shopinfo__adresse {
    display: block;
    font-style: normal;
    margin-bottom: 4px;
}

.ne-vv-shopinfo__zeiten,
.ne-vv-shopinfo__telefon,
.ne-vv-shopinfo__email {
    margin: 3px 0;
}

.ne-vv-shopinfo__maps {
    display: inline-block;
    margin-top: 6px;
    color: var(--ne-vv-tt-color);
    text-decoration: underline;
    font-size: .8rem;
}

.ne-vv-shopinfo a {
    color: var(--ne-vv-tt-color);
    text-decoration: none;
}
.ne-vv-shopinfo a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   6. Badge
   ========================================================================== */
.ne-vv-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: inline-block;
    padding: 3px 8px;
    background: var(--ne-vv-badge-bg);
    color: var(--ne-vv-badge-color);
    border-radius: 3px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.3;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: .03em;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* Badge auf Einzelprodukt-Seite etwas größer */
.ne-vv-badge--single {
    position: static;
    display: inline-block;
    margin: 6px 0;
    font-size: .8rem;
    padding: 4px 10px;
}

/* ==========================================================================
   7. Responsive
   ========================================================================== */

/* Auf mobilen Geräten Tooltip immer nach unten ausrichten */
@media (max-width: 600px) {
    .ne-vv-tooltip {
        position: fixed;
        bottom: 16px;
        left: 16px;
        right: 16px;
        top: auto;
        max-width: none;
        min-width: 0;
        transform: none !important;
        border-radius: 8px;
    }

    .ne-vv-tooltip--aktiv {
        transform: none !important;
    }

    .ne-vv-tooltip__arrow {
        display: none;
    }

    /* Schließen-Button auf Mobil */
    .ne-vv-tooltip--aktiv::after {
        content: '✕';
        position: absolute;
        top: 8px;
        right: 12px;
        cursor: pointer;
        font-size: 1rem;
        opacity: .7;
    }

    .ne-vv-button {
        width: 100%;
        justify-content: center;
    }

    .ne-vv-wrapper {
        display: block;
        width: 100%;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .ne-vv-tooltip {
        max-width: 260px;
    }
}

/* ==========================================================================
   8. Datenschutz-Modal (Google Maps)
   ========================================================================== */
.ne-vv-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ne-vv-modal.ne-vv-modal--offen {
    display: flex;
}

.ne-vv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    cursor: pointer;
}

.ne-vv-modal__box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
    animation: neVVModalEin .2s ease;
}

@keyframes neVVModalEin {
    from { opacity: 0; transform: translateY(-12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.ne-vv-no-animation .ne-vv-modal__box {
    animation: none;
}

.ne-vv-modal__titel {
    margin: 0 0 14px;
    font-size: 1.05rem;
    color: #222;
}

.ne-vv-modal__text {
    font-size: .875rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
}

.ne-vv-modal__footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.ne-vv-modal__btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 4px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 2px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.3;
}

.ne-vv-modal__btn--abbrechen {
    background: transparent;
    color: #555;
    border-color: #ccc;
}
.ne-vv-modal__btn--abbrechen:hover {
    background: #f0f0f0;
    border-color: #aaa;
}

.ne-vv-modal__btn--bestaetigen {
    background: var(--ne-vv-btn-bg);
    color: var(--ne-vv-btn-color);
    border-color: var(--ne-vv-btn-bg);
}
.ne-vv-modal__btn--bestaetigen:hover {
    background: var(--ne-vv-btn-hover-bg);
    border-color: var(--ne-vv-btn-hover-bg);
    color: var(--ne-vv-btn-color);
}

/* Maps-Button im Tooltip als Button-Reset gestalten */
.ne-vv-shopinfo__maps {
    display: inline-block;
    margin-top: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: .8rem;
    color: var(--ne-vv-tt-color);
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
}
.ne-vv-shopinfo__maps:hover {
    opacity: .8;
}

/* Body-Scroll sperren wenn Modal offen */
body.ne-vv-modal-offen {
    overflow: hidden;
}

@media (max-width: 480px) {
    .ne-vv-modal__box {
        padding: 18px 16px;
    }
    .ne-vv-modal__footer {
        flex-direction: column-reverse;
    }
    .ne-vv-modal__btn {
        width: 100%;
        text-align: center;
    }
}
