/*
Theme Name: Design
Template: astra
Version: 1.0
*/
/* =====================================================
   ADD TO CART ALIGNMENT
===================================================== */

.single-product .elementor-add-to-cart {
    align-items: flex-start;
}

/* =====================================================
   STOCK BADGE
===================================================== */

.stock-badge.in-stock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: fit-content;
    margin: 8px auto;
    padding: 5px 8px;
    font: 600 10px/1.2 Poppins, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 5px;
    background: #e6f6ec;
    color: #1e7f43;
    border: 1px solid #bfe5cd;
    min-height: 24px;
}

.stock-badge.in-stock svg {
    width: 12px;
    height: 12px;
}

.stock-badge.in-stock svg path {
    stroke: #1e7f43;
    stroke-width: 3;
    fill: none;
}

/* Single product - left align */
.single-product .stock-badge.in-stock {
    justify-content: flex-start;
    margin: 8px 0 6px 0;
    align-self: flex-start;
}

/* =====================================================
   PRIS
===================================================== */

.woocommerce div.product p.price,
.woocommerce div.product span.price,
.woocommerce ul.products li.product .price {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 10px 0;
}

.woocommerce ul.products li.product .price {
    font-size: 20px;
}

.price ins {
    color: #e60023;
    text-decoration: none;
    margin-left: 6px;
}

.price del {
    opacity: 0.55;
    font-size: 16px;
}

/* =====================================================
   KNAPPAR
===================================================== */

button.single_add_to_cart_button.button,
.woocommerce button.button.alt {
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 8px;
    line-height: 1.2;
    white-space: nowrap;
}

.cart,
.woocommerce-variation-add-to-cart {
    margin-top: 12px;
}

/* =====================================================
   REVIEWS
===================================================== */

.star-rating { 
    color: #ffb400; 
}

.woocommerce ul.products li.product .star-rating {
    margin: 6px auto;
    font-size: 13px;
}

.single-product .star-rating {
    font-size: 16px;
    margin-bottom: 6px;
}

.woocommerce-review-link {
    font-size: 13px;
    opacity: 0.8;
    margin-left: 6px;
}

/* =====================================================
   DIVERSE
===================================================== */

.astra-shop-summary-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

li.variable-item.image-variable-item {
    width: 90px;
    height: 90px;
    border-color: #1e6fd9;
}

.woocommerce-js select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.productListing span.ast-woo-product-category {
    display: none !important;
}

input[type="search"] { 
    width: 100%; 
}

.site-footer,
body {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* =====================================================
   KATEGORIER - GRID
===================================================== */

.custom-category-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: visible;   /* FIX */
    box-sizing: border-box;
    padding-top: 20px;   /* luft så ramen syns */
}

.custom-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.category-box {
    padding: 40px 30px;
    text-align: center;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    transition: 0.3s;
}

.category-box:hover {
    transform: translateY(-5px);
    border-color: #0073aa;
}

/* =====================================================
   PRODUKTER - GRID/SLIDER
===================================================== */

