/**
 * Custom Overrides CSS
 * Extracted from functions.php for better caching and performance.
 */

/* ==========================================================================
   Brandner Kategorien Grid (Shortcode: [brandner_kategorien])
   ========================================================================== */
.brandner-kategorien-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.brandner-button {
    display: block;
    text-align: center;
    padding: 1rem 1.2rem;
    background-color: #267bbd;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.25s ease, transform 0.15s ease;
}
.brandner-button:hover {
    background-color: #132c41;
    transform: translateY(-2px);
}
@media (max-width: 768px) {
    .brandner-kategorien-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Product Gallery Thumbnail Fix
   ========================================================================== */
.product-image-slider .owl-item .img-thumbnail {
    display: block !important;
    width: 100% !important;
}
.product-image-slider .owl-item .img-thumbnail .inner {
    width: 100% !important;
}
.product-image-slider .owl-item .img-thumbnail img {
    width: 100% !important;
    height: auto !important;
}

/* ==========================================================================
   Mini-Cart (Warenkorb-Icon) Hide
   ========================================================================== */
.elementor-widget-porto_hb_mini_cart {
    display: none !important;
}

/* ==========================================================================
   My Account Button + Registrieren Link Styling
   ========================================================================== */
/* ==========================================================================
   Header Buttons: Gemeinsame Basis (Ghost-Button Stil)
   Anmelden/Mein Konto = Ghost | Registrieren = Solid CTA
   ========================================================================== */

/* My Account / Anmelden Button — Ghost-Button mit feinem Rand */
a.my-account.has-label,
.account-dropdown a.my-account.has-label {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px 0 10px;
    border-radius: 18px;
    background-color: rgba(19, 44, 65, 0.04);
    border: 1px solid rgba(19, 44, 65, 0.15);
    text-decoration: none;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    color: #2c3e50 !important;
    font-size: 14px !important; /* Porto setzt 26px fuer Icon-Font — hier ueberschreiben */
}

a.my-account.has-label:hover,
.account-dropdown a.my-account.has-label:hover {
    background-color: #132c41;
    border-color: #132c41;
    color: #fff !important;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(19, 44, 65, 0.25);
}

/* Icon-Groesse im Button vereinheitlichen */
a.my-account.has-label i {
    font-size: 18px;
    line-height: 1;
}

.my-account-text {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0.01em;
}

/* Registrieren Link — Solid CTA mit Brandfarbe */
.brandner-register-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    gap: 6px;
    height: 36px;
    padding: 0 14px 0 10px;
    border-radius: 18px;
    background-color: #132c41;
    border: 1px solid #132c41;
    margin-left: 6px;
    text-decoration: none !important;
    color: #fff !important;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.brandner-register-link:hover {
    background-color: #1a3d5c;
    border-color: #1a3d5c;
    color: #fff !important;
    text-decoration: none !important;
    box-shadow: 0 2px 10px rgba(19, 44, 65, 0.3);
    transform: translateY(-1px);
}

.brandner-register-link .register-text {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0.01em;
}

.brandner-register-link i {
    font-size: 18px;
    line-height: 1;
}

/* Eingeloggt: Registrieren ausblenden */
.logged-in .brandner-register-link {
    display: none !important;
}

/* Auction Button: Abstand zum naechsten Button */
.brandner-auction-header-btn {
    margin-right: 6px;
}

/* Tablet: Kompaktere Buttons, Icon-only fuer Platzersparnis */
@media (max-width: 991px) {
    a.my-account.has-label,
    .account-dropdown a.my-account.has-label {
        height: 34px;
        padding: 0 10px;
    }
    .brandner-register-link {
        height: 34px;
        padding: 0 10px;
        margin-left: 2px;
    }

    /* Tablet 768-991px: Nur Icon, kein Text */
    .my-account-text,
    .brandner-register-link .register-text {
        display: none;
    }

    /* Runde Icon-Buttons auf Tablet */
    a.my-account.has-label,
    .account-dropdown a.my-account.has-label,
    .brandner-register-link {
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    a.my-account.has-label i,
    .brandner-register-link i {
        margin: 0;
        font-size: 16px;
    }
}

/* Mobile: Account-Icons verstecken, Hamburger zeigen */
@media (max-width: 767px) {
    .my-account-text,
    .brandner-register-link .register-text {
        display: none;
    }

    /* Account-Icons auf Mobile verstecken */
    .brandner-auction-header-btn,
    a.my-account,
    .account-dropdown,
    .brandner-register-link {
        display: none !important;
    }

    /* Porto's eigenen mobile-toggle verstecken (wir haben unseren eigenen) */
    #header .mobile-toggle:not(.brandner-mobile-menu-toggle) {
        display: none !important;
    }

    /* Hamburger-Toggle sichtbar (nur Mobile) */
    .brandner-mobile-menu-toggle {
        display: flex !important;
    }

    /* Hamburger-Wrapper: rechts neben Logo, vor der Suchleiste */
    #header .elementor-container > .brandner-mobile-menu-toggle-wrap {
        order: 5;
        margin-left: auto;
        flex: 0 0 auto;
        position: relative;
        display: inline-flex;
    }

    /* Suchleisten-Spalte auf Mobile sichtbar halten */
    #header .elementor-column:has(.elementor-widget-porto_hb_search_form) {
        display: flex !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        order: 10;
    }

    /* Elementor's elementor-hidden-phone Override fuer Suchleiste */
    #header .elementor-widget-porto_hb_search_form.elementor-hidden-phone {
        display: block !important;
    }

    /* Account-Icon: Spezifitaet erhoehen um .has-label zu ueberschreiben */
    a.my-account.has-label {
        display: none !important;
    }
}

