/* Shared styles for the on-device AI tools (remove-bg, transcribe, ocr). */
.ai-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--accent-color);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    margin: 0.25rem 0 1rem;
    max-width: 100%;
}

.ai-drop {
    margin-top: 0.5rem;
}

.ai-drop strong {
    color: var(--text-primary);
}

.ai-drop input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ai-loader h2 {
    margin-bottom: 0.5rem;
}

.ai-loader p {
    margin: 0.35rem 0;
}

.ai-progress {
    margin-top: 0.75rem;
}

.ai-bar {
    height: 10px;
    border-radius: 999px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.ai-bar span {
    display: block;
    height: 100%;
    width: 0;
    background-color: var(--accent-color);
    transition: width 0.2s ease;
}

.ai-bar.indeterminate span {
    width: 35%;
    animation: ai-slide 1.2s ease-in-out infinite;
}

@keyframes ai-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

@media (prefers-reduced-motion: reduce) {
    .ai-bar.indeterminate span { animation: none; width: 100%; opacity: 0.5; }
}

.ai-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    min-height: 1.2rem;
    overflow-wrap: anywhere;
}

.ai-footnote {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    line-height: 1.5;
}

.ai-footnote a {
    color: var(--accent-color);
}

/* Image stage with a transparency checkerboard */
.ai-stage {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.ai-stage canvas,
.ai-stage img {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 70vh;
}

.ai-stage .ai-before {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.ai-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background-color: var(--accent-color);
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.ai-compare-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ai-compare-row input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--accent-color);
}

.ai-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
}

.ai-options label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
}

.ai-options input[type="color"] {
    width: 2.5rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}

.ai-options input[type="range"] {
    width: 8rem;
    accent-color: var(--accent-color);
}

.ai-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}

.ai-rec {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.ai-rec-time {
    font-variant-numeric: tabular-nums;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-rec-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background-color: #e53935;
    animation: ai-pulse 1s ease-in-out infinite;
}

@keyframes ai-pulse {
    50% { opacity: 0.3; }
}

.ai-audio {
    width: 100%;
    margin-top: 0.75rem;
}

.ai-output {
    max-height: 26rem;
}

textarea.ai-output {
    display: block;
    width: 100%;
    min-height: 10rem;
    color: var(--text-primary);
    resize: vertical;
    box-sizing: border-box;
}
