
/* =========================================================
   ARZTZUWEISER MOBILE
   Desktop bleibt unverändert
========================================================= */

.mobile-view-switch {
    display: none;
}

@media (max-width: 768px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }


    /* -----------------------------------------------------
       HEADER
    ----------------------------------------------------- */

    .topbar {
        width: 100% !important;
        padding: 12px 14px !important;

        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;

        gap: 10px !important;
    }

    .brand {
        width: 100% !important;
        min-width: 0 !important;
    }

    .brand-icon {
        flex: 0 0 auto;
    }

    /*
     * Auf dem Handy reicht der Produktname.
     * Der lange Untertitel nimmt zu viel Platz ein.
     */
    .brand > div:last-child > span {
        display: none !important;
    }

    .brand > div:last-child > strong {
        font-size: 22px !important;
    }


    .top-actions {
        width: 100% !important;

        display: grid !important;
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;

        gap: 8px !important;
    }

    .top-actions > * {
        min-width: 0 !important;
        width: 100% !important;
    }

    .nav-button,
    .account-trigger {
        min-width: 0 !important;
        min-height: 44px !important;

        padding: 9px 10px !important;

        justify-content: center !important;

        white-space: nowrap;
    }


    /* -----------------------------------------------------
       MAIN
    ----------------------------------------------------- */

    main {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 12px !important;
    }


    /* -----------------------------------------------------
       FILTER
    ----------------------------------------------------- */

    .modern-search-panel {
        width: 100% !important;
        max-width: 100% !important;

        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr) !important;

        gap: 10px !important;

        padding: 12px !important;
    }

    .modern-search-panel > * {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }


    /*
     * Fachrichtung über ganze Breite
     */
    .filter-specialty {
        grid-column: 1 / -1 !important;
    }


    /*
     * Allgemeine Namens-/Adresssuche ebenfalls
     * über die komplette Breite.
     */
    .modern-search-panel > div:has(#generalSearch) {
        grid-column: 1 / -1 !important;
    }

    #generalSearch {
        width: 100% !important;
        min-width: 0 !important;
    }

    .filter-input-shell,
    .filter-select-shell {
        width: 100% !important;
        min-width: 0 !important;
    }

    .filter-input-shell input,
    .filter-select-shell select {
        width: 100% !important;
        min-width: 0 !important;
    }


    /*
     * Suchen volle Breite
     */
    #searchButton {
        grid-column: 1 / -1 !important;

        width: 100% !important;
        min-height: 46px !important;
    }


    /*
     * Reset bleibt klein
     */
    #resetButton {
        width: 48px !important;
        min-width: 48px !important;
    }


    /* -----------------------------------------------------
       HINWEIS
    ----------------------------------------------------- */

    .compact-notice {
        width: 100% !important;

        margin: 12px 0 !important;
        padding: 12px 14px !important;

        font-size: 13px !important;
        line-height: 1.45 !important;
    }


    /* -----------------------------------------------------
       LISTE / KARTE UMSCHALTER
    ----------------------------------------------------- */

    .mobile-view-switch {
        display: grid;

        grid-template-columns:
            1fr 1fr;

        gap: 4px;

        width: 100%;

        margin: 0 0 10px;
        padding: 4px;

        background: #eaf1fa;

        border: 1px solid #d8e3f0;
        border-radius: 12px;
    }

    .mobile-view-button {
        height: 44px;

        border: 0;
        border-radius: 9px;

        background: transparent;
        color: #5f7086;

        font: inherit;
        font-size: 14px;
        font-weight: 750;

        cursor: pointer;
    }

    .mobile-view-button.active {
        background: #ffffff;
        color: #1769e0;

        box-shadow:
            0 2px 8px rgba(30, 70, 120, .10);
    }


    /* -----------------------------------------------------
       CONTENT GRID
    ----------------------------------------------------- */

    .content-grid {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        min-width: 0 !important;
    }


    /*
     * Standard:
     * Arztliste sichtbar, Karte versteckt.
     */
    .content-grid.mobile-show-list
        > :nth-child(2) {

        display: none !important;
    }


    /*
     * Kartenmodus:
     * Liste weg, Kartenbereich sichtbar.
     */
    .content-grid.mobile-show-map
        > .results-column {

        display: none !important;
    }

    .content-grid.mobile-show-map
        > :nth-child(2) {

        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        position: static !important;
    }


    /* -----------------------------------------------------
       ERGEBNISLISTE
    ----------------------------------------------------- */

    .results-column {
        width: 100% !important;
        max-width: 100% !important;

        height: auto !important;
        max-height: none !important;

        min-width: 0 !important;
    }

    #doctorList {
        height: auto !important;
        max-height: none !important;

        overflow: visible !important;
    }

    .results-head {
        padding: 16px !important;
    }

    .doctor-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    /* -----------------------------------------------------
       KARTE
    ----------------------------------------------------- */

    .content-grid.mobile-show-map #map {
        width: 100% !important;

        height: 68dvh !important;
        min-height: 500px !important;

        border-radius: 0 0 14px 14px;
    }


    /* -----------------------------------------------------
       FOOTER
       Nicht mehr über den Arztkarten schweben.
    ----------------------------------------------------- */

    .site-legal-footer {
        position: static !important;

        width: 100% !important;

        margin: 16px 0 0 !important;
        padding: 16px 10px !important;

        text-align: center !important;

        background: transparent !important;
        box-shadow: none !important;
        border: 0 !important;
    }

    .site-legal-footer a {
        display: inline-block;
        margin: 5px 7px !important;
    }
}


