/**
 * VPE Slider CAPTCHA - Styles
 * 
 * 
 * @package VPE_Slider_Captcha
 * @version 1.0.0
 */

/* ============================================
   Container
   ============================================ */

.vpe-slider-captcha-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    
    /* CSS Variables for customization */
    --vpe-primary-color: #4CAF50;
    --vpe-secondary-color: #2196F3;
    --vpe-error-color: #f44336;
    --vpe-success-color: #4CAF50;
    --vpe-text-color: #333333;
    --vpe-bg-color: #f5f5f5;
    --vpe-track-height: 50px;
    --vpe-handle-size: 50px;
}

/* ============================================
   Track
   ============================================ */

.vpe-captcha-track {
    position: relative;
    width: 100%;
    height: var(--vpe-track-height, 50px);
    background: var(--vpe-bg-color, linear-gradient(to bottom, #f8f9fa, #e9ecef));
    border: 2px solid #dee2e6;
    border-radius: calc(var(--vpe-track-height, 50px) / 2);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.vpe-captcha-track-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--vpe-primary-color, #4CAF50), var(--vpe-success-color, #45a049));
    border-radius: calc(var(--vpe-track-height, 50px) / 2) 0 0 calc(var(--vpe-track-height, 50px) / 2);
    transition: background 0.3s ease;
}

.vpe-captcha-track-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--vpe-text-color, #6c757d);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.vpe-captcha-track-success {
    display: none;
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    z-index: 3;
    max-width: calc(100% - 70px);
    overflow: hidden;
    text-overflow: ellipsis;
    animation: slideInLeft 0.3s ease;
    line-height: 1.3;
}

.vpe-captcha-track-success .percentile-text {
    display: inline-block;
    margin-left: 4px;
    font-size: 9px;
    opacity: 0.95;
    font-weight: 600;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Hint Marker - визуальная метка целевой позиции */
.vpe-captcha-hint-marker {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #FF2C2C, #FF6B6B);
    border-radius: 2px;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
    z-index: 5;
    box-shadow: 0 0 8px rgba(255, 44, 44, 0.5);
    pointer-events: none;
}

.vpe-captcha-hint-marker::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #FF2C2C;
}

.vpe-captcha-hint-visible .vpe-captcha-hint-marker {
    opacity: 1;
    animation: pulse-hint 1.5s ease-in-out infinite;
}

@keyframes pulse-hint {
    0%, 100% {
        opacity: 0.6;
        transform: translateX(-50%) scaleY(1);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scaleY(1.05);
    }
}

/* ============================================
   Handle
   ============================================ */

.vpe-captcha-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--vpe-handle-size, 50px);
    height: var(--vpe-handle-size, 50px);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #dee2e6;
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 10;
}

