/* static/frontend/css/captcha.css */

/* Скрытые по умолчанию сообщения капчи */
.captcha-error-msg,
.captcha-blocked-msg {
    display: none;
    text-align: center;
    font-weight: 500;
    padding: 5px;
}

.captcha-error-msg {
    color: #f87171;
}

.captcha-blocked-msg {
    color: #ef4444;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.captcha-error-msg.visible,
.captcha-blocked-msg.visible {
    display: block;
}

.slider-captcha-container {
    max-width: 100%;
    overflow: hidden;
}

.captcha-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.captcha-box img {
    width: 100%;
    height: auto;
    aspect-ratio: 400 / 250;
    object-fit: cover;
    display: block;
}

.captcha-puzzle {
    position: absolute;
    top: 0;
    left: 0;
    width: 62px;
    height: 62px;
    background-size: cover;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 5;
    transition: left 0.05s linear;
}

.captcha-frame {
    position: absolute;
    width: 68px;
    height: 68px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 9;
    transition: left 0.05s linear;
}

.slider-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    height: 40px;
    background: #374151;
    border-radius: 20px;
    border: 1px solid #4b5563;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.slider-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-text {
    font-size: 14px;
    color: #9ca3af;
    pointer-events: none;
}

.slider-success {
    display: none;
    font-size: 14px;
    color: #34d399;
    pointer-events: none;
}

.captcha-success .slider-text { display: none; }
.captcha-success .slider-success { display: inline; }

.slider-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(52, 211, 153, 0.3);
    border-radius: 20px;
    pointer-events: none;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 50%;
    border: 2px solid #3b82f6;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #3b82f6;
    z-index: 10;
    touch-action: none;
}

.slider-button:active { cursor: grabbing; }

.captcha-success .slider-button {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.captcha-error .slider-button {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.captcha-error-msg {
    text-align: center;
    font-weight: 500;
    padding: 5px;
    color: #f87171;
}

.captcha-blocked-msg {
    color: #ef4444;
    font-weight: 500;
    text-align: center;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Модальное окно капчи */
.captcha-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.captcha-modal-overlay.is-open {
    display: flex;
}

.captcha-modal {
    background: #1f2937;
    border-radius: 12px;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.captcha-modal h2 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #fff;
}

.captcha-close-btn {
    width: 100%;
    margin-top: 16px;
    background: #4b5563;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.captcha-close-btn:hover {
    background: #6b7280;
}

@media (max-width: 480px) {
    .captcha-box { max-width: 100%; aspect-ratio: 400 / 250; }
    .captcha-puzzle { width: 50px; height: 50px; background-size: 50px 50px !important; }
    .captcha-frame { width: 56px; height: 56px; background-size: 100% 100% !important; }
    .slider-container { max-width: 100%; height: 44px; border-radius: 22px; }
    .slider-button { width: 36px; height: 36px; font-size: 20px; left: 6px; }
    .slider-text, .slider-success { font-size: 12px; }
}