/* === MOBILE HAMBURGER MENU === */

/* Hamburger-Toggle: Desktop verstecken */
.brandner-mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #333;
    flex-shrink: 0;
}

.brandner-mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Account-Links im Mobile Nav Panel */
.brandner-mobile-account-links {
    border-top: 1px solid #eee;
    padding: 8px 0;
    margin-top: 4px;
}

.brandner-mobile-account-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.brandner-mobile-account-links a:hover {
    background: #f5f5f5;
}

.brandner-mobile-account-links a i {
    width: 20px;
    font-size: 18px;
    text-align: center;
}

/* ==========================================================================
   Login-Modal CSS-Fixes
   Fix 1: Passwort-Label ueber dem Feld statt daneben
   Fix 2: Modal scrollbar damit Register-Button erreichbar
   Fix 3: Register-Button volle Breite und sichtbar
   ========================================================================== */
/* Login-Modal Fix */
#login-form-popup .woocommerce-form-login .form-row label {
    display: block !important;
    width: 100% !important;
}
.fancybox-inner #login-form-popup,
.fancybox-inner {
    max-height: 85vh;
    overflow-y: auto !important;
}
#login-form-popup .register-btn {
    margin-top: 0.5rem;
    display: block !important;
    width: 100% !important;
}

/* ==========================================================================
   Mobile: Login/Register + Checkout Optimierung
   ========================================================================== */
@media (max-width: 767px) {
    /* Login/Register Inputs: min-height + 16px fuer iOS Zoom-Prevention */
    .woocommerce-form-login .form-row input[type="text"],
    .woocommerce-form-login .form-row input[type="password"],
    .woocommerce-form-login .form-row input[type="email"],
    .woocommerce-form-register .form-row input[type="text"],
    .woocommerce-form-register .form-row input[type="password"],
    .woocommerce-form-register .form-row input[type="email"] {
        min-height: 48px;
        font-size: 16px !important;
    }
    .woocommerce-form-login button[type="submit"],
    .woocommerce-form-register button[type="submit"] {
        width: 100%;
        min-height: 48px;
    }
    .woocommerce-form-login .woocommerce-form-login__rememberme {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Checkout Inputs */
    .woocommerce-checkout .form-row input,
    .woocommerce-checkout .form-row select,
    .woocommerce-checkout .form-row textarea {
        min-height: 48px;
        font-size: 16px !important;
    }
    .woocommerce-checkout .select2-container .select2-selection--single {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    .woocommerce-checkout #place_order {
        width: 100%;
        min-height: 52px;
        font-size: 18px;
        position: sticky;
        bottom: 0;
        z-index: 100;
    }
    .woocommerce-checkout .wc_payment_methods label {
        min-height: 48px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .woocommerce-checkout .wc_payment_methods input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }
}

/* ==========================================================================
   Header Greeting (personalisierte Begruessung)
   ========================================================================== */

/* MyAccount-Widget: Greeting + Buttons als Column, mittig zueinander */
.logged-in .elementor-widget-porto_hb_myaccount .elementor-widget-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brandner-header-greeting {
    font-size: 15px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    margin-bottom: 3px;
    line-height: 1.4;
}

.brandner-header-greeting strong {
    color: #1a2332;
    font-weight: 600;
}

.brandner-header-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mobile: Header-Greeting ausblenden */
@media (max-width: 767px) {
    .brandner-header-greeting {
        display: none;
    }
}

/* Sticky Header: Greeting ausblenden fuer kompakte Hoehe */
.sticky-header .brandner-header-greeting {
    display: none;
}

/* ==========================================================================
   Homepage Mobile CTA - Sticky Bar
   ========================================================================== */
.brandner-mobile-cta {
    display: none;
}

@media (max-width: 767px) {
    .brandner-mobile-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9990;
        background: #1e3a5f;
        padding: 12px 20px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        justify-content: center;
        align-items: center;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
        transition: transform 0.3s ease;
    }

    .brandner-mobile-cta.hidden {
        transform: translateY(100%);
    }

    .brandner-mobile-cta a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 14px 24px;
        background: #fff;
        color: #1e3a5f;
        border-radius: 24px;
        font-size: 15px;
        font-weight: 700;
        text-decoration: none;
        transition: background 0.2s ease;
    }

    .brandner-mobile-cta a:hover {
        background: #f0f4f8;
        color: #1e3a5f;
        text-decoration: none;
    }

    .brandner-mobile-cta svg {
        width: 18px;
        height: 18px;
    }
}
