/**
 * This file is part of ACaptcha.
 *
 * Licensed under The MIT License
 *
 * @author Hassan Mousavi
 */

.captcha-box,
.captcha-box * {
    box-sizing: border-box;
}

.captcha-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    color: #374151;
    text-align: start;
}

.captcha-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    margin: 0;
    padding: 8px 10px;
}

.captcha-checkbox .aCaptchaShow {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
}

.captcha-checkbox label {
    flex: 1 1 auto;
    margin: 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
}

.a-captcha-refresh {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.a-captcha-refresh:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.a-captcha-refresh:focus-visible,
.captcha-checkbox .aCaptchaShow:focus-visible,
.drag-verify-mask:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.a-captcha-refresh:disabled {
    cursor: wait;
    opacity: 0.65;
}

.a-captcha-refresh svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.a-captcha-refresh.is-loading svg {
    animation: a-captcha-spin 800ms linear infinite;
}

.a-captcha-status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.drag-verify-root {
    position: absolute;
    z-index: 99999;
    inset-inline-start: 0;
    top: calc(100% + 8px);
    max-width: min(100%, calc(100vw - 32px));
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.drag-verify-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
    background: #e2e8f0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.drag-verify-bg {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: fill;
    pointer-events: none;
}

.drag-verify-mask,
.drag-verify-path {
    position: absolute;
    margin: 0;
    padding: 0;
}

.drag-verify-mask {
    z-index: 100;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
}

.drag-verify-mask.is-dragging {
    cursor: grabbing;
}

.drag-verify-path {
    z-index: 50;
    fill: none;
    stroke: #fde047;
    stroke-width: 1;
    pointer-events: none;
}

.drag-verify-footer {
    display: flex;
    align-items: stretch;
    min-height: 38px;
    border-radius: 0 0 6px 6px;
    background-color: #fff;
}

.drag-verify-note {
    flex: 1 1 auto;
    min-height: 38px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 0 0 6px 6px;
    background-color: #fff;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    line-height: 22px;
    letter-spacing: 0;
    text-align: center;
}

.drag-verify-refresh {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-inline-start: 1px solid #e2e8f0;
    border-radius: 0 0 6px 0;
    background: #f8fafc;
    color: #334155;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

[dir="rtl"] .drag-verify-refresh {
    border-right: 1px solid #e2e8f0;
    border-left: 0;
    border-radius: 0 0 0 6px;
}

.drag-verify-refresh:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.drag-verify-refresh:focus-visible {
    position: relative;
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: -3px;
}

.drag-verify-note.is-success {
    background-color: #16a34a;
    color: #fff;
}

.drag-verify-note.is-error {
    background-color: #dc2626;
    color: #fff;
}

@keyframes a-captcha-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {
    .captcha-box {
        max-width: 100%;
    }

    .captcha-checkbox {
        gap: 8px;
        min-height: 60px;
        padding: 8px;
    }

    .captcha-checkbox label {
        font-size: 15px;
    }

    .a-captcha-refresh {
        padding: 8px;
    }

    .a-captcha-refresh-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .drag-verify-root {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        width: calc(100vw - 32px) !important;
        max-width: 360px;
        transform: translate(-50%, -50%);
    }

    .drag-verify-note {
        min-height: 44px;
        padding: 10px;
        font-size: 15px;
        line-height: 24px;
    }

    .drag-verify-refresh {
        flex-basis: 48px;
        min-width: 48px;
        min-height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .a-captcha-refresh {
        transition: none;
    }

    .a-captcha-refresh.is-loading svg {
        animation-duration: 1600ms;
    }
}
