#loading {
    position: fixed;
    z-index: 50000;
    /* Inline SVG centered */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.9); /* Light overlay */
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    transform: translateZ(0); /* Enable hardware acceleration */
}

.dark #loading {
    background-color: #0a0a0a;
}

#loading.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.pdf-export-control {
    position: relative;
}

.pdf-export-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    border: 1px solid color-mix(in srgb, var(--theme-primary-500) 35%, transparent);
    background: color-mix(in srgb, var(--theme-primary-500) 8%, transparent);
    color: var(--theme-primary-500);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.pdf-export-button:hover,
.pdf-export-button:focus-visible {
    background: color-mix(in srgb, var(--theme-primary-500) 15%, transparent);
    box-shadow: 0 10px 25px color-mix(in srgb, var(--theme-primary-500) 15%, transparent);
    outline: none;
}

.pdf-export-button:active {
    transform: scale(0.97);
}

.dark .pdf-export-button {
    border-color: color-mix(in srgb, var(--theme-primary-400) 30%, transparent);
    background: color-mix(in srgb, var(--theme-primary-400) 12%, transparent);
    color: var(--theme-primary-400);
}

.dark .pdf-export-button:hover,
.dark .pdf-export-button:focus-visible {
    background: color-mix(in srgb, var(--theme-primary-400) 20%, transparent);
    box-shadow: 0 10px 25px color-mix(in srgb, var(--theme-primary-400) 20%, transparent);
}

.pdf-export-button--loading {
    cursor: progress;
    pointer-events: none;
}

/* Icon and loader container */
.pdf-export-icon,
.pdf-export-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Pure CSS Spinner - optimized for smooth animation during heavy JS work */
.pdf-export-spinner {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-block;
    border: 2.5px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: pdf-export-spin 0.8s linear infinite;
    /* Force GPU acceleration - critical for smooth animation */
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes pdf-export-spin {
    0% {
        transform: rotate(0deg) translateZ(0);
    }
    100% {
        transform: rotate(360deg) translateZ(0);
    }
}
