/**
 * Lush Slider Module Styles
 * 
 * @package     Joomla.Site
 * @subpackage  mod_lushslider
 * @copyright   (C) 2025 Lush Domain
 * @license     GPL v2 or later
 */

/* Import Urbanist font */
@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* CSS Variables for colours */
:root {
    --lush-slider-bg: #000000;
    --lush-slider-text: #ffffff;
    --lush-slider-pagination-inactive: rgba(255, 255, 255, 0.3);
    --lush-slider-pagination-active: #ffffff;
    --lush-slider-nav-color: #ffffff;
    --lush-slider-nav-bg: rgba(0, 0, 0, 0.3);
    --lush-slider-nav-hover-bg: rgba(0, 0, 0, 0.5);
    
    /* Animation defaults (overridden by inline styles) */
    --lush-animation-duration: 600ms;
    --lush-slide-distance: 50px;
}

/* Responsive font sizes using clamp */
.lush-slider-wrapper {
    font-size: clamp(0.875rem, 0.7rem + 0.5vw, 1rem);
}

/* Slider Wrapper */
.lush-slider-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.lush-slider-contained {
    max-width: 1920px;
}

.lush-slider-fullwidth {
    max-width: 100%;
}

/* Main slider container */
.lush-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Slide */
.lush-slide {
    position: relative;
    width: 100%;
}

/* Slide Image */
.lush-slide-image {
    position: relative;
    width: 100%;
    line-height: 0;
}

.lush-slide-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   HEIGHT MODES
   ============================================ */

/* Auto Mode - Natural image height (default) */
.lush-height-auto .lush-slide {
    height: auto;
}

.lush-height-auto .lush-slide-image,
.lush-height-auto .lush-slide-image picture {
    height: auto;
}

.lush-height-auto .lush-slide-image img {
    height: auto;
    object-fit: contain;
}

/* Fixed Mode - Single height for all screens */
.lush-height-fixed .lush-slide {
    height: var(--lush-height-fixed, 600px);
}

.lush-height-fixed .lush-slide-image,
.lush-height-fixed .lush-slide-image picture {
    height: 100%;
}

