/* Simple Gallery Manager - Admin Styles */

#sgm-gallery-container {
    margin: 10px 0;
}

.sgm-shortcode-info {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
}

.sgm-shortcode-info p {
    margin: 0;
}

.sgm-controls {
    margin-bottom: 15px;
}

.sgm-controls .button {
    margin-right: 10px;
}

.sgm-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
    min-height: 140px;
    border: 2px dashed #ddd;
    padding: 10px;
    border-radius: 10px;
}

.sgm-gallery-item {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: all 0.2s ease;
    aspect-ratio: 1 / 1;
}

.sgm-gallery-item:hover {
    border-color: #0073aa;
    transform: scale(1.02);
}

.sgm-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sgm-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff0000;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.sgm-remove-image:hover {
    opacity: 1;
}

.sgm-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.sgm-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Admin Toolbar */
.sgm-admin-toolbar {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Galleries Table */
.sgm-image-count {
    font-weight: bold;
    color: #0073aa;
}

.sgm-copy-shortcode {
    margin-left: 8px;
}

/* Frontend Gallery Styles - Square Layout */
.sgm-gallery {
    margin: 0;
    padding: 0;
}

.square-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    /* Mantém quadrado */
    overflow: hidden;
    border-radius: 10px;
    background-color: #f2f2f2;
}

.square-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.square-gallery:hover img {
    transform: scale(1.08);
}

/* Bootstrap fallback for when Bootstrap is not loaded */
.sgm-gallery .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -1.5rem;
    margin-left: -1.5rem;
}

.sgm-gallery .col-lg-1 {
    flex: 0 0 8.333333%;
    max-width: 8.333333%;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

.sgm-gallery .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

.sgm-gallery .col-12 {
    flex: 0 0 12%;
    max-width: 100%;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

.sgm-gallery .g-4 > * {
    margin-top: 1.5rem;
}

.sgm-gallery .container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
}

/* Responsive for Square Gallery */
@media (max-width: 991.98px) {
    .sgm-gallery .col-lg-1 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575.98px) {
    .sgm-gallery .col-lg-1,
    .sgm-gallery .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .sgm-gallery .container {
        padding-right: 1rem;
        padding-left: 1rem;
    }
    
    .sgm-gallery .row {
        margin-right: -0.75rem;
        margin-left: -0.75rem;
    }
    
    .sgm-gallery .col-lg-1,
    .sgm-gallery .col-sm-6,
    .sgm-gallery .col-12 {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
}

@media (max-width: 380px) {
    .sgm-gallery .col-lg-1,
    .sgm-gallery .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Admin Grid Responsive */
@media (max-width: 480px) {
    .sgm-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        min-height: 100px;
    }
}

/* Fancybox Integration Styles */
.sgm-trigger-fancybox {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.sgm-trigger-fancybox:hover {
    text-decoration: none;
    color: inherit;
    transform: scale(1.02);
}

.sgm-trigger-fancybox:hover .square-gallery img {
    transform: scale(1.08);
}

.sgm-more-info {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.sgm-more-info:hover {
    opacity: 1;
}

/* Loading states for Fancybox */
.square-gallery img.loading {
    opacity: 0.7;
    position: relative;
}

.square-gallery img.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fancybox customizations */
.fancybox__content {
    border-radius: 10px;
    overflow: hidden;
}

.fancybox__slide {
    padding: 20px;
}

.fancybox__toolbar {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}