/* Основные стили галереи */
.sgd-gallery {
    margin: 30px 0;
    font-family: Arial, sans-serif;
}

.sgd-controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    gap: 10px;
}

.sgd-left-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sgd-controls button {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.sgd-controls button:hover {
    background: #135e96;
}

.sgd-pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sgd-controls select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.sgd-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.sgd-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.sgd-item:hover {
    transform: scale(1.03);
}

.sgd-thumbnail {
    max-width: 100%;
    max-height: 100%;
    cursor: pointer;
    transition: transform 0.3s;
}

.sgd-thumbnail:hover {
    transform: scale(1.05);
}

/* Контейнер для чекбокса */
.sgd-checkbox-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.sgd-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.sgd-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: white;
    border: 2px solid #2271b1;
    border-radius: 4px;
}

.sgd-checkbox-container:hover .sgd-checkmark {
    background-color: #f1f1f1;
}

.sgd-checkbox:checked ~ .sgd-checkmark {
    background-color: #2271b1;
}

.sgd-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.sgd-checkbox:checked ~ .sgd-checkmark:after {
    display: block;
}

.sgd-checkbox-container .sgd-checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.sgd-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    text-align: center;
}

.sgd-lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    margin-top: 50px;
}

.sgd-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.sgd-prev, .sgd-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
}

.sgd-prev {
    left: 20px;
}

.sgd-next {
    right: 20px;
}

.sgd-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.sgd-loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 90%;
}

.sgd-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: sgd-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes sgd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sgd-download-single {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background: #2271b1;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .sgd-controls {
        flex-direction: column;
    }
    
    .sgd-left-controls {
        width: 100%;
        justify-content: center;
    }
    
    .sgd-pagination-controls {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .sgd-images {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .sgd-item {
        height: 150px;
    }
    
    .sgd-lightbox-content {
        max-width: 95%;
        max-height: 70vh;
        margin-top: 30px;
    }
    
    .sgd-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
    
    .sgd-prev, .sgd-next {
        font-size: 30px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .sgd-images {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .sgd-item {
        height: 120px;
    }
    
    .sgd-checkbox-container {
        top: 5px;
        left: 5px;
    }
    
    .sgd-checkmark {
        height: 20px;
        width: 20px;
    }
    
    .sgd-checkbox-container .sgd-checkmark:after {
        left: 7px;
        top: 3px;
        width: 4px;
        height: 8px;
        border-width: 0 2px 2px 0;
    }
}