/**
 * TPMF Carousel Frontend Styles
 */

/* ==========================================================================
   CSS VARIABLES DEFINITIONS & DEFAULTS
   ========================================================================== */
.tpmf-carousel-wrapper,
.tpmf-gallery-wrapper {
    /* Container & Card Defaults */
    --tpmf-card-bg: #ffffff;
    --tpmf-content-align: left;

    /* Title Defaults */
    --tpmf-title-color: #222222;
    --tpmf-title-hover-color: #0073aa;
    --tpmf-title-size: 18px;
    --tpmf-title-lh: 1.4;
    --tpmf-title-weight: 600;

    /* Body/Excerpt Defaults */
    --tpmf-content-color: #555555;
    --tpmf-content-size: 14px;
    --tpmf-content-lh: 1.6;

    /* Meta Defaults */
    --tpmf-meta-color: #888888;
    --tpmf-meta-size: 12px;

    /* Button Defaults */
    --tpmf-btn-color: #ffffff;
    --tpmf-btn-bg: #0073aa;
    --tpmf-btn-hover-bg: #005177;
    --tpmf-btn-size: 13px;

    /* Controls Defaults */
    --tpmf-nav-color: #333333;
    --tpmf-nav-bg: #ffffff;
    --tpmf-dots-color: #cccccc;
    --tpmf-dots-active-color: #0073aa;
}

/* Main Container Wrapper */
.tpmf-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
}

.tpmf-carousel-wrapper *,
.tpmf-carousel-wrapper *::before,
.tpmf-carousel-wrapper *::after {
    box-sizing: border-box;
}

.tpmf-swiper-container {
    width: 100%;
    position: relative;
    padding-bottom: 40px; /* Room for pagination dots */
}

/* Individual Slide Container */
.tpmf-slide {
    height: auto; /* Match height of tallest slide */
}

.tpmf-slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    background-color: #000000;
}

/* --------------------------------------------------
 * IMAGE CAROUSEL STYLES & OVERLAYS
 * -------------------------------------------------- */
.tpmf-carousel-images .tpmf-slide-inner img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tpmf-carousel-images .tpmf-slide-inner:hover img {
    transform: scale(1.03);
}

/* Slide Text Overlay */
.tpmf-slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, rgba(0, 0, 0, 0) 100%);
    color: #ffffff;
    z-index: 2;
    pointer-events: none;
}

.tpmf-slide-title {
    margin: 0 0 5px 0;
}
.tpmf-slide-title a {
    color: inherit;
    text-decoration: none;
}
.tpmf-slide-caption {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #dddddd;
}

/* ==========================================================================
   POST & PRODUCT TITLE / LINK OVERRIDES (Theme.json Fix)
   ========================================================================== */

