/**
 * Travbilder – Stylesheet
 * Täcker: produktkort, filter, trust bar, klarna header,
 *         featured products, sökform, fotogalleri, accordion-tabbar,
 *         loop reassurance, sticky header, paginering.
 */

/* =========================================================
   VARIABLER
   ========================================================= */
:root {
    --tb-primary:     #2d9ffe;
    --tb-primary-dk:  #1a8dde;
    --tb-text:        #333;
    --tb-text-light:  #666;
    --tb-border:      #e8e8e8;
    --tb-bg:          #fff;
    --tb-bg-soft:     #f7f8fa;
    --tb-radius:      8px;
    --tb-shadow:      0 2px 12px rgba(0,0,0,.08);
    --tb-shadow-hover:0 6px 20px rgba(0,0,0,.14);
    --tb-transition:  .2s ease;
}

/* =========================================================
   PRODUKTKORT (delat mellan filter, sök, featured)
   ========================================================= */
.tb-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.tb-product-card {
    background: var(--tb-bg);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    padding: 16px;
    text-align: center;
    transition: box-shadow var(--tb-transition), transform var(--tb-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tb-product-card:hover {
    box-shadow: var(--tb-shadow-hover);
    transform: translateY(-2px);
}

.tb-product-image-link {
    display: block;
    text-decoration: none;
    color: var(--tb-text);
}
.tb-product-card img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 0 auto 10px;
}
.tb-product-card h3 {
    font-size: 15px;
    margin: 0;
    line-height: 1.35;
}
.tb-price {
    font-weight: 700;
    color: var(--tb-text);
    font-size: 16px;
}
.tb-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--tb-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    pointer-events: none;
}
.tb-btn {
    display: inline-block;
    padding: 9px 18px;
    background: var(--tb-primary);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--tb-transition);
    margin-top: auto;
}
.tb-btn:hover { background: var(--tb-primary-dk); color: #fff; }

/* =========================================================
   FILTER
   ========================================================= */
.tb-product-filters { margin-bottom: 24px; }

.tb-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.tb-filter-row select,
.tb-filter-row input[type="number"] {
    padding: 9px 12px;
    border: 1px solid var(--tb-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--tb-bg);
    color: var(--tb-text);
    min-width: 160px;
}
.tb-filter-btn {
    padding: 9px 20px;
    background: var(--tb-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--tb-transition);
}
.tb-filter-btn:hover { background: var(--tb-primary-dk); }

.tb-section-title {
    font-size: 22px;
    margin: 32px 0 12px;
}

.tb-loading,
.tb-no-results,
.tb-error {
    padding: 32px;
    text-align: center;
    color: var(--tb-text-light);
    font-size: 15px;
}

/* =========================================================
   TRUST BAR
   ========================================================= */
.tb-trust-bar {
    overflow: hidden;
    background: var(--tb-bg-soft);
    border-top: 1px solid var(--tb-border);
    border-bottom: 1px solid var(--tb-border);
    padding: 12px 0;
}
.tb-trust-track {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px 40px;
    padding: 0 24px;
}
.tb-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tb-text);
    white-space: nowrap;
}
.tb-trust-item i {
    color: var(--tb-primary);
    font-size: 16px;
}

/* =========================================================
   KLARNA HEADER
   ========================================================= */
.tb-klarna-header {
    background: #ffb3c7;
    padding: 10px 16px;
    text-align: center;
}
.tb-klarna-inner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.tb-klarna-logo {
    height: 22px;
    width: auto;
}
.tb-klarna-text {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

/* =========================================================
   FEATURED PRODUCTS
   ========================================================= */
.tb-featured-products { margin: 48px 0; }

.tb-section-header { text-align: center; margin-bottom: 32px; }
.tb-section-header h2 { font-size: 28px; margin: 0 0 8px; }
.tb-subtitle { color: var(--tb-text-light); font-size: 15px; margin: 0; }

.tb-reassurance {
    text-align: center;
    margin-top: 32px;
    color: var(--tb-text-light);
    font-size: 13px;
}

/* =========================================================
   SÖKFORM
   ========================================================= */
.tb-homesearch { margin: 24px 0; }
.tb-search-inner {
    display: flex;
    gap: 0;
    max-width: 640px;
    margin: 0 auto;
    border: 2px solid var(--tb-primary);
    border-radius: 40px;
    overflow: hidden;
    background: #fff;
}
.tb-search-input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    font-size: 15px;
    outline: none;
    background: transparent;
}
.tb-search-btn {
    padding: 12px 24px;
    background: var(--tb-primary);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--tb-transition);
}
.tb-search-btn:hover { background: var(--tb-primary-dk); }

/* =========================================================
   FOTOGALLERI (vendor_photo_grid)
   ========================================================= */
.tb-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.tb-photo-card {
    background: var(--tb-bg);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    overflow: hidden;
    transition: box-shadow var(--tb-transition);
}
.tb-photo-card:hover { box-shadow: var(--tb-shadow-hover); }
.tb-photo-card a { text-decoration: none; color: inherit; display: block; }
.tb-photo-thumb img { width: 100%; height: 200px; object-fit: cover; display: block; }
.tb-photo-info { padding: 14px; }
.tb-photo-title { font-size: 14px; margin: 0 0 8px; line-height: 1.3; }
.tb-photo-meta { font-size: 13px; color: var(--tb-text-light); display: flex; flex-direction: column; gap: 3px; }
.tb-photo-meta strong { color: var(--tb-text); }

