/* TM24 mobile UI contract
 * Loaded last by Kaufen, Verkaufen and B2B.
 * Keeps the three entry points visually aligned without changing workflows.
 */

@media (max-width: 767.98px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    /* The safe area belongs to the browser chrome, not to this in-page bar. */
    .shop-topbar,
    .tm24-topbar,
    .ankauf-topbar,
    .b2b-topbar {
        box-sizing: border-box !important;
        position: relative !important;
        inset: auto !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        min-height: 58px !important;
        padding: 7px 10px !important;
        overflow: visible !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .shop-topbar > .container,
    .tm24-topbar > .container,
    .ankauf-topbar > .container,
    .b2b-topbar > .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .shop-topbar-inner,
    .tm24-topbar-inner,
    .ankauf-topbar-inner,
    .b2b-topbar-inner {
        box-sizing: border-box !important;
        position: static !important;
        inset: auto !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px 10px !important;
        overflow: visible !important;
        font-size: 10.5px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        letter-spacing: 0 !important;
    }

    .shop-topbar-inner > span,
    .tm24-topbar-inner > span,
    .ankauf-topbar-inner > span,
    .b2b-topbar-inner > span {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        margin: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        font-size: inherit !important;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.25 !important;
    }

    .shop-header,
    .ankauf-header,
    .b2b-header,
    #tm24-home-header {
        width: 100% !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .shop-header .tm24-header-grid,
    .ankauf-header .tm24-header-grid,
    .b2b-header .tm24-header-grid,
    #tm24-home-header .tm24-header-grid {
        position: relative !important;
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 10px 14px 8px !important;
    }

    .tm24-header-grid > .tm24-header-left {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0 !important;
    }

    .tm24-header-left > .shop-logo,
    .tm24-header-left > .ankauf-logo,
    .tm24-header-left > .b2b-logo,
    .tm24-header-left > a[class*="logo"] {
        order: 1 !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        line-height: 0 !important;
    }

    .shop-logo img,
    .ankauf-logo img,
    .b2b-logo img,
    .tm24-header-left img[src*="logo"] {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 128px !important;
        max-height: 36px !important;
        object-fit: contain !important;
    }

    .tm24-header-left .tm24-pill-nav,
    .tm24-header-left .shop-pills,
    .tm24-header-left .ankauf-pills,
    .tm24-header-left .b2b-pills,
    .tm24-header-left nav[class*="pill"] {
        order: 10 !important;
        flex: 1 1 100% !important;
        min-width: 100% !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        margin: 9px 0 0 !important;
        padding: 3px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .tm24-header-left .tm24-pill-nav::-webkit-scrollbar,
    .tm24-header-left nav[class*="pill"]::-webkit-scrollbar {
        display: none;
    }

    .tm24-pill-nav .tm24-pill,
    .shop-pills .shop-pill,
    .ankauf-pills .ankauf-pill,
    .b2b-pills .b2b-pill {
        flex: 0 0 auto !important;
        min-height: 40px !important;
        padding: 7px 11px !important;
        font-size: 12px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .tm24-header-grid > .tm24-header-right {
        position: absolute !important;
        z-index: 3 !important;
        top: 9px !important;
        right: 12px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .tm24-header-grid > .tm24-header-center {
        order: 99 !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        padding: 8px 0 2px !important;
    }

    .tm24-header-center .shop-search,
    .tm24-header-center .header-suche-wrapper,
    .tm24-header-center .ankauf-search,
    .tm24-header-center .suche-box {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .tm24-header-center input[type="text"],
    .tm24-header-center input[type="search"],
    .tm24-header-center .shop-search-input,
    .tm24-header-center .suche-input {
        box-sizing: border-box !important;
        width: 100% !important;
        min-height: 46px !important;
        font-size: 16px !important;
        color: #10213f !important;
        background: #fff !important;
        border: 2px solid #bcc8d8 !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(15, 35, 70, 0.08) !important;
        padding-right: 14px !important;
    }

    .tm24-header-center input[type="text"]:focus,
    .tm24-header-center input[type="search"]:focus,
    .tm24-header-center .shop-search-input:focus,
    .tm24-header-center .suche-input:focus {
        border-color: #2e35cc !important;
        box-shadow: 0 0 0 3px rgba(46, 53, 204, 0.14) !important;
        outline: none !important;
    }

    .shop-burger-btn,
    .ankauf-burger-btn,
    .b2b-burger-btn,
    .tm24-header-right button,
    .tm24-header-right a {
        min-width: 42px !important;
        min-height: 42px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Mobile account, registration and checkout forms. */
    #account .row.login-form,
    #account .row.register-form,
    .b2b-form-grid,
    .checkout-form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #account .card,
    #account .panel,
    .b2b-form-card,
    .checkout-card {
        max-width: 100% !important;
        border-radius: 16px !important;
    }

    /* B2B hero and form: no desktop line breaks or clipped text. */
    .b2b-hero {
        padding: 48px 16px 42px !important;
    }

    .b2b-hero h1 {
        max-width: 100% !important;
        font-size: clamp(32px, 10vw, 46px) !important;
        line-height: 1.05 !important;
        overflow-wrap: anywhere !important;
    }

    .b2b-hero h1 br {
        display: none !important;
    }

    .b2b-hero__sub {
        font-size: 16px !important;
        line-height: 1.55 !important;
    }

    .b2b-hero__cta,
    .b2b-submit,
    .btn-checkout-next,
    .btn-checkout-final {
        min-height: 48px !important;
        width: 100% !important;
        justify-content: center !important;
    }
}

@media (max-width: 374px) {
    .shop-topbar-inner,
    .tm24-topbar-inner,
    .ankauf-topbar-inner,
    .b2b-topbar-inner {
        gap: 4px 8px !important;
        font-size: 9.5px !important;
    }

    .shop-logo img,
    .ankauf-logo img,
    .b2b-logo img,
    .tm24-header-left img[src*="logo"] {
        max-width: 112px !important;
        max-height: 32px !important;
    }

    .tm24-pill-nav .tm24-pill,
    .shop-pills .shop-pill,
    .ankauf-pills .ankauf-pill,
    .b2b-pills .b2b-pill {
        padding-inline: 9px !important;
        font-size: 11px !important;
    }
}