.lush-height-fixed .lush-slide-image img {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Responsive Mode - Different heights per breakpoint */
.lush-height-responsive .lush-slide {
    height: var(--lush-height-mobile, 400px);
}

.lush-height-responsive .lush-slide-image,
.lush-height-responsive .lush-slide-image picture {
    height: 100%;
}

.lush-height-responsive .lush-slide-image img {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 768px) and (max-width: 1279px) {
    .lush-height-responsive .lush-slide {
        height: var(--lush-height-tablet, 500px);
    }
}

@media (min-width: 1280px) {
    .lush-height-responsive .lush-slide {
        height: var(--lush-height-desktop, 600px);
    }
}

/* Viewport Mode - 100vh minus offset */
.lush-height-viewport .lush-slide {
    height: calc(100vh - var(--lush-height-viewport-offset, 0px));
}

.lush-height-viewport .lush-slide-image,
.lush-height-viewport .lush-slide-image picture {
    height: 100%;
}

.lush-height-viewport .lush-slide-image img {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ============================================
   END HEIGHT MODES
   ============================================ */

/* Slide Layers Container */
.lush-slide-layers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Individual Layer */
.lush-layer {
    position: absolute;
    background: white;
    color: black;
    font-family: 'Urbanist', sans-serif;
    font-weight: 500;
    box-sizing: border-box;
    pointer-events: auto;
    opacity: 0;
    
    /* Responsive width with sensible defaults */
    width: auto;
    max-width: var(--lush-layer-max-width, min(50rem, 85vw));
    
    /* Responsive typography and spacing using clamp */
    font-size: clamp(1.75rem, 5vw, 3rem);
    line-height: 1.45;
    padding: clamp(1.8rem, 6vw, 3.5rem) clamp(1.5rem, 5vw, 2.8rem);
}

/* ============================================
   LAYER POSITIONS (9 positions)
   ============================================ */

/* Top Row */
.lush-layer-pos-top-left {
    top: clamp(1rem, 2vw, 2rem);
    left: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: 0px;
}

.lush-layer-pos-top-center {
    top: clamp(1rem, 2vw, 2rem);
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    --lush-layer-translate-x: -50%;
    --lush-layer-translate-y: 0px;
}

.lush-layer-pos-top-right {
    top: clamp(1rem, 2vw, 2rem);
    right: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: 0px;
}

/* Center Row */
.lush-layer-pos-center-left {
    top: 50%;
    left: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateY(-50%) translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: -50%;
}

.lush-layer-pos-center-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    --lush-layer-translate-x: -50%;
    --lush-layer-translate-y: -50%;
}

.lush-layer-pos-center-right {
    top: 50%;
    right: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateY(-50%) translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: -50%;
}

/* Bottom Row */
.lush-layer-pos-bottom-left {
    bottom: clamp(1rem, 2vw, 2rem);
    left: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: 0px;
}

.lush-layer-pos-bottom-center {
    bottom: clamp(1rem, 2vw, 2rem);
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    --lush-layer-translate-x: -50%;
    --lush-layer-translate-y: 0px;
}

.lush-layer-pos-bottom-right {
    bottom: clamp(1rem, 2vw, 2rem);
    right: var(--lush-layer-spacing, clamp(2rem, -2rem + 10vw, 10rem));
    transform: translateZ(0);
    --lush-layer-translate-x: 0px;
    --lush-layer-translate-y: 0px;
}

/* ============================================
   END LAYER POSITIONS
   ============================================ */

/* Ensure all text content wraps properly and never overflows */
.lush-layer * {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* Overflow protection for the layer itself (without max-width constraint) */
.lush-layer {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* Narrow screens: smaller font/padding */
@media (max-width: 767px) {
    .lush-layer {
        padding: clamp(1.4rem, 5vw, 2.2rem) clamp(1.2rem, 4vw, 1.8rem);
        font-size: clamp(1.375rem, 4.5vw, 2rem);
    }
}

/* Very small screens (≤480px): even smaller font/padding */
@media (max-width: 480px) {
    .lush-layer {
        padding: clamp(1.2rem, 5vw, 1.8rem) clamp(1rem, 4vw, 1.5rem);
        font-size: clamp(1.25rem, 4.2vw, 1.75rem);
    }
}

/* Layer Animations */
.lush-layer[data-swiper-animation="fade"] {
    animation: lushFadeIn var(--lush-animation-duration) ease forwards;
}

.lush-layer[data-swiper-animation="slide-left"] {
    animation: lushSlideLeft var(--lush-animation-duration) ease forwards;
}

.lush-layer[data-swiper-animation="slide-right"] {
    animation: lushSlideRight var(--lush-animation-duration) ease forwards;
}

.lush-layer[data-swiper-animation="slide-up"] {
    animation: lushSlideUp var(--lush-animation-duration) ease forwards;
}

.lush-layer[data-swiper-animation="slide-down"] {
    animation: lushSlideDown var(--lush-animation-duration) ease forwards;
}

.lush-layer[data-swiper-animation="none"] {
    opacity: 1;
}

/* Keyframe Animations */
@keyframes lushFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lushSlideLeft {
    from {
        opacity: 0;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateX(calc(-1 * var(--lush-slide-distance)))
            translateZ(0);
    }
    to {
        opacity: 1;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateZ(0);
    }
}

@keyframes lushSlideRight {
    from {
        opacity: 0;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateX(var(--lush-slide-distance))
            translateZ(0);
    }
    to {
        opacity: 1;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateZ(0);
    }
}

@keyframes lushSlideUp {
    from {
        opacity: 0;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateY(var(--lush-slide-distance))
            translateZ(0);
    }
    to {
        opacity: 1;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateZ(0);
    }
}

@keyframes lushSlideDown {
    from {
        opacity: 0;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateY(calc(-1 * var(--lush-slide-distance)))
            translateZ(0);
    }
    to {
        opacity: 1;
        transform: 
            translateX(var(--lush-layer-translate-x, -50%)) 
            translateY(var(--lush-layer-translate-y, -50%))
            translateZ(0);
    }
}

/* ===== NORMAL PAGINATION STYLE (Overlay, centered - dots) ===== */
.lush-pagination-normal {
    position: absolute !important;
    bottom: 30px !important;
    left: 50% !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    z-index: 20;
    display: flex !important;
    gap: 12px;
    align-items: center;
    width: auto !important;
}

.lush-pagination-normal .swiper-pagination-bullet {
    width: 12px !important;
    height: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent !important;
}

.lush-pagination-normal .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    opacity: 1 !important;
}

.lush-pagination-normal .swiper-pagination-bullet-active {
    background: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.2);
    opacity: 1 !important;
}

/* ===== ENHANCED PAGINATION STYLE (External, full-width line) ===== */
.lush-pagination-enhanced-container {
    position: relative;
    width: 100%;
    padding: 40px 0 20px 0;
    background: #f5f5f5;
}

.lush-pagination-enhanced-container::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #dddddd;
}