/* Search & Category pages - Grid */
.search ul.products,
.tax-product_cat ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Homepage - Slider */
body:not(.search):not(.tax-product_cat) ul.products {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

body:not(.search):not(.tax-product_cat) ul.products::-webkit-scrollbar {
    display: none;
}

body:not(.search):not(.tax-product_cat) ul.products li.product {
    flex: 0 0 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* =====================================================
   PRODUKTKORT
===================================================== */

.woocommerce ul.products li.product img {
    max-height: 180px;
    object-fit: contain;
    margin-bottom: 10px;
}

.woocommerce-loop-product__title {
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
    line-height: 1.3;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.woocommerce ul.products li.product .button {
    margin-top: auto;
}

/* Extra säkerhet för långa ord */
.woocommerce-loop-product__title,
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* =====================================================
   SCROLL ARROWS
===================================================== */

.scroll-wrapper {
    position: relative;
    margin: 0 40px;
}

.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.96);
    border: 2px solid #ddd;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18);
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.scroll-arrow:hover {
    background: rgba(255,255,255,1);
    border-color: #999;
    transform: translateY(-50%) scale(1.1);
}

.scroll-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.scroll-arrow.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.scroll-arrow.scroll-left {
    left: -50px;
}

.scroll-arrow.scroll-right {
    right: -50px;
}

/* =====================================================
   PRODUKTER PER SIDA
===================================================== */

.products-per-page-form {
    margin: 0;
}

.products-per-page-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
}

.products-per-page-wrapper label {
    font-size: 14px;
    font-weight: 400;
    color: #333;
    margin: 0;
}

.products-per-page-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.products-per-page-select:hover {
    border-color: #999;
}

.products-per-page-select:focus {
    outline: none;
    border-color: #0073aa;
}

.woocommerce-result-count {
    display: inline-block;
    margin-right: 20px;
}

/* =====================================================
   MOBIL
===================================================== */

@media (max-width: 768px) {
    
    /* Priser */
    .woocommerce div.product p.price,
    .woocommerce ul.products li.product .price {
        font-size: 22px;
    }
    
    .woocommerce ul.products li.product .price {
        font-size: 16px !important;
        margin: 6px 0 !important;
    }
    
    /* Knappar */
    button.single_add_to_cart_button.button {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .woocommerce ul.products li.product .button {
        font-size: 11px !important;
        padding: 8px 10px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Stock badge */
    .stock-badge.in-stock {
        font-size: 9px !important;
        padding: 3px 6px !important;
        margin: 4px auto !important;
        min-height: 20px;
    }
    
    /* VIKTIGT: Single product - behåll vänster alignment */
    .single-product .stock-badge.in-stock {
        justify-content: flex-start !important;
        margin: 6px 0 !important;
    }
    
    .stock-badge.in-stock svg {
        width: 10px !important;
        height: 10px !important;
    }
    
    /* Reviews */
    .woocommerce ul.products li.product .star-rating {
        font-size: 11px !important;
        margin: 4px auto !important;
    }
    
    /* Produktslider */
    body:not(.search):not(.tax-product_cat) ul.products {
        scroll-behavior: auto;
        gap: 8px;
    }
    
    body:not(.search):not(.tax-product_cat) ul.products li.product {
        flex: 0 0 140px;
        max-width: 140px;
    }
    
    /* Produktkort */
    .woocommerce ul.products li.product {
        padding: 8px !important;
    }
    
    .woocommerce ul.products li.product img {
        max-height: 120px !important;
        margin-bottom: 8px !important;
    }
    
    /* Produkttitel */
    .woocommerce-loop-product__title {
        font-size: 12px !important;
        line-height: 1.4 !important;
        min-height: 34px;
        max-height: 34px;
        margin-bottom: 8px !important;
        padding: 0 4px;
        word-break: break-word;
    }
    
    /* Kategorier */
    .custom-category-wrapper {
        padding: 0 5px;
    }
    
    .custom-category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .category-box {
        padding: 25px 15px !important;
        min-height: 100px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .category-box h3.category-title {
        font-size: 13px !important;
        margin: 0 0 8px 0 !important;
        line-height: 1.3;
        text-align: center;
    }
    
    .category-box p.category-count {
        font-size: 11px !important;
        margin: 0 !important;
        opacity: 0.8;
    }
    
    /* WooCommerce fallback kategorier */
    ul.products.woocommerce-subcategories {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    ul.products.woocommerce-subcategories li {
        width: 100% !important;
        margin: 0 !important;
    }
    
    /* Scroll arrows */
    .scroll-wrapper {
        margin: 0 30px;
    }
    
    .scroll-arrow {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .scroll-arrow.scroll-left {
        left: -40px;
    }
    
    .scroll-arrow.scroll-right {
        right: -40px;
    }
    
    /* Produkter per sida */
    .products-per-page-wrapper {
        display: flex;
        width: 100%;
        margin: 10px 0;
        justify-content: space-between;
    }
    
    .products-per-page-wrapper label {
        font-size: 13px;
    }
    
    .products-per-page-select {
        font-size: 13px;
        min-width: 130px;
        flex: 1;
        max-width: 200px;
    }
    
    .woocommerce-result-count {
        display: block;
        width: 100%;
        margin: 0 0 10px 0;
    }
}

/* =====================================================
   EXTRA SMALL SCREENS
===================================================== */

@media (max-width: 480px) {
    .scroll-wrapper {
        margin: 0 25px;
    }
    
    .scroll-arrow {
        width: 32px;
        height: 32px;
        font-size: 18px;
        border-width: 1px;
    }
    
    .scroll-arrow.scroll-left {
        left: -35px;
    }
    
    .scroll-arrow.scroll-right {
        right: -35px;
    }
}
/* =====================================
   TELEFY CATEGORY STRUCTURE - CSS
   ===================================== */
.telefy-cat-top {
    font-size: 18px;
    line-height: 1.7;
    margin-bottom: 25px;
    max-width: 900px;
}
.telefy-top-preview,
.telefy-top-full {
    margin-bottom: 0;
}
.telefy-top-toggle {
    margin-top: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-weight: 400;
    padding: 8px 0;
    font-size: 14px;
    text-decoration: underline;
    transition: color 0.2s ease;
}
.telefy-top-toggle:hover {
    color: #333;
}
.telefy-top-toggle:focus {
    outline: none;
}
.telefy-cat-bottom {
    margin-top: 50px;
    padding: 40px;
    background: #f8f9fb;
    border-radius: 12px;
}
.telefy-bottom-preview {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: #333;
}
.telefy-bottom-preview p {
    margin-bottom: 0;
}
.telefy-toggle {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-weight: 400;
    padding: 8px 0;
    font-size: 14px;
    text-decoration: underline;
    transition: color 0.2s ease;
}
.telefy-toggle:hover {
    color: #333;
}
.telefy-toggle:focus {
    outline: none;
}
.telefy-seo-content {
    margin-top: 20px;
}
.telefy-seo-text {
    line-height: 1.7;
}
.telefy-seo-text p {
    margin-bottom: 14px;
}
.telefy-seo-text h2,
.telefy-seo-text h3 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}
.telefy-link-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}
.telefy-link-item {
    flex: 0 0 auto;
}
.telefy-link-item a {
    background: #e9edf5;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: 0.2s ease;
    color: #333;
}
.telefy-link-item a:hover {
    background: #1F6FFF;
    color: #fff;
}
/* MAX 6 LINKS */
.telefy-link-item:nth-child(n+7) {
    display: none;
}
/* Responsive */
@media (max-width: 768px) {
    .telefy-cat-bottom {
        padding: 20px;
    }
    
    .telefy-cat-top {
        font-size: 16px;
    }
}

/* =====================================
   LOGO + HEADER MOBIL FIX
===================================== */
add_action('wp_head', function() {
    ?>
    <style>
    /* Desktop */
    .custom-logo-link img,
    .ast-site-identity img {
        width: 200px !important;
        height: auto !important;
    }

    /* Mobil */
    @media (max-width: 768px) {
        /* Större logo */
        .custom-logo-link img,
        .ast-site-identity img {
            width: 180px !important;
            height: auto !important;
        }

        /* Ta bort onödigt mellanrum */
        .ast-site-identity {
            margin: 0 !important;
            padding: 0 !important;
        }

        /* Stretcha loggan att fylla tillgängligt utrymme */
        .ast-mobile-header-wrap .site-branding,
        .ast-header-break-point .site-branding {
            flex: 1 !important;
            display: flex !important;
            align-items: center !important;
        }

        /* Komprimera header-höjd på mobil */
        .ast-header-break-point .main-header-bar {
            padding: 8px 16px !important;
        }

        /* Minska gap mellan logo och ikoner */
        .ast-header-break-point .ast-mobile-header-wrap {
            gap: 0 !important;
            justify-content: space-between !important;
        }
    }
    </style>
    <?php
}, 999);