/**
 * A2z Instagram Gallery Widget Styles
 * Version: 1.0.0
 */

/* =============================================================================
   MAIN WRAPPER
   ============================================================================= */

.A2z-instagram-gallery {
    background-color: #333333;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.A2z-instagram-gallery * {
    box-sizing: border-box;
}

/* =============================================================================
   TOP DIVIDER
   ============================================================================= */

.A2z-instagram-divider {
    width: 100%;
    height: 1px;
    background-color: rgba(106, 106, 106, 0.4);
}

/* =============================================================================
   CONTAINER
   ============================================================================= */

.A2z-instagram-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 36px;
}

@media (max-width: 1024px) {
    .A2z-instagram-container {
        padding: 24px 20px 32px;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-container {
        padding: 24px 16px 32px;
    }
}

/* =============================================================================
   HEADER
   ============================================================================= */

.A2z-instagram-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .A2z-instagram-header {
        margin-bottom: 24px;
    }
}

.A2z-instagram-rule {
    flex: 1;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.4);
}

.A2z-instagram-rule-left {
    margin-right: 16px;
}

.A2z-instagram-rule-right {
    margin-left: 16px;
}

@media (max-width: 1024px) {
    .A2z-instagram-rule-left {
        margin-right: 12px;
    }

    .A2z-instagram-rule-right {
        margin-left: 12px;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-rule-left {
        margin-right: 8px;
    }

    .A2z-instagram-rule-right {
        margin-left: 8px;
    }
}

.A2z-instagram-icon {
    width: 20px;
    height: 20px;
    fill: #FFFFFF;
    flex-shrink: 0;
    margin-right: 8px;
    transition: transform 0.3s ease-out;
}

@media (max-width: 1024px) {
    .A2z-instagram-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-icon {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }
}

.A2z-instagram-handle {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

.A2z-instagram-handle:hover .A2z-instagram-icon {
    transform: scale(1);
}

@media (max-width: 1024px) {
    .A2z-instagram-handle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-handle {
        font-size: 15px;
    }
}

.A2z-instagram-underline {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #FFFFFF;
    transition: width 0.3s ease-out;
}

a.A2z-instagram-handle:hover .A2z-instagram-underline {
    width: 100%;
}

/* =============================================================================
   GALLERY CAROUSEL
   ============================================================================= */

.A2z-instagram-carousel {
    position: relative;
    margin-bottom: 20px;
}

/* =============================================================================
   GRID LAYOUT
   ============================================================================= */

.A2z-instagram-grid {
    display: grid;
    gap: 24px;
    width: 100%;
}

@media (max-width: 1024px) {
    .A2z-instagram-grid {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-grid {
        gap: 12px;
    }
}

/* Desktop Grid - Always visible on desktop */
.A2z-instagram-grid-desktop {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
}

@media (max-width: 1024px) {
    .A2z-instagram-grid-desktop {
        display: none;
    }
}

/* Mobile/Tablet Grid - Always visible on mobile/tablet */
.A2z-instagram-grid-mobile {
    display: none;
    margin: 0 auto;
    max-width: 440px;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
}

@media (max-width: 1024px) {
    .A2z-instagram-grid-mobile {
        display: grid;
    }
}

/* =============================================================================
   IMAGE TILES
   ============================================================================= */

.A2z-instagram-tile {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    /* 1:1 Aspect Ratio */
    background-color: #333333;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    display: block;
    /* Ensure anchor tags work as blocks */
}

.A2z-instagram-tile.hidden {
    display: none;
}

.A2z-instagram-tile img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.A2z-instagram-tile:hover img {
    transform: scale(1.05);
}

/* =============================================================================
   VIDEO PLAY ICON
   ============================================================================= */

.A2z-instagram-video-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 18px;
    height: 18px;
    fill: rgba(255, 255, 255, 0.7);
    z-index: 2;
    pointer-events: none;
}

@media (max-width: 768px) {
    .A2z-instagram-video-icon {
        top: 10px;
        right: 10px;
        width: 16px;
        height: 16px;
    }
}

/* =============================================================================
   HOVER OVERLAY
   ============================================================================= */

.A2z-instagram-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 1;
}

.A2z-instagram-tile:hover .A2z-instagram-overlay {
    opacity: 1;
}

.A2z-instagram-overlay-icon {
    width: 48px;
    height: 48px;
    fill: #FFFFFF;
}

@media (max-width: 768px) {
    .A2z-instagram-overlay-icon {
        width: 40px;
        height: 40px;
    }
}

/* =============================================================================
   SIDE NAVIGATION ARROWS (Desktop Only)
   ============================================================================= */

.A2z-instagram-arrow {
    background: none;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    outline: none;
    user-select: none;
}

.A2z-instagram-arrow:hover {
    opacity: 0.8;
}

.A2z-instagram-arrow:focus {
    outline: none !important;
}

.A2z-instagram-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.A2z-instagram-arrow-side {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    font-size: 36px;
    line-height: 1;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.A2z-instagram-carousel:hover .A2z-instagram-arrow-side {
    opacity: 1;
}

.A2z-instagram-arrow-left {
    left: -85px;
}

.A2z-instagram-arrow-right {
    right: -85px;
}

/* Side arrows visible on all devices - same as desktop */
@media (max-width: 1024px) {
    .A2z-instagram-arrow-side {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .A2z-instagram-arrow-side {
        display: none !important;
    }
}

/* =============================================================================
   PAGINATION CONTROLS
   ============================================================================= */

.A2z-instagram-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
}

.A2z-instagram-pagination-arrow {
    width: 24px;
    height: 24px;
    font-size: 24px;
    line-height: 1;
}

.A2z-instagram-dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.A2z-instagram-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    padding: 0;
}

.A2z-instagram-dot:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

.A2z-instagram-dot.active {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.3);
}

