/* TRUE MASONRY LAYOUT - Responsive Column System */
.masonry-layout {
    column-count: 2;
    column-gap: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .masonry-layout {
        column-count: 3;
        column-gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .masonry-layout {
        column-count: 4;
    }
}

@media (min-width: 1024px) {
    .masonry-layout {
        column-count: 5;
        column-gap: 1.5rem;
    }
}

@media (min-width: 1536px) {
    .masonry-layout {
        column-count: 6;
    }
}

/* Masonry Item */
.masonry-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    transform: translateZ(0);
    transition: transform 0.2s ease;
    cursor: pointer;
    backface-visibility: hidden;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* Minimal Hover Effects */
@media (hover: hover) {
    .masonry-item:hover {
        transform: translateY(-2px);
        z-index: 10;
    }

    .masonry-item:hover img {
        transform: scale(1.02);
    }
}

/* Category Button Active State */
.cat-btn.active img, 
.cat-btn.active .home-icon-wrapper {
    border-color: #000;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #000;
}

.cat-btn.active span {
    color: #000;
    font-weight: 700;
}

.cat-btn img, 
.home-icon-wrapper {
    transition: all 0.2s ease;
    border: 2px solid transparent;
    border-radius: 50%;
}

/* Dark Mode Support */
.dark .cat-btn.active img,
.dark .cat-btn.active .home-icon-wrapper {
    border-color: #fff;
    box-shadow: 0 0 0 2px #374151, 0 0 0 3px #fff;
}

.dark .cat-btn.active span {
    color: #fff;
}

/* Simple Image Modal */
#image-modal {
    backdrop-filter: blur(4px);
}

#image-modal img {
    max-height: 85vh;
    max-width: 90vw;
    object-fit: contain;
}

/* Success Popup Animation */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.success-popup-content {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Loading Shimmer */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Dark mode loading */
.dark .loading-shimmer {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out backwards;
}

/* Scrollbar Hide */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Modal Backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Spotify-style Music Player */
#music-player {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#music-player .progress-container {
    cursor: pointer;
}

#music-player .progress-container:hover #progress-bar {
    background-color: #1ed760;
}

#music-player input[type="range"] {
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #535353;
}

#music-player input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#music-player input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Music playlist items */
.music-playlist-item {
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.music-playlist-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.music-playlist-item.active {
    background-color: rgba(29, 185, 84, 0.2);
    border-left: 3px solid #1DB954;
}

/* Social footer icons */
.social-footer {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-footer:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Footer links */
.footer-link {
    color: #9ca3af;
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Glow border effect */
.glow-border {
    position: relative;
}

.glow-border::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(99, 102, 241, 0.5), 
        rgba(139, 92, 246, 0.5), 
        rgba(168, 85, 247, 0.5),
        transparent
    );
    animation: glowMove 3s infinite linear;
}

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

/* Dark mode adjustments */
.dark .glow-border::after {
    background: linear-gradient(90deg, 
        transparent, 
        rgba(99, 102, 241, 0.8), 
        rgba(139, 92, 246, 0.8), 
        rgba(168, 85, 247, 0.8),
        transparent
    );
}

/* Logo stats modal */
#logo-stats-modal .stats-grid {
    display: grid;
    gap: 12px;
}

#logo-stats-modal .stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    text-align: center;
    transition: transform 0.2s ease;
}

#logo-stats-modal .stat-item:hover {
    transform: translateY(-2px);
}

/* Custom scrollbar for playlist */
#playlist-container::-webkit-scrollbar,
#music-playlist::-webkit-scrollbar {
    width: 6px;
}

#playlist-container::-webkit-scrollbar-track,
#music-playlist::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#playlist-container::-webkit-scrollbar-thumb,
#music-playlist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#playlist-container::-webkit-scrollbar-thumb:hover,
#music-playlist::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Footer background */
#main-footer {
    background-blend-mode: overlay;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .masonry-layout {
        column-count: 4;
    }
}

@media (max-width: 768px) {
    .masonry-layout {
        column-count: 3;
    }
    
    #music-player {
        width: 320px;
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 640px) {
    .masonry-layout {
        column-count: 2;
    }
    
    #music-player {
        width: calc(100% - 20px);
        right: 10px;
        bottom: 10px;
    }
    
    .social-footer {
        width: 36px;
        height: 36px;
    }
    
    .footer-link {
        font-size: 13px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .masonry-layout {
        column-count: 2;
        column-gap: 0.75rem;
    }
    
    .masonry-item {
        margin-bottom: 0.75rem;
    }
    
    .grid.grid-cols-5 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Audio Range Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
}

.dark input[type="range"] {
    background: #4b5563;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8B5CF6;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8B5CF6;
    cursor: pointer;
    border: none;
}

/* Progress Bar */
#progress-bar {
    transition: width 0.1s linear;
}

/* View Count Badge */
.view-count-badge {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Login Modal */
#login-overlay {
    animation: fadeIn 0.3s ease;
}

/* Footer Quick Links */
.footer-link:hover {
    transform: translateX(2px);
}

/* Image Modal Download Button */
#download-btn {
    transition: all 0.2s ease;
}

#download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Toggle */
#theme-toggle {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Animation for new content */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.new-content {
    animation: slideUp 0.3s ease;
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Fix for Masonry items on small screens */
@media (max-width: 320px) {
    .masonry-layout {
        column-count: 1;
    }
}

/* Performance optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* User menu */
#user-menu {
    animation: slideDown 0.2s ease;
}

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

/* Category stats bars */
.category-bar {
    transition: width 1s ease-in-out;
}