/*
 * Alvand Slider — Core Styles
 * Theme customization via CSS Variables only
 */

:root {
    --alvand-slider-width: 100%;
    --alvand-slider-height: 420px;
    --alvand-slider-max-height: 90vh;
    --alvand-slider-border-radius: 30px;
    --alvand-slider-bg: #111;

    --alvand-arrow-size: 44px;
    --alvand-arrow-bg: rgba(0, 0, 0, 0.45);
    --alvand-arrow-color: #fff;
    --alvand-arrow-hover-bg: rgba(0, 0, 0, 0.7);

    --alvand-dot-size: 10px;
    --alvand-dot-bg: rgba(255, 255, 255, 0.5);
    --alvand-dot-active-bg: #fff;

    --alvand-overlay-gradient: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    --alvand-overlay-text-color: #fff;

    --alvand-title-size: clamp(18px, 4vw, 25px);
    --alvand-title-weight: 600;
    --alvand-caption-size: clamp(13px, 2.5vw, 18px);

    --alvand-btn-bg: #223266;
    --alvand-btn-color: #fff;
    --alvand-btn-border-radius: 12px;
    --alvand-btn-padding: 10px 20px;
}

.alvand-slider {
    position: relative;
    width: var(--alvand-slider-width, 100%);
    height: var(--alvand-slider-height, 420px);
    max-height: var(--alvand-slider-max-height, 90vh);
    border-radius: var(--alvand-slider-border-radius, 30px);
    overflow: hidden;
    background: var(--alvand-slider-bg, #111);
    direction: ltr;
}

.alvand-slider .swiper {
    width: 100%;
    height: 100%;
}

.alvand-slider .swiper-slide {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--alvand-slider-bg, #111);
}

.alvand-slider .swiper-slide picture,
.alvand-slider .swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alvand-slider .swiper-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.alvand-slider .swiper-lazy-loaded {
    opacity: 1;
}

.alvand-slider .swiper-lazy-preloader {
    border-color: var(--alvand-arrow-color, #fff) transparent transparent transparent;
}

.alvand-slide__overlay {
    position: absolute;
    inset: auto 0 0;
    background: var(--alvand-overlay-gradient, linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8)));
    color: var(--alvand-overlay-text-color, #fff);
    padding: 24px;
    pointer-events: auto;
    z-index: 5;
}

.alvand-slide__title {
    font-size: var(--alvand-title-size, 25px);
    font-weight: var(--alvand-title-weight, 600);
    margin: 0 0 8px;
}

.alvand-slide__caption {
    font-size: var(--alvand-caption-size, 18px);
    margin: 0 0 8px;
    line-height: 1.6;
}

.alvand-slide__btn {
    display: inline-block;
    margin-top: 8px;
    padding: var(--alvand-btn-padding, 10px 20px);
    border-radius: var(--alvand-btn-border-radius, 12px);
    text-decoration: none;
    background: var(--alvand-btn-bg, #223266);
    color: var(--alvand-btn-color, #fff);
    border: 0;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.alvand-slide__btn:hover {
    opacity: 0.85;
}

.alvand-slide__link {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
}

.alvand-slide__video {
    position: relative;
    width: 100%;
    height: 100%;
}

.alvand-slide__video-placeholder {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.alvand-slide__video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alvand-slide__video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    z-index: 2;
}

.alvand-slide__video-play::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-left: 18px solid #fff;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
}

.alvand-slider .swiper-button-next,
.alvand-slider .swiper-button-prev {
    width: var(--alvand-arrow-size, 44px);
    height: var(--alvand-arrow-size, 44px);
    background: var(--alvand-arrow-bg, rgba(0, 0, 0, 0.45));
    color: var(--alvand-arrow-color, #fff);
    border-radius: 50%;
    transition: background 0.2s;
}

.alvand-slider .swiper-button-next:hover,
.alvand-slider .swiper-button-prev:hover {
    background: var(--alvand-arrow-hover-bg, rgba(0, 0, 0, 0.7));
}

.alvand-slider .swiper-button-next::after,
.alvand-slider .swiper-button-prev::after {
    font-size: 18px;
    font-weight: 700;
}

.alvand-slider .swiper-pagination-bullet {
    width: var(--alvand-dot-size, 10px);
    height: var(--alvand-dot-size, 10px);
    background: var(--alvand-dot-bg, rgba(255, 255, 255, 0.5));
    opacity: 1;
}

.alvand-slider .swiper-pagination-bullet-active {
    background: var(--alvand-dot-active-bg, #fff);
    width: calc(var(--alvand-dot-size, 10px) * 1.5);
    border-radius: 4px;
}

@media (max-width: 768px) {
    .alvand-slide__title {
        font-size: clamp(16px, 5vw, var(--alvand-title-size, 25px));
    }

    .alvand-slide__caption {
        font-size: clamp(12px, 3.5vw, var(--alvand-caption-size, 18px));
    }

    .alvand-slide__btn {
        font-size: 12px;
        padding: 8px 16px;
    }

    .alvand-slide__overlay {
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .alvand-slider .swiper-slide {
        transition: none !important;
    }

    .alvand-slider .swiper-lazy {
        opacity: 1;
    }
}

.alvand-slider--hero {
    --alvand-slider-height: 90vh;
    --alvand-slider-border-radius: 0;
}

.alvand-slider--carousel {
    --alvand-slider-height: auto;
}

.alvand-slider--gallery {
    --alvand-slider-height: auto;
}

/* ===== Phase 2: A11y & UX ===== */

.alvand-slider__pause-btn {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    color: #fff;
}

.alvand-slider__pause-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.alvand-slider__pause-icon {
    display: block;
    width: 14px;
    height: 14px;
    position: relative;
}

.alvand-slider__pause-icon::before,
.alvand-slider__pause-icon::after {
    content: '';
    position: absolute;
    top: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
    border-radius: 1px;
}

.alvand-slider__pause-icon::before { left: 0; }
.alvand-slider__pause-icon::after { right: 0; }

[data-paused="true"] .alvand-slider__pause-icon::before {
    left: 2px;
    width: 0;
    height: 0;
    background: none;
    border-left: 12px solid currentColor;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

[data-paused="true"] .alvand-slider__pause-icon::after {
    display: none;
}

.alvand-slider__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.2);
}

.alvand-slider__progress-bar {
    height: 100%;
    background: #fff;
    width: 0;
    animation: alvand-progress linear forwards;
    animation-duration: 5000ms;
}

@keyframes alvand-progress {
    from { width: 0%; }
    to { width: 100%; }
}

.alvand-slider .swiper-slide:active {
    opacity: 0.9;
    transform: scale(0.98);
    transition: opacity 0.1s, transform 0.1s;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (forced-colors: active) {
    .alvand-slider .swiper-button-next,
    .alvand-slider .swiper-button-prev,
    .alvand-slider__pause-btn {
        border: 2px solid ButtonText;
    }
}

@media (prefers-reduced-motion: reduce) {
    .alvand-slider__progress {
        display: none;
    }
}

/* ===== Phase 3: Templates & Animations ===== */

.alvand-slider--hero .alvand-slide__overlay {
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
    padding: 40px 24px;
}

.alvand-slider--hero .alvand-slide__title {
    font-size: clamp(28px, 5vw, 48px);
    max-width: 800px;
}

.alvand-slider--hero .alvand-slide__caption {
    font-size: clamp(16px, 2.5vw, 22px);
    max-width: 600px;
}

.alvand-slider--hero .alvand-slide__btn {
    font-size: 16px;
    padding: 14px 32px;
    border-radius: 50px;
    margin-top: 16px;
}

.alvand-slider--carousel .swiper-slide {
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.alvand-slider--carousel .swiper-slide:not(.swiper-slide-active) {
    opacity: 0.7;
    transform: scale(0.95);
}

.alvand-slider--carousel .alvand-slide__overlay {
    border-radius: 0 0 12px 12px;
}

.alvand-slider__thumbs {
    margin-top: 8px;
    padding: 0 4px;
}

.alvand-slider__thumbs .swiper-slide {
    width: auto;
    height: 72px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
}

.alvand-slider__thumbs .swiper-slide:hover {
    opacity: 0.8;
}

.alvand-slider__thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #fff;
}

.alvand-slider__thumbs img {
    display: block;
    width: auto;
    height: 100%;
    object-fit: cover;
}

/* Background video */
.alvand-slide__video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.alvand-slide__video-bg iframe,
.alvand-slide__video-bg-player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 0;
}

.alvand-slide__video-bg--youtube .alvand-slide__video-bg-player {
    width: 200%;
    height: 200%;
    pointer-events: none;
}

.alvand-slide__video-bg--vimeo .alvand-slide__video-bg-player {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.alvand-slide__video-bg--html5 {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.alvand-slide__video-bg-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

/* Embed videos */
.alvand-slide__video {
    position: relative;
    width: 100%;
    height: 100%;
}

.alvand-slide__video--youtube,
.alvand-slide__video--vimeo {
    cursor: pointer;
}

.alvand-slide__video--html5 video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.alvand-slide__video-placeholder {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alvand-slide__video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.alvand-slide__video-play {
    position: absolute;
    width: 68px;
    height: 48px;
    background: rgba(0,0,0,0.7);
    border-radius: 12px;
    transition: background 0.2s;
}

.alvand-slide__video-play::after {
    content: '';
    display: block;
    margin: 14px 0 0 24px;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
}

.alvand-slide__video-play:hover {
    background: #f00;
}

/* Ensure overlay appears above background video */
.alvand-slide[data-video-mode="background"] .alvand-slide__overlay,
.alvand-slide[data-video-mode="background"] .alvand-slide__link {
    z-index: 2;
    position: relative;
}

/* Fullscreen button */
.alvand-slider__fullscreen-btn {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 0;
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.alvand-slider__fullscreen-btn:hover {
    background: rgba(0,0,0,0.7);
}

.alvand-slider__fullscreen-btn--active svg {
    transform: scale(0.85);
}

/* Fullscreen overrides */
.alvand-slider:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
}

.alvand-slider:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
}

.alvand-slider:fullscreen {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
}

/* Lightbox */
.alvand-slider__lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alvand-slider__lightbox[hidden] {
    display: none;
}

.alvand-slider__lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 0;
}

.alvand-slider__lightbox-content {
    position: relative;
    z-index: 1;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 900px;
}

.alvand-slider__lightbox .swiper {
    width: 100%;
    height: 100%;
}

.alvand-slider__lightbox .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.alvand-slider__lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    z-index: 10;
    background: none;
    border: 0;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.alvand-slider__lightbox-close:hover {
    opacity: 1;
}

.alvand-slider__lightbox-prev,
.alvand-slider__lightbox-next {
    position: absolute;
    top: 50%;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.2s;
}

.alvand-slider__lightbox-prev { left: -52px; }
.alvand-slider__lightbox-next { right: -52px; }

.alvand-slider__lightbox-prev:hover,
.alvand-slider__lightbox-next:hover {
    background: rgba(255,255,255,0.4);
}

.alvand-slider__lightbox-prev::after,
.alvand-slider__lightbox-next::after {
    font-size: 18px;
}

/* Zoom button on slide */
.alvand-slide__zoom-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(0,0,0,0.4);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.alvand-slide:hover .alvand-slide__zoom-btn,
.alvand-slide:focus-within .alvand-slide__zoom-btn {
    opacity: 1;
}

.alvand-slide__zoom-btn:hover {
    background: rgba(0,0,0,0.7);
}

/* Parallax background */
.parallax-bg {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

/* Nested slider */
.alvand-slide__nested {
    position: relative;
    z-index: 3;
    width: 100%;
    margin-top: 8px;
}

.alvand-slide__nested .alvand-slider {
    max-height: 300px;
    --alvand-slider-height: 300px;
}
