/* Circular Action Buttons */
.btn-circle {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-circle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.btn-circle i,
.btn-circle svg {
    pointer-events: none;
}

/* Unify Accordion Tools Circular buttons with Close Button style */
.accordion-tools .btn.btn-circle {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: #64748b !important;
}

[data-theme="dark"] .accordion-tools .btn.btn-circle {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

.circle-close-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.circle-close-btn:hover {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    transform: scale(1.1);
    z-index: 20 !important;
    position: relative !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .circle-close-btn {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .circle-close-btn.btn-delete {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

[data-theme="dark"] .circle-close-btn:hover {
    background-color: #334155 !important;
    color: #fff !important;
}

/* Image Zoom Lightbox */
.image-zoom-overlay {
    visibility: hidden;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    backface-visibility: hidden;
    perspective: 1000px;
}

.image-zoom-overlay.active {
    visibility: visible;
    opacity: 1;
}

.image-zoom-box {
    background: var(--bg-primary);
    padding: 8px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    max-width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.8) translateY(20px) translateZ(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backface-visibility: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .image-zoom-box {
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
}

.image-zoom-overlay.active .image-zoom-box {
    transform: scale(1) translateY(0) translateZ(0);
}

.expanded-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
    display: block;
    object-fit: contain;
    backface-visibility: hidden;
    -webkit-user-drag: none;
}

.overlay-close-btn {
    position: absolute !important;
    top: -12px !important;
    left: -12px !important;
    right: auto !important;
    background: #fff !important;
    color: #1a1a1a !important;
    z-index: 10001 !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
    transform: none !important;
    /* Prevent parent scale/conflict shaking */
    transform-origin: center center;
}

.overlay-close-btn:hover {
    background: #f1f5f9 !important;
    position: absolute !important;
    /* Override global relative !important */
    transform: none !important;
    /* Kill the scale to stop shaking */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6) !important;
}

.preview-image-expandable:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}