/* =========================================================
   ACCORDION TABS (WooCommerce)
   ========================================================= */
.woocommerce-accordion-tabs { margin: 32px 0; }

.wc-accordion-item {
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    margin-bottom: 8px;
    overflow: hidden;
}
.wc-accordion-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    list-style: none;
    user-select: none;
    background: var(--tb-bg-soft);
    transition: background var(--tb-transition);
}
.wc-accordion-title::-webkit-details-marker { display: none; }
.wc-accordion-item[open] > .wc-accordion-title { background: var(--tb-primary); color: #fff; }

.wc-accordion-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 15l-7-7h14z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 15l-7-7h14z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    flex-shrink: 0;
    transition: transform var(--tb-transition);
}
.wc-accordion-item[open] > .wc-accordion-title .wc-accordion-icon {
    transform: rotate(180deg);
    background: #fff;
}
.wc-accordion-content {
    padding: 18px;
    background: var(--tb-bg);
    font-size: 15px;
    line-height: 1.6;
}

/* =========================================================
   LOOP REASSURANCE
   ========================================================= */
.tb-loop-reassurance {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.tb-free-shipping {
    font-size: 12px;
    font-weight: 600;
    color: #2d8a00;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tb-free-shipping::before { content: '✓ '; }
.tb-print-on-demand {
    font-size: 11px;
    color: var(--tb-text-light);
}

/* =========================================================
   PAGINERING
   ========================================================= */
.tb-pagination {
    margin: 32px 0;
    text-align: center;
}
.tb-pagination .page-numbers {
    display: inline-block;
    padding: 7px 13px;
    border: 1px solid var(--tb-border);
    border-radius: 6px;
    margin: 2px;
    text-decoration: none;
    color: var(--tb-text);
    font-size: 14px;
    transition: background var(--tb-transition);
}
.tb-pagination .page-numbers.current,
.tb-pagination .page-numbers:hover {
    background: var(--tb-primary);
    border-color: var(--tb-primary);
    color: #fff;
}

/* =========================================================
   DOKAN UPPLADDNING – checkbox
   ========================================================= */
.tb-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1.4;
}
.tb-checkbox-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }

/* =========================================================
   STICKY HEADER (Astra)
   ========================================================= */
.ast-main-header-wrap.is-sticky,
#ast-mobile-sticky-wrapper.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    animation: tbSlideDown .25s ease;
}
@keyframes tbSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
body.has-sticky-header {
    padding-top: var(--ast-header-height, 80px);
}
body.has-mobile-sticky-header {
    padding-top: var(--mobile-header-height, 60px);
}

/* =========================================================
   RESPONSIV
   ========================================================= */
@media (max-width: 768px) {
    .tb-filter-row { flex-direction: column; }
    .tb-filter-row select,
    .tb-filter-row input[type="number"],
    .tb-filter-btn { width: 100%; }

    .tb-products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
    .tb-photo-grid    { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .tb-photo-thumb img { height: 150px; }

    .tb-search-inner { border-radius: 8px; flex-direction: column; }
    .tb-search-input { width: 100%; }
    .tb-search-btn   { justify-content: center; border-radius: 0; }
}


/* ==========================================================================
   STALLMERCH – Overview & Single
   ========================================================================== */

/* Översikt: grid med stallkort */
.tb-stall-overview {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
    gap: 28px;
    margin: 32px 0;
}

.tb-stall-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    text-decoration: none;
    color: inherit;
    transition: transform .2s ease, box-shadow .2s ease;
}

.tb-stall-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.13);
    text-decoration: none;
    color: inherit;
}

.tb-stall-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tb-stall-card-image .tb-stall-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.tb-stall-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ccc;
}

.tb-stall-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.tb-stall-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.tb-stall-excerpt {
    font-size: .9rem;
    color: #555;
    margin: 0;
    flex: 1;
}

.tb-stall-count {
    font-size: .8rem;
    color: #888;
}

.tb-stall-cta {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
    color: var(--e-global-color-accent, #333);
    font-size: .9rem;
}

/* Single stall: hero-sektion */
.tb-stall-header {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 48px;
}

@media ( max-width: 768px ) {
    .tb-stall-header {
        grid-template-columns: 1fr;
    }
}

.tb-stall-hero-image img {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.tb-stall-title {
    font-size: 2rem;
    margin-bottom: 16px;
}

.tb-stall-description {
    font-size: 1rem;
    color: #444;
    line-height: 1.7;
}

/* Produktgrid under stallsidan */
.tb-stall-products {
    margin-top: 40px;
}

/* ==========================================================================
   Responsive tweaks för stallöversikt
   ========================================================================== */

@media ( max-width: 600px ) {
    .tb-stall-overview {
        grid-template-columns: 1fr;
    }
}