/* Group Selector Styles */
.group-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.group-btn {
    padding: 10px 16px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #333;
    white-space: nowrap;
}

.group-btn:hover {
    background: #e9e9e9;
    border-color: #007cba;
    transform: translateY(-2px);
}

.group-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

/* Stack Placeholder */
.stack-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 18px;
    text-align: center;
}

/* Updated Stack Info */
.stack-info {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    backdrop-filter: blur(5px);
    z-index: 10;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive Group Selector */
@media (max-width: 768px) {
    .group-selector {
        gap: 6px;
    }
    
    .group-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .stack-info {
        font-size: 12px;
        padding: 8px 12px;
        flex-direction: column;
        gap: 4px;
    }
}

/* Loading State */
.stack-container.loading {
    position: relative;
}

.stack-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 5;
}

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

.tiff-stack-advanced {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.stack-container {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
}

.stack-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    object-fit: contain;
    cursor: grab;
    user-select: none;
}

.stack-layer.active {
    opacity: 1;
}

.stack-layer:active {
    cursor: grabbing;
}

.stack-info {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    backdrop-filter: blur(5px);
    z-index: 10;
}

.zoom-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.zoom-btn {
    background: rgba(0,0,0,0.8);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.stack-controls {
    margin-top: 20px;
    padding: 0 10px;
}

.stack-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    cursor: pointer;
}

.stack-slider:hover {
    opacity: 1;
}

.stack-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.stack-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .tiff-stack-advanced {
        margin: 10px;
        padding: 15px;
    }
    
    .stack-info {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* OpenSeadragon Container */
.openseadragon-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Image Selector */
.image-selector {
    margin-top: 15px;
    text-align: center;
}

.image-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    min-width: 200px;
}

/* Additional Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}