/**
 * Advanced Image Gallery Widget Styles
 *
 * Modern, responsive styles for the Advanced Image Gallery Widget.
 * Includes grid layouts, hover effects, animations, and accessibility features.
 *
 * @package Advanced_Widget_Kit
 * @since 2.0.1
 */

/* ==========================================================================
   Base Gallery Styles
   ========================================================================== */

.awke-advanced-image-gallery {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.awke-gallery-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ==========================================================================
   Grid Layout Styles
   ========================================================================== */

.awke-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns, 3), 1fr);
    gap: 10px;
    width: 100%;
}

.awke-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.awke-gallery-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.awke-gallery-item.awke-item-visible {
    opacity: 1;
    transform: translateY(0);
}

.awke-gallery-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.awke-gallery-image {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.awke-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    display: block;
}

.awke-gallery-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   Masonry Layout Styles
   ========================================================================== */

.awke-gallery-masonry {
    column-count: 3;
    column-gap: 10px;
    width: 100%;
}

.awke-gallery-masonry .awke-gallery-item {
    break-inside: avoid;
    margin-bottom: 10px;
    display: inline-block;
    width: 100%;
}

/* ==========================================================================
   Justified Layout Styles
   ========================================================================== */

.awke-gallery-justified {
    width: 100%;
}

.awke-gallery-justified .awke-gallery-item {
    display: inline-block;
    vertical-align: top;
    margin: 0;
}

/* ==========================================================================
   Filter Styles
   ========================================================================== */

.awke-gallery-filters {
    text-align: center;
    margin-bottom: 30px;
    padding: 0;
}