/* =========================================================
   MOBILE FILTER – FINAL OVERRIDE
========================================================= */

@media (max-width: 768px) {

    main {
        padding-top: 18px !important;
    }

    .modern-search-panel {
        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            54px !important;

        grid-auto-flow: row !important;
        grid-auto-rows: auto !important;

        gap: 12px !important;

        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 16px !important;

        overflow: visible !important;
    }


    /*
     * Alte Desktop-Positionierungen vollständig entfernen.
     */
    .modern-search-panel > * {
        position: static !important;

        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;

        transform: none !important;

        grid-area: auto !important;

        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
    }


    /* -----------------------------------------------------
       1. ZEILE – PLZ + KASSENARZT
    ----------------------------------------------------- */

    .filter-postal {
        grid-column: 1 / 2 !important;
        order: 10 !important;
    }

    #kassenToggle {
        grid-column: 2 / 4 !important;
        order: 20 !important;
    }


    /* -----------------------------------------------------
       2. ZEILE – FACHRICHTUNG
    ----------------------------------------------------- */

    .filter-specialty {
        grid-column: 1 / -1 !important;
        order: 30 !important;
    }


    /* -----------------------------------------------------
       3. ZEILE – NEU + HEUTE
    ----------------------------------------------------- */

    #newToggle {
        grid-column: 1 / 2 !important;
        order: 40 !important;
    }

    #openTodayToggle {
        grid-column: 2 / 4 !important;
        order: 50 !important;
    }


    /* -----------------------------------------------------
       JETZT GEÖFFNET
    ----------------------------------------------------- */

    #openNowToggle {
        grid-column: 1 / -1 !important;
        order: 60 !important;
    }

    #openNowToggle.is-hidden {
        display: none !important;
    }


    /* -----------------------------------------------------
       FREIE SUCHE
    ----------------------------------------------------- */

    .modern-search-panel > *:has(#generalSearch) {
        grid-column: 1 / -1 !important;
        order: 70 !important;

        width: 100% !important;
    }

    #generalSearch {
        width: 100% !important;
        min-width: 0 !important;
    }


    /* -----------------------------------------------------
       SUCHEN + RESET
    ----------------------------------------------------- */

    #searchButton {
        grid-column: 1 / 3 !important;
        order: 80 !important;

        width: 100% !important;
        height: 52px !important;

        position: static !important;
        transform: none !important;
    }

    #resetButton {
        grid-column: 3 / 4 !important;
        order: 90 !important;

        width: 54px !important;
        height: 52px !important;

        position: static !important;
        transform: none !important;
    }


    /* -----------------------------------------------------
       EINHEITLICHE HÖHEN
    ----------------------------------------------------- */

    .filter-input-shell,
    .filter-select-shell,
    .filter-toggle {
        width: 100% !important;
        min-width: 0 !important;

        min-height: 54px !important;
    }

    .filter-toggle {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .filter-toggle-copy {
        min-width: 0 !important;
    }

    .filter-toggle-copy strong {
        font-size: 13px !important;
        white-space: normal !important;
        line-height: 1.1 !important;
    }

    .filter-toggle-copy small {
        font-size: 9px !important;
    }

    .filter-switch {
        flex: 0 0 auto !important;
    }


    /*
     * Keine Elemente dürfen rechts aus dem Bildschirm laufen.
     */
    .modern-search-panel input,
    .modern-search-panel select,
    .modern-search-panel button {
        max-width: 100% !important;
    }
}
