/**
 * TPF Starter Slider - Frontend Styles
 */

/* Reset and base */
.tpf-slider {
    position: relative;
    width: 100%;
    height: var(--slider-height, 500px);
    overflow: hidden;
    border-radius: var(--border-radius, 0);
}

.tpf-slider * {
    box-sizing: border-box;
}

/* Slider Wrapper */
.tpf-slider-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Individual Slides */
.tpf-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
}

.tpf-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* Slide Image */
.tpf-slide-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Slide Content Overlay */
.tpf-slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    color: #fff;
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 70%, transparent 100%);
}

.tpf-slide-content h2.tpf-slide-title,
h2.tpf-slide-title {
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    color: #fff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border: none !important;
}

.tpf-slide-content p.tpf-slide-subtitle,
p.tpf-slide-subtitle {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.tpf-slide-button {
    display: inline-block;
    padding: 12px 28px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.3s, transform 0.3s;
}

.tpf-slide-button:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    color: #333;
    text-decoration: none;
}

/* Navigation Arrows */
.tpf-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
    padding: 0;
}

.tpf-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.tpf-arrow:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.tpf-arrow svg {
    width: 24px;
    height: 24px;
    stroke: #333;
}

.tpf-arrow-prev {
    left: 20px;
}

.tpf-arrow-next {
    right: 20px;
}

/* Navigation Dots */
.tpf-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.tpf-dot {
    width: 12px;
    height: 12px;
    padding: 0;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}

.tpf-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.tpf-dot.active {
    background: #fff;
    transform: scale(1.2);
}

.tpf-dot:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

/* Content Animation */
.tpf-slide .tpf-slide-content {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.6s ease 0.3s, opacity 0.6s ease 0.3s;
}

.tpf-slide.active .tpf-slide-content {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Action Buttons - shared base style */
.tpf-enlarge-btn,
.tpf-info-btn,
.tpf-link-btn {
    position: absolute;
    z-index: 15;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s, opacity 0.3s;
    padding: 0;
    opacity: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tpf-enlarge-btn svg,
.tpf-link-btn svg {
    width: 14px;
    height: 14px;
    stroke: #333;
}

/* Info button text styling */
.tpf-info-btn {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #333;
    line-height: 1;
}

.tpf-enlarge-btn:hover,
.tpf-info-btn:hover,
.tpf-link-btn:hover,
.tpf-info-btn.active {
    background: #fff;
    transform: scale(1.1);
}

/* Show buttons on active slide */
.tpf-slide.active .tpf-enlarge-btn,
.tpf-slide.active .tpf-info-btn,
.tpf-slide.active .tpf-link-btn {
    opacity: 1;
}

/* Button positions */
.tpf-enlarge-btn {
    top: 12px;
    right: 12px;
}

.tpf-info-btn {
    top: 12px;
    left: 12px;
}

.tpf-link-btn {
    bottom: 12px;
    right: 12px;
}

/* Link button: hidden on desktop, shown on mobile */
.tpf-link-btn {
    display: none;
}

/* Lightbox */
.tpf-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.tpf-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.tpf-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    padding: 0;
}

.tpf-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tpf-lightbox-close svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

.tpf-lightbox-image {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 4px;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.tpf-lightbox.active .tpf-lightbox-image {
    transform: scale(1);
}

/* ==========================================================================
   Carousel Mode (Multiple Slides Visible)
   ========================================================================== */

.tpf-slider.tpf-carousel {
    overflow: hidden;
}

.tpf-slider.tpf-carousel .tpf-slider-wrapper {
    display: flex;
    transition: transform 0.5s ease;
    gap: var(--slide-gap, 20px);
}

/* Carousel slides - higher specificity to override transition styles */
.tpf-slider.tpf-carousel .tpf-slide {
    position: relative;
    flex: 0 0 calc((100% - (var(--slides-to-show, 1) - 1) * var(--slide-gap, 20px)) / var(--slides-to-show, 1));
    width: calc((100% - (var(--slides-to-show, 1) - 1) * var(--slide-gap, 20px)) / var(--slides-to-show, 1));
    height: var(--slider-height, 500px);
    opacity: 1;
    visibility: visible;
    transform: none;
    border-radius: var(--border-radius, 0);
    overflow: hidden;
}

.tpf-slider.tpf-carousel .tpf-slide-image {
    border-radius: var(--border-radius, 0);
}

/* Hide content overlay on carousel slides until info clicked */
.tpf-slider.tpf-carousel .tpf-slide .tpf-slide-content {
    transform: translateY(0);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s; /* visibility changes after fade completes */
}

/* Show content when info is active */
.tpf-slider.tpf-carousel .tpf-slide.tpf-info-active .tpf-slide-content {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s 0s; /* visibility changes immediately */
}

/* Show enlarge and info buttons on all carousel slides */
.tpf-slider.tpf-carousel .tpf-slide .tpf-enlarge-btn,
.tpf-slider.tpf-carousel .tpf-slide .tpf-info-btn {
    opacity: 1 !important;
}

/* Carousel dots - position below slider */
.tpf-slider.tpf-carousel .tpf-dots {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    justify-content: center;
    margin-top: 20px;
}

.tpf-slider.tpf-carousel .tpf-dot {
    background: rgba(0, 0, 0, 0.3);
}

.tpf-slider.tpf-carousel .tpf-dot:hover {
    background: rgba(0, 0, 0, 0.5);
}

.tpf-slider.tpf-carousel .tpf-dot.active {
    background: #333;
}

/* Cloned slides for infinite scroll - identical styling */
.tpf-slider.tpf-carousel .tpf-slide.tpf-clone {
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
    /* Hide arrows on mobile - use swipe instead */
    .tpf-arrow {
        display: none;
    }

    /* Show mobile action icons */
    .tpf-slide.active .tpf-info-btn,
    .tpf-slide.active .tpf-link-btn {
        display: flex;
    }

    /* Hide text content by default on mobile - toggled by info button */
    .tpf-slide-content {
        padding: 10px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    /* Show text content when info is active */
    .tpf-slide.tpf-info-active .tpf-slide-content {
        opacity: 1;
        visibility: visible;
    }

    /* Keep info button visible when active */
    .tpf-slide.tpf-info-active .tpf-info-btn {
        background: #fff;
    }

    .tpf-slide-title {
        font-size: 16px;
    }

    .tpf-slide-subtitle {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .tpf-slide-content {
        padding: 8px;
        max-width: 90%;
    }

    .tpf-slide-title {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .tpf-slide-subtitle {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .tpf-slide-button {
        padding: 10px 20px;
        font-size: 13px;
    }

    .tpf-dots {
        bottom: 15px;
    }

    .tpf-dot {
        width: 10px;
        height: 10px;
    }
}
