/* ==========================================================================
   Happy Marktfinder — Layout & Komponenten
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Wrapper
   --------------------------------------------------------------------------- */

#happy-marktfinder {
    width: 100%;
}

/* ---------------------------------------------------------------------------
   Karten-Container
   --------------------------------------------------------------------------- */

.happy-map-wrap {
    position: relative;
    width: 100%;
    max-width: var(--outer-width);
    margin-inline: auto;
    background-color: #e9e9e9;
    border-radius: 0.75rem;
    overflow: hidden;
}

#happy-map {
    width: 100%;
    height: 620px;
}

@media (max-width: 900px) {
    #happy-map { height: 500px; }
}

@media (max-width: 600px) {
    #happy-map { height: 450px; }
}

/* ---------------------------------------------------------------------------
   Consent-Placeholder
   --------------------------------------------------------------------------- */

.happy-map-consent {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    /* Placeholder-Bild der Karte, abgedunkelt für Lesbarkeit von Text/Button.
       background-color bleibt als Fallback, falls das Bild fehlt. */
    background-color: rgba(29, 29, 27, 0.85);
    background-image:
        linear-gradient(rgba(29, 29, 27, 0.65), rgba(29, 29, 27, 0.65)),
        url("/app/uploads/2026/07/happy-mapbox-placeholder.jpg");
    background-size: cover;
    background-position: center;
    text-align: center;
    z-index: 10;
}

.happy-map-consent p {
    color: #fff;
    font-size: 1rem;
    margin: 0;
}

/* ---------------------------------------------------------------------------
   Suchfeld über der Karte
   --------------------------------------------------------------------------- */

.happy-map-search {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 700px);
    z-index: 5;
    overflow: visible;
}

/* Shadow follows the SVG brush shape. The drop-shadow must sit on the HOST element,
   not on the masked ::before: CSS applies filter before mask, so a drop-shadow on the
   masked pseudo gets clipped away by its own mask. On the host, the ::before mask is
   resolved first, then the host's drop-shadow follows the resulting brush contour. */
.happy-map-search .form-field,
.happy-map-search .market-search__btn {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}

.happy-map-search .form-field {
    position: relative;
    flex: 1;
}

/* Autocomplete-Dropdown */
.happy-mf-autocomplete {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 20;
}

.happy-mf-autocomplete__item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.happy-mf-autocomplete__item:last-child {
    border-bottom: none;
}

.happy-mf-autocomplete__item:hover {
    background-color: #f5f5f5;
}

.happy-mf-autocomplete__name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1d1d1b;
}

.happy-mf-autocomplete__context {
    font-size: 0.8125rem;
    color: #777;
    margin-top: 0.125rem;
}

/* ---------------------------------------------------------------------------
   Mapbox-Marker
   --------------------------------------------------------------------------- */

/* Wrapper — nicht rotiert, Flex-Reihe: Pin + Label */
.happy-mf-marker {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    cursor: pointer;
}