.vpe-captcha-handle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vpe-captcha-handle-active {
    cursor: grabbing !important;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.vpe-captcha-icon {
    width: 24px;
    height: 24px;
    color: #6c757d;
    transition: color 0.3s ease;
}

.vpe-captcha-handle:hover .vpe-captcha-icon {
    color: #495057;
}

/* ============================================
   States
   ============================================ */

/* Dragging */
.vpe-captcha-dragging .vpe-captcha-track {
    border-color: var(--vpe-secondary-color, #2196F3);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.vpe-captcha-dragging .vpe-captcha-handle {
    border-color: var(--vpe-secondary-color, #2196F3);
}

/* Success */
.vpe-captcha-success .vpe-captcha-track {
    border-color: var(--vpe-success-color, #4CAF50);
    background: linear-gradient(to bottom, #e8f5e9, #c8e6c9);
}

.vpe-captcha-success .vpe-captcha-track-fill {
    background: linear-gradient(90deg, var(--vpe-success-color, #4CAF50), var(--vpe-primary-color, #66BB6A));
}

.vpe-captcha-success .vpe-captcha-handle {
    border-color: var(--vpe-success-color, #4CAF50);
    background: linear-gradient(135deg, var(--vpe-success-color, #4CAF50), var(--vpe-primary-color, #66BB6A));
    cursor: default;
}

.vpe-captcha-success .vpe-captcha-icon {
    color: #ffffff;
}

.vpe-captcha-success .vpe-captcha-track-success {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.vpe-captcha-success .vpe-captcha-track-success .percentile-text {
    color: rgba(255, 255, 255, 0.95);
}

/* Error */
.vpe-captcha-error .vpe-captcha-track {
    border-color: var(--vpe-error-color, #f44336);
    background: linear-gradient(to bottom, #ffebee, #ffcdd2);
    animation: shake 0.5s ease;
}

.vpe-captcha-error .vpe-captcha-track-fill {
    background: linear-gradient(90deg, #f44336, #e57373);
}

.vpe-captcha-error .vpe-captcha-handle {
    border-color: #f44336;
    animation: shake 0.5s ease;
}

/* Loading */
.vpe-captcha-loading-state .vpe-captcha-track {
    opacity: 0.6;
    pointer-events: none;
}

.vpe-captcha-loading-state .vpe-captcha-handle {
    pointer-events: none;
}

/* ============================================
   Message
   ============================================ */

.vpe-captcha-message {
    display: none;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease;
}

.vpe-captcha-message-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.vpe-captcha-message-success .percentile-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.9;
    font-weight: 600;
}

.vpe-captcha-message-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

/* ============================================
   Loading Spinner
   ============================================ */

.vpe-captcha-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

.vpe-captcha-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Modal
   ============================================ */

.vpe-captcha-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
}

.vpe-captcha-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.vpe-captcha-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 450px;
    animation: modalSlideIn 0.3s ease;
}

.vpe-captcha-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
}

.vpe-captcha-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.vpe-captcha-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.vpe-captcha-modal-close:hover {
    background: #f8f9fa;
    color: #212529;
}

.vpe-captcha-modal-body {
    padding: 24px;
}

/* ============================================
   Animations
   ============================================ */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    .vpe-slider-captcha-container {
        max-width: 100%;
        margin: 16px auto;
    }

    .vpe-captcha-track {
        height: 48px;
    }

    .vpe-captcha-handle {
        width: 48px;
        height: 48px;
    }

    .vpe-captcha-track-text {
        font-size: 13px;
    }

    .vpe-captcha-modal-content {
        width: 90%;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .vpe-slider-captcha-container {
        margin: 12px auto;
    }

    .vpe-captcha-track {
        height: 44px;
    }

    .vpe-captcha-handle {
        width: 44px;
        height: 44px;
    }

    .vpe-captcha-icon {
        width: 20px;
        height: 20px;
    }

    .vpe-captcha-track-text {
        font-size: 12px;
    }

    .vpe-captcha-track-success {
        font-size: 10px;
        left: 10px;
        max-width: calc(100% - 60px);
    }

    .vpe-captcha-track-success .percentile-text {
        font-size: 7px;
        margin-left: 3px;
    }

    .vpe-captcha-message {
        font-size: 12px;
        padding: 8px 12px;
    }

    .vpe-captcha-modal-content {
        width: 95%;
        border-radius: 12px;
    }

    .vpe-captcha-modal-header {
        padding: 16px 20px;
    }

    .vpe-captcha-modal-header h3 {
        font-size: 16px;
    }

    .vpe-captcha-modal-body {
        padding: 20px;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .vpe-captcha-track {
        height: 40px;
    }

    .vpe-captcha-handle {
        width: 40px;
        height: 40px;
    }

    .vpe-captcha-track-text {
        font-size: 11px;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .vpe-captcha-handle {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .vpe-captcha-track {
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .vpe-captcha-handle {
        width: 52px;
        height: 52px;
    }

    .vpe-captcha-track {
        height: 52px;
    }

    .vpe-captcha-handle:hover {
        transform: none;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .vpe-captcha-track {
        background: linear-gradient(to bottom, #2d3748, #1a202c);
        border-color: #4a5568;
    }

    .vpe-captcha-track-text {
        color: #a0aec0;
    }

    .vpe-captcha-handle {
        background: linear-gradient(135deg, #4a5568, #2d3748);
        border-color: #4a5568;
    }

    .vpe-captcha-icon {
        color: #a0aec0;
    }

    .vpe-captcha-modal-content {
        background: #1a202c;
    }

    .vpe-captcha-modal-header {
        border-bottom-color: #2d3748;
    }

    .vpe-captcha-modal-header h3 {
        color: #f7fafc;
    }

    .vpe-captcha-modal-close {
        color: #a0aec0;
    }

    .vpe-captcha-modal-close:hover {
        background: #2d3748;
        color: #f7fafc;
    }
}

/* Print Styles */
@media print {
    .vpe-slider-captcha-container {
        display: none;
    }
}

/* Accessibility */
.vpe-captcha-handle:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

.vpe-captcha-handle:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .vpe-captcha-track,
    .vpe-captcha-handle,
    .vpe-captcha-track-fill,
    .vpe-captcha-message,
    .vpe-captcha-modal-content {
        animation: none;
        transition: none;
    }
}

/* ============================================
   Global Notification
   ============================================ */

.vpe-captcha-global-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    max-width: 400px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.vpe-captcha-global-notification-show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.vpe-captcha-global-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #dc3545;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
}

.vpe-captcha-global-notification-success .vpe-captcha-global-notification-content {
    border-left-color: #28a745;
}

.vpe-captcha-global-notification-warning .vpe-captcha-global-notification-content {
    border-left-color: #ffc107;
}

.vpe-captcha-global-notification-info .vpe-captcha-global-notification-content {
    border-left-color: #17a2b8;
}

.vpe-captcha-global-notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #dc3545;
}

.vpe-captcha-global-notification-success .vpe-captcha-global-notification-icon {
    color: #28a745;
}

.vpe-captcha-global-notification-warning .vpe-captcha-global-notification-icon {
    color: #ffc107;
}

.vpe-captcha-global-notification-info .vpe-captcha-global-notification-icon {
    color: #17a2b8;
}

.vpe-captcha-global-notification-text {
    flex: 1;
    font-weight: 500;
}

.vpe-captcha-global-notification-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #6c757d;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vpe-captcha-global-notification-close:hover {
    color: #212529;
}

.vpe-captcha-global-notification-close:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .vpe-captcha-global-notification-content {
        background: #2d2d2d;
        color: #e9ecef;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .vpe-captcha-global-notification-close {
        color: #adb5bd;
    }
    
    .vpe-captcha-global-notification-close:hover {
        color: #e9ecef;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .vpe-captcha-global-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }
    
    .vpe-captcha-global-notification-content {
        padding: 14px 16px;
        font-size: 13px;
    }
}
