/**
 * STW Front Window Plugin - Frontend Styles
 */

/* Container */
.stw-fw-container {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 15px;
}

.stw-fw-container *,
.stw-fw-container *::before,
.stw-fw-container *::after {
    box-sizing: border-box;
}

/* Instance Grid */
.stw-fw-instance {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

/* Individual Div/Card */
.stw-fw-div {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    flex: 0 1 auto;
}

.stw-fw-div:hover {
    z-index: 10;
}

/* Hover Effects */
.stw-fw-div[data-hover-effect="shadow"]:hover,
.stw-fw-div[data-hover-effect="both"]:hover {
    box-shadow: var(--stw-hover-shadow, 0 4px 15px rgba(0,0,0,0.1));
}

.stw-fw-div[data-hover-effect="scale"]:hover,
.stw-fw-div[data-hover-effect="both"]:hover {
    transform: scale(var(--stw-hover-scale, 1.02));
}

/* Title - H1 for SEO */
.stw-fw-title {
    line-height: 1.3;
    word-wrap: break-word;
}

/* Gallery Container */
.stw-fw-gallery {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

/* Gallery Slider */
.stw-fw-gallery-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.stw-fw-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.stw-fw-slide.active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

.stw-fw-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stw-fw-slide a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.stw-fw-slide a:hover img {
    opacity: 0.9;
}

/* Gallery Navigation */
.stw-fw-gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    pointer-events: none;
    z-index: 5;
}

.stw-fw-nav-prev,
.stw-fw-nav-next {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    opacity: 0;
}

.stw-fw-gallery:hover .stw-fw-nav-prev,
.stw-fw-gallery:hover .stw-fw-nav-next {
    opacity: 1;
}

.stw-fw-nav-prev:hover,
.stw-fw-nav-next:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.stw-fw-nav-prev:focus,
.stw-fw-nav-next:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Gallery Dots */
.stw-fw-gallery-dots {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.stw-fw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

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

/* Caption Overlay */
.stw-fw-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.stw-fw-current-caption {
    display: block;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Date Display */
.stw-fw-date-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stw-fw-date-icon {
    flex-shrink: 0;
}

.stw-fw-date-text {
    flex: 1;
    line-height: 1.3;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stw-fw-container {
        padding: 0 10px;
    }
    
    .stw-fw-instance {
        gap: 15px !important;
    }
    
    .stw-fw-div {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    .stw-fw-nav-prev,
    .stw-fw-nav-next {
        opacity: 1;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .stw-fw-gallery-dots {
        bottom: 50px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stw-fw-div {
        min-width: 45% !important;
    }
}

/* Accessibility */
.stw-fw-slide a:focus {
    outline: 3px solid #0073aa;
    outline-offset: -3px;
}

/* Animation for smooth loading */
@keyframes stw-fw-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stw-fw-div {
    animation: stw-fw-fadeIn 0.4s ease forwards;
}

.stw-fw-div:nth-child(1) { animation-delay: 0.05s; }
.stw-fw-div:nth-child(2) { animation-delay: 0.1s; }
.stw-fw-div:nth-child(3) { animation-delay: 0.15s; }
.stw-fw-div:nth-child(4) { animation-delay: 0.2s; }
.stw-fw-div:nth-child(5) { animation-delay: 0.25s; }
.stw-fw-div:nth-child(6) { animation-delay: 0.3s; }
.stw-fw-div:nth-child(7) { animation-delay: 0.35s; }
.stw-fw-div:nth-child(8) { animation-delay: 0.4s; }

/* Print Styles */
@media print {
    .stw-fw-gallery-nav,
    .stw-fw-gallery-dots {
        display: none;
    }
    
    .stw-fw-div {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .stw-fw-div {
        border-width: 2px !important;
    }
    
    .stw-fw-nav-prev,
    .stw-fw-nav-next {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .stw-fw-div,
    .stw-fw-slide,
    .stw-fw-nav-prev,
    .stw-fw-nav-next,
    .stw-fw-dot {
        transition: none;
        animation: none;
    }
}
