/* ========== MOBILE RESPONSIVE STYLES ========== */
.mobile-tags-toggle,
.mobile-tags-dropdown {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }

    .mobile-tags-toggle {
        display: block;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        transition: transform 0.3s ease;
    }

    .logo-section {
        justify-content: center;
    }

    .mobile-tags-toggle {
        width: 100%;
        background: linear-gradient(135deg, #0095f6 0%, #00c6ff 100%);
        border: none;
        border-radius: 30px;
        padding: 12px 20px;
        font-size: 15px;
        font-weight: 500;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 8px;
        box-shadow: 0 4px 15px rgba(0, 149, 246, 0.3);
        transition: all 0.3s ease;
    }

    .mobile-tags-toggle:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 149, 246, 0.4);
    }

    .mobile-tags-toggle:active {
        transform: translateY(0);
    }

    .mobile-tags-toggle::after {
        content: '\25BC';
        font-size: 14px;
        color: rgba(255,255,255,0.9);
        transition: transform 0.3s;
    }

    .mobile-tags-toggle.active::after {
        transform: rotate(180deg);
    }

    .mobile-tags-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        background: white;
        border-radius: 20px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        z-index: 1000;
        max-height: 350px;
        overflow-y: auto;
        padding: 15px;
        border: 1px solid rgba(0, 149, 246, 0.2);
    }

    .mobile-tags-dropdown.show {
        display: block;
        animation: fadeInDown 0.3s ease;
    }

    @keyframes fadeInDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .mobile-tags-dropdown .tags-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0;
    }

    .mobile-tags-dropdown .tag-item {
        display: inline-flex;
        align-items: center;
        padding: 8px 16px;
        background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf2 100%);
        border-radius: 30px;
        text-decoration: none;
        color: #2d3748;
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s;
        border: 1px solid rgba(0, 149, 246, 0.1);
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        gap: 8px;
    }

    .mobile-tags-dropdown .tag-item:hover {
        background: linear-gradient(135deg, #0095f6 0%, #00c6ff 100%);
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 149, 246, 0.3);
        border-color: transparent;
    }

    .mobile-tags-dropdown .tag-item.active {
        background: linear-gradient(135deg, #0095f6 0%, #00c6ff 100%);
        color: white;
        border-color: transparent;
    }

    .mobile-tags-dropdown .tag-name {
        font-weight: 500;
    }

    .mobile-tags-dropdown .tags-stats {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #edf2f7;
        font-size: 13px;
        color: #718096;
        text-align: center;
    }

    /* ========== MODAL MOBILE ========== */
    .modal-body {
        display: flex !important;
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-carousel {
        width: 100%;
        height: 50vh;
        min-height: 300px;
        flex-shrink: 0;
        position: relative;
        background-color: black;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: visible;
    }

    .carousel-container {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: visible;
        transform-origin: center center;
        /* will-change: transform removed from CSS — added dynamically in JS during pinch-zoom only */
    }

    .carousel-container.video-active {
        display: block !important;
        transform: none !important;
    }

    .carousel-slide {
        display: none;
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .carousel-slide.active {
        display: block;
    }

    .modal-info {
        padding: 20px;
        background-color: white;
        flex-shrink: 0;
        overflow-y: visible;
    }

    .carousel-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background-color: rgba(255, 255, 255, 0.3);
        color: white;
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 30;
    }

    .carousel-nav.prev {
        left: 10px;
    }

    .carousel-nav.next {
        right: 10px;
    }

    .carousel-container[style*="scale"] ~ .carousel-nav,
    .carousel-container[style*="scale"] ~ .slide-counter {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .carousel-nav,
    .slide-counter {
        opacity: 1;
        pointer-events: auto;
        transition: opacity 0.2s ease;
    }

    .carousel-container[style*="scale(1)"] ~ .carousel-nav,
    .carousel-container[style*="scale(1)"] ~ .slide-counter {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .slide-counter {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 14px;
        z-index: 30;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        transition: all 0.3s ease;
        padding: 15px 0;
    }

    .header.hide-elements .logo-section,
    .header.hide-elements .social-links {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.3s ease;
        height: 0;
        margin: 0;
    }

    .header.hide-elements .mobile-tags-toggle {
        transform: translateY(0);
        opacity: 1;
        margin-top: 5px;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 10px;
    }

    .container {
        padding: 0 15px;
    }

    .modal-carousel {
        cursor: grab;
    }

    .modal-carousel:active {
        cursor: grabbing;
    }

    .social-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .social-link span {
        display: none;
    }

    .social-link {
        padding: 10px;
        border-radius: 50%;
    }

    .social-link img {
        width: 24px;
        height: 24px;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .buy-options {
        gap: 20px;
    }

    .buy-option svg {
        width: 40px;
        height: 40px;
    }

    .post-actions {
        flex-direction: column;
        gap: 8px;
    }

    .buy-btn, .copy-link-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }

    .carousel-slide {
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
        /* will-change: transform removed from CSS — added dynamically in JS during pinch-zoom only */
    }

    .carousel-slide.video-slide {
        cursor: default;
        touch-action: auto;
        -webkit-user-select: auto;
        user-select: auto;
    }

    .carousel-slide.active {
        cursor: zoom-in;
    }

    .modal-carousel {
        touch-action: none;
        overflow: visible;
    }

    .modal-carousel.video-active {
        display: block !important;
        align-items: initial !important;
        justify-content: initial !important;
    }

    .modal-content {
        touch-action: none;
    }

    .modal-info {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .post-actions {
        flex-direction: column;
    }
}

@media (max-width: 360px) {
    .gallery {
        grid-template-columns: 1fr;
    }
}