.lush-pagination-enhanced {
    position: relative !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
}

.lush-pagination-enhanced .swiper-pagination-bullet {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 0 8px 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    opacity: 1 !important;
    color: #999999;
    font-size: clamp(1.5rem, 2vw, 2.5rem);
    font-weight: 400;
    transition: all 0.3s ease;
    cursor: pointer;
    border-bottom: 3px solid transparent !important;
    font-family: serif;
    line-height: 1;
    flex: 1;
    text-align: center;
}

.lush-pagination-enhanced .swiper-pagination-bullet:hover {
    color: #666666;
    opacity: 1 !important;
}

.lush-pagination-enhanced .swiper-pagination-bullet-active {
    color: #666666 !important;
    font-weight: 400;
    border-bottom-color: #d32f2f !important;
    opacity: 1 !important;
}

/* ===== NAVIGATION ARROWS ===== */
/* Normal style - centered on sides */
.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-prev,
.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 50px;
    height: 50px;
    background: var(--lush-slider-nav-bg);
    color: var(--lush-slider-nav-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-prev:hover,
.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-next:hover {
    background: var(--lush-slider-nav-hover-bg);
}

.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-prev {
    left: 20px;
}

.lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-next {
    right: 20px;
}

/* Enhanced style - bottom left corner, side by side */
.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-prev,
.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-next {
    position: absolute !important;
    bottom: 0 !important;
    top: auto !important;
    transform: none !important;
    z-index: 20;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-prev:hover,
.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-next:hover {
    background: rgba(0, 0, 0, 0.9);
}

.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-prev {
    left: 0 !important;
}

.lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-next {
    left: 60px !important;
}

.lush-nav-prev::after,
.lush-nav-next::after {
    font-size: 1.5rem;
}

/* Hide navigation when disabled via settings */
.lush-slider-wrapper[data-show-pagination="false"] .lush-pagination {
    display: none;
}

.lush-slider-wrapper[data-show-arrows="false"] .lush-nav-prev,
.lush-slider-wrapper[data-show-arrows="false"] .lush-nav-next {
    display: none;
}

/* Hide inactive slides' layers */
.swiper-slide:not(.swiper-slide-active) .lush-layer {
    opacity: 0 !important;
    animation: none !important;
}

/* Mobile hide options */
@media (max-width: 767px) {
    /* Hide pagination on mobile when setting enabled */
    .lush-slider-wrapper[data-hide-pagination-mobile="true"] .lush-pagination-normal,
    .lush-slider-wrapper[data-hide-pagination-mobile="true"] .lush-pagination-enhanced-container {
        display: none !important;
    }
    
    /* Hide arrows on mobile when setting enabled */
    .lush-slider-wrapper[data-hide-arrows-mobile="true"] .lush-nav-prev,
    .lush-slider-wrapper[data-hide-arrows-mobile="true"] .lush-nav-next {
        display: none !important;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Normal pagination - slightly smaller dots */
    .lush-pagination-normal {
        bottom: 20px;
    }
    
    .lush-pagination-normal .swiper-pagination-bullet {
        width: 10px !important;
        height: 10px !important;
        gap: 10px;
    }
    
    /* Enhanced pagination - smaller text on mobile */
    .lush-pagination-enhanced .swiper-pagination-bullet {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        padding: 0 0 6px 0 !important;
        border-bottom-width: 2px !important;
    }
    
    .lush-pagination-enhanced-container {
        padding: 30px 0 15px 0;
    }
    
    /* Normal style arrows - smaller */
    .lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-prev,
    .lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-next {
        width: 40px;
        height: 40px;
    }
    
    .lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-prev {
        left: 10px;
    }
    
    .lush-slider-wrapper[data-pagination-style="normal"] .lush-nav-next {
        right: 10px;
    }
    
    /* Enhanced style arrows - smaller, still bottom left */
    .lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-prev,
    .lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-next {
        width: 45px;
        height: 45px;
    }
    
    .lush-slider-wrapper[data-pagination-style="enhanced"] .lush-nav-next {
        left: 45px !important;
    }
}