/* Diamant-Pin */
.happy-mf-marker__pin {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    background-color: var(--color-brand-primary, #e30613);
    border: 2.5px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.happy-mf-marker.is-active .happy-mf-marker__pin {
    background-color: #1d1d1b;
    transform: rotate(-45deg) scale(1.25);
}

/* Name-Label */
.happy-mf-marker__label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: #1d1d1b;
    background: #fff;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.25rem;
}

.happy-mf-marker.is-active .happy-mf-marker__label {
    background-color: #1d1d1b;
    color: #fff;
}

/* Pin für gesuchten Standort */
.happy-mf-user-marker {
    width: 1rem;
    height: 1rem;
    background-color: #fff;
    border: 3px solid var(--color-brand-primary, #e30613);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.2);
}

/* ---------------------------------------------------------------------------
   Markt-Grid — responsive, nicht via Tailwind lösbar
   --------------------------------------------------------------------------- */

.happy-market-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 2rem;
    column-gap: 3rem;
    margin-top: 2.5rem;
    max-width: var(--inner-width);
    margin-inline: auto;
}

@media (max-width: 900px) {
    .happy-market-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .happy-market-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ---------------------------------------------------------------------------
   Markt-Card — nur was Tailwind nicht kann
   --------------------------------------------------------------------------- */

.happy-market-card {
    border-radius: 0.75rem;
    padding: 0;
    transition: background-color 0.2s, padding 0.2s;
}

.happy-market-card.is-active {
    background-color: #ffffff;
    color: var(--color-brand-background, #1d1d1b);
    padding: 0.75rem;
}

/* Wrapper: Positionierungskontext für Details-Overlay, kein overflow: hidden */
.happy-market-card__image-wrap {
    position: relative;
}

/* aspect-ratio + background: arbitrary values werden vom CDN nicht kompiliert */
.happy-market-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #2a2a28;
    overflow: hidden;
    border-radius: 0.75rem;
}

/* Im 3-Spalten-Layout bei engen Breiten: Bild auf 1:1 erhöhen,
   damit das aufgeklappte Details-Element vollständig sichtbar bleibt */
@media (min-width: 601px) and (max-width: 1250px) {
    .happy-market-card__image {
        aspect-ratio: 1 / 1;
    }
}

.happy-market-card:hover .happy-market-card__image img {
    transform: scale(1.04);
}

/* font-family via CSS-Variable nicht als Tailwind-Klasse verfügbar */
.happy-market-card__name {
    font-family: var(--font-headline, sans-serif);
}

/* text-white/60: opacity-Modifier wird vom CDN nicht kompiliert */
.happy-market-card__fax {
    opacity: 0.55;
}

/* ---------------------------------------------------------------------------
   Öffnungszeiten-Overlay in der Card-Image
   --------------------------------------------------------------------------- */

/* Overlay-Modus: inside image-wrap (desktop) */
.happy-market-card__image-wrap > .happy-market-card__hours {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Inline-Modus: direct child of card (mobile, JS-verschoben) */
.happy-market-card > .happy-market-card__hours {
    position: static;
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.happy-market-card > .happy-market-card__hours .happy-market-card__hours-summary {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.happy-market-card > .happy-market-card__hours .happy-market-card__hours-summary.is-closed {
    background-color: rgba(255, 255, 255, 0.1);
}

.happy-market-card.is-active > .happy-market-card__hours .happy-market-card__hours-summary.is-closed {
    background-color: rgba(29, 29, 27, 0.1);
    color: #1d1d1b;
}

.happy-market-card > .happy-market-card__hours .happy-market-card__hours-list {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: rgba(29, 29, 27, 0.95);
}

.happy-market-card__hours-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    border-radius: 0.5rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: border-radius 0.15s;
    user-select: none;
}

.happy-market-card__hours-summary::-webkit-details-marker {
    display: none;
}

/* Status-Punkt links */
.happy-market-card__hours-summary::before {
    content: '';
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Chevron rechts — schiebt den Text nach links */
.happy-market-card__hours-summary::after {
    content: '';
    display: inline-block;
    margin-left: auto;
    padding-left: 0.5rem;
    width: 0.9rem;
    height: 0.9rem;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    transition: transform 0.2s ease;
}

.happy-market-card__hours[open] .happy-market-card__hours-summary::after {
    transform: rotate(180deg);
}

.happy-market-card__hours-summary.is-open {
    color: #fff;
    background-color: rgba(29, 29, 27, 0.82);
}

.happy-market-card__hours-summary.is-open::before {
    background-color: #4caf50;
}

.happy-market-card__hours-summary.is-closed {
    color: #fff;
    background-color: rgba(29, 29, 27, 0.82);
}

.happy-market-card__hours-summary.is-closed::before {
    background-color: var(--color-brand-primary, #e30613);
}

.happy-market-card__hours[open] .happy-market-card__hours-summary {
    border-radius: 0.5rem 0.5rem 0 0;
}

.happy-market-card__hours-list {
    background-color: rgba(29, 29, 27, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0.5rem 0.75rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

.happy-market-card__hours-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: #fff;
    padding: 0.2rem 0;
    gap: 1rem;
}

.happy-market-card__hours-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Subtiler Link zur Markt-Einzelseite */
.happy-market-card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: currentColor;
    opacity: 0.45;
    text-decoration: none;
    transition: opacity 0.2s;
}

.happy-market-card__link:hover {
    opacity: 1;
    text-decoration: underline;
}

.happy-market-card__link svg {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.happy-market-card__hours-closed {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.5rem;
    color: #fff;
    background-color: rgba(29, 29, 27, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
