/**
 * Gallery component styles - Using CSS Variables from front.css
 */

/* Admin Gallery Styles */
.apb-gallery-admin {
    margin: var(--apb-spacing-md) 0;
}

.apb-gallery-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-gap: var(--apb-spacing-md);
    margin-bottom: var(--apb-spacing-lg);
}

.apb-gallery-item {
    position: relative;
    border-radius: var(--apb-border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--apb-gray-300);
    box-shadow: var(--apb-box-shadow-sm);
}

.apb-gallery-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.apb-gallery-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: space-between;
    padding: var(--apb-spacing-xxs) var(--apb-spacing-xs);
}

.apb-gallery-remove {
    color: var(--apb-white);
    text-decoration: none;
    padding: var(--apb-spacing-xxs) var(--apb-spacing-xs);
    border-radius: var(--apb-border-radius-sm);
    background: var(--apb-error-border);
    cursor: pointer;
    font-size: var(--apb-font-size-small);
}

.apb-gallery-featured {
    color: var(--apb-white);
    text-decoration: none;
    padding: var(--apb-spacing-xxs) var(--apb-spacing-xs);
    border-radius: var(--apb-border-radius-sm);
    background: var(--apb-secondary);
    cursor: pointer;
    font-size: var(--apb-font-size-small);
}

.apb-gallery-featured.active {
    background: var(--apb-primary);
}

.apb-gallery-upload {
    margin-bottom: var(--apb-spacing-md);
}

.apb-gallery-upload input[type="file"] {
    padding: var(--apb-spacing-xs);
    border: 1px dashed var(--apb-gray-300);
    background: var(--apb-light-gray);
    width: 100%;
    border-radius: var(--apb-border-radius-sm);
}

.apb-gallery-upload button {
    margin-top: var(--apb-spacing-sm);
}

.apb-upload-progress {
    margin-top: var(--apb-spacing-sm);
    height: 5px;
    background: var(--apb-gray-200);
    border-radius: var(--apb-border-radius-sm);
    overflow: hidden;
}

.apb-upload-progress-bar {
    height: 100%;
    background: var(--apb-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.apb-gallery-item.is-featured:before {
    content: "\2605";
    position: absolute;
    top: var(--apb-spacing-xxs);
    left: var(--apb-spacing-xxs);
    background: var(--apb-primary);
    color: var(--apb-white);
    width: 24px;
    height: 24px;
    border-radius: var(--apb-border-radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 5;
}

.apb-gallery-empty {
    padding: var(--apb-spacing-lg);
    background: var(--apb-light-gray);
    border: 1px dashed var(--apb-gray-300);
    text-align: center;
    border-radius: var(--apb-border-radius-sm);
    color: var(--apb-gray-500);
}

/* Frontend Gallery Styles */
.apb-gallery {
    position: relative;
    margin-bottom: 30px;
}

.apb-gallery-main-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #f8f8f8;
    min-height: 300px;
}

.apb-main-image {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 8px;
}

.apb-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.apb-gallery-thumb {
    flex: 0 0 var(--apb-gallery-thumb-width);
    width: var(--apb-gallery-thumb-width);
    height: var(--apb-gallery-thumb-height);
    cursor: pointer;
    border: var(--apb-border-width-thick) solid transparent;
    border-radius: var(--apb-border-radius-sm);
    overflow: hidden;
    transition: all var(--apb-transition-speed) var(--apb-transition-easing);
    opacity: 0.8;
}

.apb-gallery-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.apb-gallery-thumb.active {
    border-color: var(--apb-primary);
    opacity: 1;
}

.apb-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apb-gallery-prev, 
.apb-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: var(--apb-white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: var(--apb-border-radius-circle);
    font-size: 24px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    z-index: var(--apb-z-index-higher);
    opacity: 0.7;
    padding: 0;
    transition: all var(--apb-transition-speed) var(--apb-transition-easing);
    box-shadow: var(--apb-box-shadow-lg);
}

.apb-gallery-prev:hover, 
.apb-gallery-next:hover {
    opacity: 1;
    background: rgba(0,0,0,0.8);
}

.apb-gallery-prev {
    left: 20px;
}

.apb-gallery-next {
    right: 20px;
}

@media (max-width: 768px) {
    .apb-gallery-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .apb-gallery-prev, 
    .apb-gallery-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
        line-height: 20px;
    }
    
    .apb-gallery-thumb {
        flex: 0 0 60px;
        width: 60px;
        height: 60px;
    }
}