/* Gallery block styles */
.gallery-block-content {
    width: 100%;
}

.gallery-container {
    position: relative;
    width: 100%;
}

.gallery-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}

/* Empty state placeholder */
.gallery-placeholder {
    background: var(--color-bg-secondary);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-large);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 200px;
    width: 100%;
}

.gallery-placeholder:hover {
    background: var(--color-hover);
    border-color: var(--color-blue-accent);
}

.gallery-placeholder .placeholder-icon {
    font-size: 48px;
    color: var(--color-text-light);
}

.gallery-placeholder .placeholder-text {
    font-size: var(--font-size-base);
    color: var(--color-text-light);
    text-align: center;
}

/* Floating add button */
.gallery-floating-add-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    z-index: 10;
}

.gallery-container:hover .gallery-floating-add-btn {
    opacity: 1;
}

.gallery-floating-add-btn:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
    transform: translate(-50%, -50%) translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.gallery-item {
    position: relative;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Hover caption overlay - matches reference design */
.gallery-caption {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    padding: 16px;
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
}

/* Aspect ratio classes */
.gallery-item.aspect-square {
    aspect-ratio: 1 / 1;
}

.gallery-item.aspect-landscape {
    aspect-ratio: 16 / 9;
}

.gallery-item.aspect-portrait {
    aspect-ratio: 3 / 4;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

/* Move buttons */
.gallery-move-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 16px;
    color: var(--color-accent);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    z-index: 5;
}

.gallery-move-left {
    left: var(--spacing-sm);
}

.gallery-move-right {
    right: var(--spacing-sm);
}

.gallery-move-btn:hover {
    background: var(--color-accent);
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Edit and remove buttons */
.gallery-edit-btn,
.gallery-remove-btn {
    position: absolute;
    top: var(--spacing-sm);
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.gallery-edit-btn {
    left: var(--spacing-sm);
    color: var(--color-text);
}

.gallery-remove-btn {
    left: 44px;
    color: var(--color-error);
}

.gallery-item:hover .gallery-edit-btn,
.gallery-item:hover .gallery-remove-btn,
.gallery-item:hover .gallery-move-btn {
    opacity: 1;
}

.gallery-edit-btn:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.gallery-remove-btn:hover {
    background: #fdf0ed;
    border-color: var(--color-error);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}


/* Slideshow styles */
.gallery-slideshow {
    width: 100%;
    position: relative;
}

.slideshow-viewport {
    position: relative;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    width: 100%;
}

/* Aspect ratio classes for slideshow */
.slideshow-viewport.aspect-square {
    aspect-ratio: 1 / 1;
}

.slideshow-viewport.aspect-landscape {
    aspect-ratio: 16 / 9;
}

.slideshow-viewport.aspect-portrait {
    aspect-ratio: 3 / 4;
}

.slideshow-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.slideshow-viewport:hover .slideshow-image {
    transform: scale(1.02);
}

/* Navigation buttons */
.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white !important;
    border: 2px solid var(--color-accent) !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: var(--border-radius-large) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px !important;
    color: var(--color-accent) !important;
    transition: all 0.2s ease;
    opacity: 0;
    box-shadow: var(--shadow-lg) !important;
    backdrop-filter: blur(12px);
    font-weight: 600 !important;
}

.slideshow-viewport:hover .slideshow-nav {
    opacity: 1;
}

.slideshow-nav:hover {
    background: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: white !important;
    transform: translateY(-50%) translateY(-2px) scale(1.05) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

.slideshow-prev {
    left: var(--spacing-md);
}

.slideshow-next {
    right: var(--spacing-md);
}

/* Slide indicators */
.slideshow-indicators {
    position: absolute;
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-sm) !important;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95) !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border-radius: var(--border-radius-large) !important;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--color-border) !important;
}

.slideshow-dot {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50%;
    background: var(--color-border) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent !important;
}

.slideshow-dot:hover {
    background: var(--color-text-light) !important;
    border-color: var(--color-accent) !important;
    transform: scale(1.2) !important;
}

.slideshow-dot.active {
    background: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    transform: scale(1.3) !important;
    box-shadow: 0 0 0 2px rgba(255, 160, 122, 0.3) !important;
}

/* Edit controls */
.slideshow-edit-controls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: var(--spacing-xs);
    opacity: 0;
    transition: all 0.2s ease;
}

.slideshow-viewport:hover .slideshow-edit-controls {
    opacity: 1;
}

.slideshow-remove-btn,
.slideshow-add-btn {
    background: white;
    border: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.slideshow-remove-btn:hover,
.slideshow-add-btn:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.slideshow-remove-btn {
    color: var(--color-error);
    border-color: var(--color-error);
}

.slideshow-remove-btn:hover {
    border-color: var(--color-error);
    background: #fdf0ed;
}

.slideshow-add-btn {
    color: var(--color-text);
}

/* Empty state for slideshow */
.slideshow-empty {
    background: var(--color-bg-secondary);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 300px;
    width: 100%;
}

.slideshow-empty:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
}

.slideshow-empty .add-icon {
    font-size: 48px;
    color: var(--color-text-light);
}

.slideshow-empty .add-text {
    font-size: var(--font-size-base);
    color: var(--color-text-light);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .slideshow-nav {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
    }
    
    .slideshow-prev {
        left: 8px;
    }
    
    .slideshow-next {
        right: 8px;
    }
}

/* Modal styles */
.gallery-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.gallery-modal-overlay.active {
    opacity: 1;
}

.gallery-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.gallery-modal-image {
    width: 100%;
    max-width: 80vw;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.gallery-modal-caption {
    background: white;
    color: #333;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    border-top: 1px solid #eee;
}

.gallery-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: white;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: white;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-modal-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.gallery-modal-prev {
    left: 16px;
}

.gallery-modal-next {
    right: 16px;
}

/* Mobile responsive modal */
@media (max-width: 768px) {
    .gallery-modal-content {
        max-width: 95vw;
        margin: 20px;
    }
    
    .gallery-modal-image {
        max-height: 60vh;
    }
    
    .gallery-modal-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .gallery-modal-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .gallery-modal-prev {
        left: 12px;
    }
    
    .gallery-modal-next {
        right: 12px;
    }
    
    .gallery-modal-caption {
        padding: 16px 20px;
        font-size: 16px;
    }
}

/* Caption edit modal */
.caption-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.caption-edit-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.caption-edit-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--color-text);
}

.caption-edit-content label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-text);
    font-size: 14px;
}

.caption-input,
.caption-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
    font-family: var(--font-family);
}

.caption-textarea {
    resize: vertical;
    min-height: 80px;
}

.caption-input:focus,
.caption-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.caption-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.caption-save-btn,
.caption-cancel-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.caption-save-btn {
    background: var(--color-accent);
    color: white;
}

.caption-save-btn:hover {
    background: #b8754a;
}

.caption-cancel-btn {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.caption-cancel-btn:hover {
    background: var(--color-border);
}

/* Modal caption styling */
.modal-caption-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.modal-caption-body {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-top: 8px;
}