.A2z-instagram-dot:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.A2z-instagram-empty {
    text-align: center;
    padding: 60px 20px;
    color: #FFFFFF;
}

.A2z-instagram-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    fill: rgba(255, 255, 255, 0.3);
}

.A2z-instagram-empty h3 {
    font-size: 18px;
    margin: 0 0 10px;
    font-weight: 500;
}

.A2z-instagram-empty p {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

.A2z-instagram-tile:focus {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    .A2z-instagram-tile img,
    .A2z-instagram-overlay,
    .A2z-instagram-underline,
    .A2z-instagram-arrow,
    .A2z-instagram-dot,
    .A2z-instagram-icon {
        transition: none;
    }

    .A2z-instagram-tile:hover img {
        transform: none;
    }
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */

.A2z-instagram-tile img[src=""] {
    background: linear-gradient(90deg, #333333 25%, #3d3d3d 50%, #333333 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* =============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================================= */

@media (hover: none) and (pointer: coarse) {

    /* Remove hover effects on touch devices */
    .A2z-instagram-tile:hover .A2z-instagram-overlay {
        opacity: 0 !important;
    }

    /* Disable tap overlay too */
    .A2z-instagram-tile:active .A2z-instagram-overlay {
        opacity: 0 !important;
    }

    /* FORCE arrows visible on mobile */
    .A2z-instagram-pagination-arrow,
    .A2z-instagram-arrow {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Disable hover transform on arrows */
    .A2z-instagram-arrow:hover {
        opacity: 1 !important;
        transform: none !important;
    }

    /* Disable image zoom on hover */
    .A2z-instagram-tile:hover img {
        transform: none !important;
    }
}

/* Additional mobile breakpoint for redundancy */
@media (max-width: 768px) {
    .A2z-instagram-pagination-arrow {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .A2z-instagram-tile:hover .A2z-instagram-overlay,
    .A2z-instagram-tile:active .A2z-instagram-overlay {
        opacity: 0 !important;
    }

    .A2z-instagram-tile:hover img {
        transform: none !important;
    }
}

/* =============================================================================
   HIGH CONTRAST MODE
   ============================================================================= */

@media (prefers-contrast: high) {

    .A2z-instagram-handle,
    .A2z-instagram-arrow {
        color: #FFFFFF;
    }

    .A2z-instagram-rule,
    .A2z-instagram-divider {
        background-color: rgba(255, 255, 255, 0.8);
    }

    .A2z-instagram-dot {
        border: 2px solid #FFFFFF;
    }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {

    .A2z-instagram-arrow,
    .A2z-instagram-pagination {
        display: none;
    }

    .A2z-instagram-grid-desktop {
        display: grid !important;
    }

    .A2z-instagram-grid-mobile {
        display: none !important;
    }

    .A2z-instagram-tile {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* =============================================================================
   ELEMENTOR EDITOR STYLES
   ============================================================================= */

.elementor-editor-active .A2z-instagram-carousel:hover .A2z-instagram-arrow-side {
    opacity: 0.5;
}

.elementor-editor-active .A2z-instagram-tile {
    cursor: default;
}