/*
Theme Name: RM24 Shop UltraClean
Theme URI: https://rm24.ch/produkt/rm24-shop-ultraclean/
Author: RM24 | Roger Roth (rm24.ch)
Author URI: https://rm24.ch
Description: Lean, fast and clean shop theme for WooCommerce. Card-based product grid with list view and attribute filters, category overview pages, a product page with a clear buy box, a responsive menu bar with account and cart, and a footer with up to five widget columns. Works without jQuery in the theme and loads only the styles a page needs. Colours, widths and texts are set in the Customizer. Pairs with the free plugin RM24 UltraClean Blocks for WooCommerce.
Version: 1.1.12
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: rm24-shop-ultraclean
Tags: e-commerce, custom-colors, custom-logo, custom-menu, footer-widgets, full-width-template, grid-layout, one-column, theme-options, threaded-comments, translation-ready, wide-blocks
*/

/* =========================================================================
 * 1. CSS RESET & NORMALIZE
 * ========================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: auto;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #0f2733;
    background-color: #ffffff;
    line-height: 1.5;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================================
 * 2. GRUNDGERÜST & IPAD / IPHONE SAFE-AREAS
 * ========================================================================= */

.rm24-main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
    position: relative;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Header behält seine Grundfarbe (weiss/transparent) */
.rm24-site-header {
    width: 100%;
    background-color: var(--rm24-header-bg, transparent);
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
}

/* Hauptinhaltsbereich */
.rm24-site-main {
    flex: 1 0 auto;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

/* =========================================================================
 * 3. DESKTOP-TOOLBAR (STANDARDFORM)
 * ========================================================================= */

.rm24-toolbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin: 20px 0 30px 0;
    padding: 14px 18px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box;
    width: 100%;
}

.rm24-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
}

.rm24-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.rm24-toolbar-container .rm24-select {
    height: 40px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background-color: #ffffff;
    color: #0f2733;
    font-size: 14px;
    cursor: pointer;
}

.rm24-clear-filters-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background-color: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.rm24-clear-filters-btn:hover {
    background-color: #fecaca;
}

.rm24-view-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rm24-view-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #475569;
    transition: all 0.15s ease;
}

.rm24-view-btn.rm24-active,
.rm24-view-btn:hover {
    background-color: var(--rm24-accent-color, #0090bb);
    color: #ffffff;
    border-color: var(--rm24-accent-color, #0090bb);
}

/* =========================================================================
 * 4. GLOBALE IPHONE- & MOBILE-OPTIMIERUNG (Breakpoints <= 768px)
 * ========================================================================= */

@media (max-width: 768px) {

    /* 4.1 Verhindert den iOS-Auto-Zoom beim Fokussieren */
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* 4.2 Fingertaugliche Klickflächen (Apple Human Interface Guidelines) */
    button,
    .button,
    a.button,
    input[type="submit"],
    .rm24-tm-action .button,
    .rm24-product-card-button .button,
    .single_add_to_cart_button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 18px;
        font-size: 15px;
        touch-action: manipulation;
    }

    /* 4.3 Seitenabstände & Karten */
    .rm24-site-main {
        padding-left: 14px;
        padding-right: 14px;
    }

    .rm24-block-card {
        padding: 16px !important;
        margin-bottom: 20px !important;
    }

    /* 4.4 Typografie-Skalierung */
    h1, .rm24-block-heading.tag-h1 {
        font-size: 26px !important;
        line-height: 1.25 !important;
    }

    h2, .rm24-block-heading.tag-h2 {
        font-size: 22px !important;
        line-height: 1.3 !important;
    }

    h3, .rm24-block-heading.tag-h3 {
        font-size: 19px !important;
        line-height: 1.35 !important;
    }

    /* 4.5 Toolbar mobil untereinander anordnen */
    .rm24-toolbar-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 14px !important;
        margin: 15px 0 25px 0 !important;
        border-radius: 0 !important;
    }

    .rm24-toolbar-filters {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .rm24-toolbar-filters .rm24-select {
        width: 100% !important;
        height: 44px !important;
    }

    .rm24-clear-filters-btn {
        width: 100% !important;
        justify-content: center !important;
        height: 44px !important;
        box-sizing: border-box !important;
    }

    .rm24-toolbar-actions {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding-top: 10px !important;
        border-top: 1px solid #e2e8f0 !important;
    }

    .rm24-toolbar-actions .rm24-limit-form {
        flex: 1 1 auto !important;
    }

    .rm24-toolbar-actions .rm24-limit-form .rm24-select {
        width: 100% !important;
        height: 44px !important;
    }

    .rm24-view-switcher {
        flex-shrink: 0 !important;
        margin-left: 10px !important;
    }

    .rm24-view-btn {
        width: 44px !important;
        height: 44px !important;
    }

    /* 4.6 Horizontales Überlaufen unterbinden */
    body,
    .rm24-main-wrapper,
    .rm24-site-main {
        max-width: 100vw;
        overflow-x: clip; /* clip statt hidden: die Menüleiste bleibt sticky */
    }
}

/* =========================================================================
 * 5. SMARTPHONES HOCHFORMAT (<= 480px)
 * ========================================================================= */

@media (max-width: 480px) {
    .rm24-site-main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .rm24-block-card {
        padding: 12px !important;
        margin-bottom: 16px !important;
    }

    .rm24-block-table-card {
        padding: 10px !important;
        -webkit-overflow-scrolling: touch;
    }

    .rm24-table th,
    .rm24-table td {
        padding: 10px 8px !important;
        font-size: 13px !important;
    }

    /* Produkt-Raster auf schmalen Geräten 1-spaltig */
    ul.products,
    .woocommerce ul.products,
    .rm24-products-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 16px !important;
    }

    ul.products li.product,
    .woocommerce ul.products li.product,
    .rm24-products-grid .product {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin: 0 0 16px 0 !important;
        box-sizing: border-box !important;
    }

    .rm24-block-columns-grid {
        grid-template-columns: 1fr !important;
    }
}