.awke-filter-btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 5px 10px;
    background-color: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.awke-filter-btn:hover {
    background-color: #007cba;
    color: #fff;
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.awke-filter-btn.active {
    background-color: #007cba;
    color: #fff;
    border-color: #007cba;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.awke-filter-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

/* Overlay Effect */
.awke-gallery-item:hover .awke-gallery-overlay {
    opacity: 1;
    visibility: visible;
}

.awke-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2;
}

.awke-gallery-content {
    text-align: center;
    padding: 20px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.awke-gallery-item:hover .awke-gallery-content {
    transform: translateY(0);
}

.awke-gallery-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #fff;
}

.awke-gallery-caption {
    font-size: 0.9rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

/* Zoom Effect */
.awke-gallery-item[data-hover="zoom"]:hover .awke-gallery-image img {
    transform: scale(1.1);
}

/* Grayscale Effect */
.awke-gallery-item[data-hover="grayscale"] .awke-gallery-image img {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.awke-gallery-item[data-hover="grayscale"]:hover .awke-gallery-image img {
    filter: grayscale(0%);
}

/* Blur Effect */
.awke-gallery-item[data-hover="blur"]:hover .awke-gallery-image img {
    filter: blur(2px);
}

/* Icon Effect */
.awke-gallery-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 3;
}

.awke-gallery-item:hover .awke-gallery-icon {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1.1);
}

.awke-gallery-icon i,
.awke-gallery-icon svg {
    font-size: 20px;
    color: #333;
}

/* ==========================================================================
   Animation Styles
   ========================================================================== */

.awke-animation-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.awke-animation-item.awke-animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In Animation */
.awke-animate-fadeIn {
    animation: awkeFadeIn 0.6s ease forwards;
}

@keyframes awkeFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up Animation */
.awke-animate-slideUp {
    animation: awkeSlideUp 0.6s ease forwards;
}

@keyframes awkeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Down Animation */
.awke-animate-slideDown {
    animation: awkeSlideDown 0.6s ease forwards;
}

@keyframes awkeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Left Animation */
.awke-animate-slideLeft {
    animation: awkeSlideLeft 0.6s ease forwards;
}

@keyframes awkeSlideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide Right Animation */
.awke-animate-slideRight {
    animation: awkeSlideRight 0.6s ease forwards;
}

@keyframes awkeSlideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In Animation */
.awke-animate-zoomIn {
    animation: awkeZoomIn 0.6s ease forwards;
}

@keyframes awkeZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Load More Styles
   ========================================================================== */

.awke-load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.awke-load-more-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #007cba;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.awke-load-more-btn:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.awke-load-more-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.awke-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Lazy Loading Styles
   ========================================================================== */

.awke-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.awke-loaded {
    opacity: 1;
}

.awke-lazy-placeholder {
    background-color: #f8f9fa;
    background-image: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
    background-size: 200% 100%;
    animation: awkeShimmer 1.5s infinite;
}

@keyframes awkeShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    .awke-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .awke-gallery-masonry {
        column-count: 2;
        column-gap: 8px;
    }
    
    .awke-gallery-filters {
        margin-bottom: 20px;
    }
    
    .awke-filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .awke-gallery-content {
        padding: 15px;
    }
    
    .awke-gallery-title {
        font-size: 1.1rem;
    }
    
    .awke-gallery-caption {
        font-size: 0.85rem;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .awke-gallery-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .awke-gallery-masonry {
        column-count: 1;
        column-gap: 6px;
    }
    
    .awke-gallery-filters {
        margin-bottom: 15px;
    }
    
    .awke-filter-btn {
        padding: 6px 12px;
        font-size: 12px;
        margin: 0 2px 8px;
    }
    
    .awke-gallery-content {
        padding: 10px;
    }
    
    .awke-gallery-title {
        font-size: 1rem;
    }
    
    .awke-gallery-caption {
        font-size: 0.8rem;
    }
    
    .awke-gallery-icon {
        width: 40px;
        height: 40px;
    }
    
    .awke-gallery-icon i,
    .awke-gallery-icon svg {
        font-size: 16px;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .awke-gallery-grid {
        gap: 4px;
    }
    
    .awke-gallery-masonry {
        column-gap: 4px;
    }
    
    .awke-gallery-item {
        border-radius: 4px;
    }
    
    .awke-filter-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .awke-load-more-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Accessibility Styles
   ========================================================================== */

/* Focus styles for keyboard navigation */
.awke-gallery-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.awke-gallery-item:focus .awke-gallery-overlay {
    opacity: 1;
    visibility: visible;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .awke-gallery-item {
        border: 2px solid #000;
    }
    
    .awke-filter-btn {
        border: 2px solid #000;
        background-color: #fff;
        color: #000;
    }
    
    .awke-filter-btn:hover,
    .awke-filter-btn.active {
        background-color: #000;
        color: #fff;
    }
    
    .awke-gallery-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .awke-gallery-item,
    .awke-gallery-image img,
    .awke-gallery-overlay,
    .awke-gallery-content,
    .awke-gallery-icon,
    .awke-filter-btn,
    .awke-load-more-btn {
        transition: none;
        animation: none;
    }
    
    .awke-gallery-item:hover .awke-gallery-image img {
        transform: none;
    }
    
    .awke-gallery-item:hover .awke-gallery-content {
        transform: none;
    }
    
    .awke-gallery-item:hover .awke-gallery-icon {
        transform: translate(-50%, -50%);
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

.awke-advanced-image-gallery[dir="rtl"] .awke-gallery-filters {
    text-align: right;
}

.awke-advanced-image-gallery[dir="rtl"] .awke-filter-btn {
    margin: 0 5px 10px;
}

.awke-advanced-image-gallery[dir="rtl"] .awke-load-more-container {
    text-align: right;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .awke-gallery-filters,
    .awke-load-more-container {
        display: none;
    }
    
    .awke-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .awke-gallery-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .awke-gallery-overlay {
        display: none;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.awke-advanced-image-gallery:not(.awke-gallery-initialized) {
    opacity: 0.7;
    position: relative;
}

.awke-advanced-image-gallery:not(.awke-gallery-initialized)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: awkeSpin 1s linear infinite;
    z-index: 1000;
}

.awke-advanced-image-gallery.awke-gallery-initialized {
    opacity: 1;
}

.awke-advanced-image-gallery.awke-gallery-initialized::after {
    display: none;
}

@keyframes awkeSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Loading state for individual items */
.awke-gallery-item {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.awke-gallery-item:not(.awke-image-loaded) img {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.awke-gallery-item.awke-image-loaded img {
    opacity: 1;
}

/* Shimmer effect for loading items */
.awke-gallery-item:not(.awke-image-loaded)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f8f9fa;
    background-image: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
    background-size: 200% 100%;
    animation: awkeShimmer 1.5s infinite;
    z-index: 1;
}

.awke-gallery-item.awke-image-loaded::before {
    display: none;
}

/* ==========================================================================
   Lightbox Integration
   ========================================================================== */

.awke-lightbox-open .awke-gallery-item {
    filter: brightness(0.8);
}

.awke-lightbox-open .awke-gallery-item:hover {
    filter: brightness(1);
}

/* ==========================================================================
   Custom Properties for Dynamic Styling
   ========================================================================== */

.awke-advanced-image-gallery {
    --gallery-columns: 3;
    --gallery-gap: 10px;
    --gallery-border-radius: 8px;
    --gallery-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --gallery-hover-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --gallery-overlay-color: rgba(0, 0, 0, 0.7);
    --gallery-text-color: #fff;
    --gallery-accent-color: #007cba;
}