/* Standard Light Card Titles & Links */
.tpmf-item-caption .tpmf-slide-title,
.tpmf-item-caption .tpmf-slide-title a {
    color: #2c3338 !important; /* Force explicit color over currentColor */
    text-decoration: none;
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.tpmf-item-caption .tpmf-slide-title a:hover {
    color: #0073aa !important;
}

/* Post Meta Links & Terms */
.tpmf-item-caption .tpmf-post-terms a,
.tpmf-item-caption .tpmf-post-meta a {
    color: #646970 !important;
    text-decoration: none;
}

/* Dark Overlay Layout Titles & Links */
.tpmf-item-design-overlay .tpmf-slide-title,
.tpmf-item-design-overlay .tpmf-slide-title a,
.tpmf-slide-overlay .tpmf-slide-title,
.tpmf-slide-overlay .tpmf-slide-title a {
    color: #ffffff !important;
}

.tpmf-item-design-overlay .tpmf-slide-title a:hover,
.tpmf-slide-overlay .tpmf-slide-title a:hover {
    color: #f0f0f0 !important;
}

.tpmf-slide-title,
.tpmf-item-caption .tpmf-slide-title {
    margin: 0 0 4px 0;
    font-size: var(--tpmf-title-size, 18px) !important;
    font-weight: var(--tpmf-title-weight, 600) !important;
    line-height: var(--tpmf-title-lh, 1.4) !important;
    color: var(--tpmf-title-color, #222222) !important;
    text-align: var(--tpmf-content-align, left);
}

.tpmf-slide-title a,
.tpmf-item-caption .tpmf-slide-title a {
    color: var(--tpmf-title-color, #222222) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.tpmf-slide-title a:hover,
.tpmf-item-caption .tpmf-slide-title a:hover {
    color: var(--tpmf-title-hover-color, #0073aa) !important;
}

.tpmf-slide-description,
.tpmf-item-caption .tpmf-slide-description,
.tpmf-slide-caption {
    margin: 0;
    font-size: var(--tpmf-content-size, 14px) !important;
    line-height: var(--tpmf-content-lh, 1.6) !important;
    color: var(--tpmf-content-color, #555555) !important;
    text-align: var(--tpmf-content-align, left);
}
/* Meta & Terms Links */
.tpmf-item-caption .tpmf-post-terms a,
.tpmf-item-caption .tpmf-post-meta a {
    color: var(--tpmf-meta-color, #888888) !important;
    font-size: var(--tpmf-meta-size, 12px) !important;
    text-decoration: none;
}

/* Overlay Layout Custom Override */
.tpmf-item-design-overlay .tpmf-slide-title,
.tpmf-item-design-overlay .tpmf-slide-title a {
    color: var(--tpmf-title-color, #ffffff) !important;
}

/* --------------------------------------------------
 * VIDEO CAROUSEL STYLES (16:9 ASPECT RATIO)
 * -------------------------------------------------- */
.tpmf-video-embed-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000000;
}

.tpmf-video-embed-wrapper iframe,
.tpmf-video-embed-wrapper embed,
.tpmf-video-embed-wrapper object,
.tpmf-video-embed-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Video Meta Info (Below Video) */
.tpmf-carousel-video .tpmf-slide-meta {
    padding: 12px 15px;
    background-color: var(--tpmf-card-bg, #ffffff);
    border: 1px solid #e5e5e5;
    border-top: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.tpmf-carousel-video .tpmf-slide-title {
    color: #2c3338;
}

.tpmf-carousel-video .tpmf-slide-caption {
    color: #646970;
}

/* ==========================================================================
   CENTER MODE STYLES
   ========================================================================== */

/* Non-active slides in center mode (Scaled down & dimmed) */
.tpmf-swiper-container .swiper-slide {
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0.5;
    transform: scale(0.88);
}

/* Focused active center slide */
.tpmf-swiper-container .swiper-slide.swiper-slide-active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

/* Ensure active slide card elevated shadow */
.tpmf-swiper-container .swiper-slide.swiper-slide-active .tpmf-gallery-item,
.tpmf-swiper-container .swiper-slide.swiper-slide-active .tpmf-slide-inner {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}


/* --- NAVIGATION ARROWS --- */
.tpmf-swiper-container .swiper-button-next,
.tpmf-swiper-container .swiper-button-prev {
    width: 42px;
    height: 42px;
    margin-top: -21px; /* Center relative to top: 50% */
    background-color: #ffffff;
    color: #333333;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.tpmf-swiper-container .swiper-button-next::after,
.tpmf-swiper-container .swiper-button-prev::after {
    font-size: 16px;
    font-weight: 700;
}

/* Arrow Hover & Active States */
.tpmf-swiper-container .swiper-button-next:hover,
.tpmf-swiper-container .swiper-button-prev:hover {
    background-color: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.25);
    transform: scale(1.08);
}

.tpmf-swiper-container .swiper-button-next:active,
.tpmf-swiper-container .swiper-button-prev:active {
    transform: scale(0.96);
}

/* Disabled State */
.tpmf-swiper-container .swiper-button-disabled {
    opacity: 0.35 !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* --- PAGINATION DOTS --- */
.tpmf-swiper-container .swiper-pagination {
    bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tpmf-swiper-container .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 !important;
    background-color: #cccccc;
    opacity: 0.7;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.tpmf-swiper-container .swiper-pagination-bullet:hover {
    opacity: 1;
}

/* Active Pagination Dot Pill Effect */
.tpmf-swiper-container .swiper-pagination-bullet-active {
    width: 24px;
    height: 8px;
    background-color: #0073aa;
    opacity: 1;
    border-radius: 10px;
}

/* Navigation & Pagination Controls */
.tpmf-swiper-container .swiper-button-next,
.tpmf-swiper-container .swiper-button-prev {
    color: var(--tpmf-nav-color);
    background-color: var(--tpmf-nav-bg);
}

.tpmf-swiper-container .swiper-button-next:hover,
.tpmf-swiper-container .swiper-button-prev:hover {
    background-color: var(--tpmf-dots-active-color);
    color: #ffffff;
    border-color: var(--tpmf-dots-active-color);
}

.tpmf-swiper-container .swiper-pagination-bullet {
    background-color: var(--tpmf-dots-color);
}

.tpmf-swiper-container .swiper-pagination-bullet-active {
    background-color: var(--tpmf-dots-active-color);
}

/**
 * Frontend Gallery Styles (Masonry, Grid, Carousel)
 * Package: TPMF Carousel
 */

/* ==========================================================================
   1. BASE WRAPPER & CARD STYLES
   ========================================================================== */
.tpmf-gallery-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.tpmf-gallery-wrapper *,
.tpmf-gallery-wrapper *::before,
.tpmf-gallery-wrapper *::after {
    box-sizing: inherit;
}

.tpmf-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background-color: #ffffff;
    border: 1px solid #eeeeee;
    display: flex;
    flex-direction: column; /* Stacks image and caption vertically */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tpmf-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* Image Wrapper Anchor */
.tpmf-gallery-item a {
    display: block;
    position: relative;
    width: 100%;
    overflow: hidden;
    text-decoration: none;
}

.tpmf-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tpmf-gallery-item:hover img {
    transform: scale(1.05);
}

/* Item Overlay Icon */
.tpmf-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.tpmf-gallery-item:hover .tpmf-item-overlay {
    opacity: 1;
}

.tpmf-item-overlay .dashicons {
    color: #ffffff;
    font-size: 28px;
    width: 28px;
    height: 28px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.tpmf-gallery-item:hover .tpmf-item-overlay .dashicons {
    transform: scale(1);
}

/* Caption Below Image */
.tpmf-item-caption {
    display: block; /* Ensures visibility */
    padding: 10px 12px;
    font-size: 14px;
    color: #333333;
    background: #ffffff;
    text-align: center;
    font-weight: 500;
    border-top: 1px solid #eeeeee;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
}

/* ==========================================================================
   2. STANDARD CSS GRID LAYOUT
   ========================================================================== */
.tpmf-layout-grid .tpmf-gallery-grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

/* Column Rules for Standard Grid */
.tpmf-layout-grid .tpmf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.tpmf-layout-grid .tpmf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.tpmf-layout-grid .tpmf-cols-4 { grid-template-columns: repeat(4, 1fr); }
.tpmf-layout-grid .tpmf-cols-5 { grid-template-columns: repeat(5, 1fr); }


/* ==========================================================================
   3. MASONRY LAYOUT (Pure CSS Fluid Columns)
   ========================================================================== */
.tpmf-layout-masonry .tpmf-gallery-grid {
    display: block;
    column-gap: 20px;
    width: 100%;
}

.tpmf-layout-masonry .tpmf-gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

/* Column Rules for Masonry */
.tpmf-layout-masonry .tpmf-cols-2 { column-count: 2; }
.tpmf-layout-masonry .tpmf-cols-3 { column-count: 3; }
.tpmf-layout-masonry .tpmf-cols-4 { column-count: 4; }
.tpmf-layout-masonry .tpmf-cols-5 { column-count: 5; }


/* ==========================================================================
   4. RESPONSIVE BREAKPOINTS (Grid & Masonry)
   ========================================================================== */

/* Tablet Screens (≤ 1024px) */
@media screen and (max-width: 1024px) {
    .tpmf-layout-grid .tpmf-cols-4,
    .tpmf-layout-grid .tpmf-cols-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .tpmf-layout-masonry .tpmf-cols-4,
    .tpmf-layout-masonry .tpmf-cols-5 {
        column-count: 3;
    }
}

/* Small Tablets / Large Phones (≤ 768px) */
@media screen and (max-width: 768px) {
    .tpmf-layout-grid .tpmf-cols-3,
    .tpmf-layout-grid .tpmf-cols-4,
    .tpmf-layout-grid .tpmf-cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tpmf-layout-masonry .tpmf-cols-3,
    .tpmf-layout-masonry .tpmf-cols-4,
    .tpmf-layout-masonry .tpmf-cols-5 {
        column-count: 2;
    }
}

/* Mobile Screens (≤ 480px) */
@media screen and (max-width: 480px) {
    .tpmf-layout-grid .tpmf-gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .tpmf-layout-masonry .tpmf-gallery-grid {
        column-count: 1 !important;
        column-gap: 0;
    }

    .tpmf-layout-masonry .tpmf-gallery-item {
        margin-bottom: 15px;
    }
}


/* Standard WP Size Mode: Maintain natural aspect ratio */
img.tpmf-img.tpmf-natural-size {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    object-fit: contain !important;
}

/* Custom Crop Mode: Force fixed height with cover cropping */
img.tpmf-img.tpmf-custom-size {
    width: 100% !important;
    display: block !important;
    object-fit: cover !important;
}


/* ==========================================================================
   WOOCOMMERCE SALE BADGE
   ========================================================================== */

/* 1. Ensure the thumbnail wrapper creates a positioning context */
.tpmf-product-item .tpmf-post-thumbnail {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* 2. Badge Styling & Positioning */
.tpmf-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    background-color: #e2401c;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}


/* ==========================================================================
   WOOCOMMERCE ADD TO CART BUTTON
   ========================================================================== */

.tpmf-product-add-to-cart {
    margin-top: 10px;
    width: 100%;
}

.tpmf-product-add-to-cart a.button,
.tpmf-product-add-to-cart a.tpmf-btn {
    display: inline-block;
    width: 100%;
    padding: 8px 14px;
    background-color: #0073aa;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.tpmf-product-add-to-cart a.button:hover,
.tpmf-product-add-to-cart a.tpmf-btn:hover {
    background-color: #005177;
    color: #ffffff !important;
}

.tpmf-product-add-to-cart a.button:active,
.tpmf-product-add-to-cart a.tpmf-btn:active {
    transform: scale(0.98);
}

/* AJAX Loading & Added State Styling */
.tpmf-product-add-to-cart a.button.loading {
    opacity: 0.7;
    position: relative;
    padding-right: 30px;
}

.tpmf-product-add-to-cart a.button.added::after {
    content: " \2713"; /* Checkmark icon */
    font-weight: bold;
}


/* ==========================================================================
   WOOCOMMERCE AJAX ADD TO CART OVERLAY (VIEW CART)
   ========================================================================== */

/* 1. Set container as positioning context */
.tpmf-product-add-to-cart {
    position: relative;
    margin-top: 10px;
    width: 100%;
}

/* 2. Position the dynamically generated "View cart" button over the main button */
.tpmf-product-add-to-cart a.added_to_cart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2e7d32; /* Green badge color */
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 4px;
    z-index: 5;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.tpmf-product-add-to-cart a.added_to_cart:hover {
    background-color: #1b5e20;
    color: #ffffff !important;
}

/* 3. Optional: Hide the original button checkmark once View Cart overlays */
.tpmf-product-add-to-cart a.button.added::after {
    display: none;
}

.tpmf-product-add-to-cart a.added_to_cart{
    margin-top: 0;
}


/* ==========================================================================
   WOOCOMMERCE PRODUCT PRICES
   ========================================================================== */

/* Price Wrapper */
.tpmf-product-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.2;
    color: #2c3338;
}

/* Original (Regular) Price - Strikethrough */
.tpmf-product-price del,
.tpmf-product-price del .woocommerce-Price-amount {
    color: #8c8f94 !important;
    font-size: 13px;
    font-weight: 400;
    text-decoration: line-through;
}

/* Current (Sale / Regular Single) Price */
.tpmf-product-price ins,
.tpmf-product-price ins .woocommerce-Price-amount,
.tpmf-product-price > .woocommerce-Price-amount {
    color: #e2401c !important; /* Highlight color for sale/current price */
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
}

/* Clear default browser backgrounds on <ins> tags */
.tpmf-product-price ins {
    background: transparent;
}