/* Responsive Styles for all device sizes */

/* Base Mobile Styles (up to 480px) */
@media (max-width: 480px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
        padding: 70px 5px 15px;
        grid-gap: 8px;
    }
    
    .navbar {
        padding: 10px;
    }
    
    .navbar > div:first-child {
        font-size: 1rem;
    }
    
    .nav-controls {
        width: 100%;
        margin-top: 5px;
        justify-content: space-between;
        gap: 5px;
    }
    
    .nav-controls button {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    
    .nav-controls button i {
        margin-right: 0;
    }
    
    .settings-panel {
        width: 85%;
        right: -85%;
        top: 60px;
    }
    
    .settings-content {
        max-height: calc(100vh - 120px);
    }
    
    .fullscreen-image {
        max-height: 85vh;
    }
    
    .nav-button {
        width: 40px;
        height: 40px;
        margin: 0 5px;
    }
    
    .close-fullscreen {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }
    
    .image-counter {
        bottom: 10px;
        font-size: 0.8rem;
        padding: 3px 10px;
    }
}

/* Small Tablet/Large Mobile (480px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        padding: 75px 10px 15px;
    }
    
    .navbar {
        padding: 12px 15px;
    }
    
    .nav-controls {
        margin-top: 5px;
        width: 100%;
        justify-content: center;
    }
    
    .settings-panel {
        width: 70%;
        right: -70%;
    }
    
    .nav-button {
        width: 45px;
        height: 45px;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .grid-small {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .grid-medium {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .grid-large {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .settings-panel {
        width: 320px;
        right: -320px;
    }
}

/* Small Desktop (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .grid-small {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .grid-medium {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }
    
    .grid-large {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Large Desktop (1280px and up) */
@media (min-width: 1280px) {
    .gallery-container {
        padding: 80px 30px 30px;
        grid-gap: 15px;
    }
    
    .grid-small {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .grid-medium {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .grid-large {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Landscape Mode Optimization for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 8px 15px;
    }
    
    .gallery-container {
        padding-top: 60px;
    }
    
    .fullscreen-image {
        max-height: 80vh;
    }
    
    .settings-panel {
        top: 55px;
        max-height: calc(100vh - 60px);
    }
    
    .settings-content {
        max-height: calc(100vh - 110px);
    }
    
    .nav-button {
        width: 35px;
        height: 35px;
    }
    
    .close-fullscreen {
        width: 30px;
        height: 30px;
        top: 10px;
        right: 10px;
    }
}

/* Print styles - hide unnecessary elements */
@media print {
    .navbar, .settings-panel, .nav-buttons, .close-fullscreen {
        display: none !important;
    }
    
    .gallery-container {
        padding: 0;
        display: block;
    }
    
    .gallery-item {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 10px;
    }
}