/* Hotel Slider Captcha Styles - Optimized */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

/* Container Styles */
.hsc-captcha-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hsc-universal-captcha-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Модальное окно капчи */
.hsc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hsc-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.hsc-captcha-wrapper {
    width: 370px;
    min-height: auto;
    border-radius: 24px;
    background: #FFF;
    border: none;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    margin: 0 auto;
    transform: scale(0.8) translateY(50px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    max-height: 85vh;
    overflow: hidden;
}

.hsc-modal-overlay.show .hsc-captcha-wrapper {
    transform: scale(1) translateY(0);
}

/* Кнопка закрытия модального окна */
.hsc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #666;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
    margin: 0;
    outline: none;
    box-sizing: border-box;
}

.hsc-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
    transform: scale(1.1);
}

.hsc-modal-close:active {
    transform: scale(0.95);
}

.hsc-modal-close::before {
    content: '×';
    font-weight: bold;
    line-height: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    top: -1px; /* Смещаем крестик немного вверх для идеального центрирования */
}

/* Блокировка скролла body при открытом модальном окне */
body.hsc-modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Title */
.hsc-captcha-title {
    width: 299.231px;
    color: #333;
    text-align: center;
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 24.615px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    margin: 0 auto 16px auto;
}

/* Брендинг */
.hsc-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.hsc-brand img {
    max-width: 180px;
    height: auto;
    display: block;
}

/* Instruction */
.hsc-captcha-instruction {
    width: 254px;
    color: #606796;
    text-align: center;
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14.086px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    margin: 0 auto 24px auto;
}

/* Preview */
.hsc-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #fff;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loader state */
.hsc-preview.loading { position: relative; }
.hsc-preview.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.15);
    border-top-color: #2155FC;
    animation: hsc-spin 0.8s linear infinite;
    z-index: 3;
}
.hsc-preview.loading img.hsc-captcha-img { filter: blur(2px) brightness(0.92); opacity: 0.7; }
@keyframes hsc-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.hsc-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hsc-preview-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.15) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.15) 1px, transparent 1px);
    background-size: 
        calc(100% / 3) 100%,
        100% calc(100% / 2);
    mix-blend-mode: overlay;
    pointer-events: none;
}

/* Controls */
.hsc-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

/* Slider Container */
.hsc-slider-wrap {
    position: relative;
    margin: 0 auto 10px auto;
    padding-top: 9px;
    height: 49px;
    width: 276px;
    display: block;
}

/* Range Input */
#hsc-pos,
.hsc-pos,
input.hsc-pos,
input[class*="hsc-pos"],
.hsc-slider-wrap input,
.hsc-captcha-wrapper input[type="range"],
.hsc-universal-captcha-wrapper input[type="range"] {
    width: 276px !important;
    height: 22px !important;
    flex-shrink: 0 !important;
    border-radius: 50px !important;
    background: #DEE3EB !important;
    box-shadow: 0 0 4px 0 rgba(96, 103, 150, 0.25) inset !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    cursor: pointer !important;
    margin: 9px 0 24px 0 !important;
    outline: none !important;
    border: none !important;
    overflow: visible !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* WebKit Slider Track */
#hsc-pos::-webkit-slider-track,
.hsc-pos::-webkit-slider-track,
input.hsc-pos::-webkit-slider-track,
input[class*="hsc-pos"]::-webkit-slider-track,
.hsc-slider-wrap input::-webkit-slider-track,
.hsc-captcha-wrapper input[type="range"]::-webkit-slider-track,
.hsc-universal-captcha-wrapper input[type="range"]::-webkit-slider-track {
    height: 22px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 50px !important;
}

#hsc-pos::-webkit-slider-runnable-track,
.hsc-pos::-webkit-slider-runnable-track,
input.hsc-pos::-webkit-slider-runnable-track,
input[class*="hsc-pos"]::-webkit-slider-runnable-track,
.hsc-slider-wrap input::-webkit-slider-runnable-track,
.hsc-captcha-wrapper input[type="range"]::-webkit-slider-runnable-track,
.hsc-universal-captcha-wrapper input[type="range"]::-webkit-slider-runnable-track {
    height: 22px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 50px !important;
}

/* WebKit Slider Thumb */
#hsc-pos::-webkit-slider-thumb,
.hsc-pos::-webkit-slider-thumb,
input.hsc-pos::-webkit-slider-thumb,
input[class*="hsc-pos"]::-webkit-slider-thumb,
.hsc-slider-wrap input::-webkit-slider-thumb,
.hsc-captcha-wrapper input[type="range"]::-webkit-slider-thumb,
.hsc-universal-captcha-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 64px !important;
    height: 40px !important;
    margin-top: -9px !important;
    border-radius: 14px !important;
    background: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='20' viewBox='0 0 32 20' fill='none'%3E%3Cpath d='M8 6L4 10L8 14' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M24 6L28 10L24 14' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cline x1='12' y1='5' x2='12' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='16' y1='5' x2='16' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='20' y1='5' x2='20' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/32px 20px no-repeat,
        linear-gradient(90deg, #24BDFF 5.77%, #2155FC 157.69%) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(36, 189, 255, 0.3) !important;
    cursor: grab !important;
    position: relative !important;
    z-index: 10 !important;
}

#hsc-pos:active::-webkit-slider-thumb,
.hsc-pos:active::-webkit-slider-thumb,
input.hsc-pos:active::-webkit-slider-thumb,
input[class*="hsc-pos"]:active::-webkit-slider-thumb,
.hsc-slider-wrap input:active::-webkit-slider-thumb,
.hsc-captcha-wrapper input[type="range"]:active::-webkit-slider-thumb,
.hsc-universal-captcha-wrapper input[type="range"]:active::-webkit-slider-thumb {
    cursor: grabbing !important;
    box-shadow: 0 4px 12px rgba(36, 189, 255, 0.4) !important;
    transform: scale(1.05) !important;
}

/* Firefox Slider Track */
#hsc-pos::-moz-range-track,
.hsc-pos::-moz-range-track,
input.hsc-pos::-moz-range-track,
input[class*="hsc-pos"]::-moz-range-track,
.hsc-slider-wrap input::-moz-range-track,
.hsc-captcha-wrapper input[type="range"]::-moz-range-track,
.hsc-universal-captcha-wrapper input[type="range"]::-moz-range-track {
    height: 22px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 50px !important;
}

#hsc-pos::-moz-range-progress,
.hsc-pos::-moz-range-progress,
input.hsc-pos::-moz-range-progress,
input[class*="hsc-pos"]::-moz-range-progress,
.hsc-slider-wrap input::-moz-range-progress,
.hsc-captcha-wrapper input[type="range"]::-moz-range-progress,
.hsc-universal-captcha-wrapper input[type="range"]::-moz-range-progress {
    height: 22px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 50px !important;
}

/* Firefox Slider Thumb */
#hsc-pos::-moz-range-thumb,
.hsc-pos::-moz-range-thumb,
input.hsc-pos::-moz-range-thumb,
input[class*="hsc-pos"]::-moz-range-thumb,
.hsc-slider-wrap input::-moz-range-thumb,
.hsc-captcha-wrapper input[type="range"]::-moz-range-thumb,
.hsc-universal-captcha-wrapper input[type="range"]::-moz-range-thumb {
    width: 64px !important;
    height: 40px !important;
    border-radius: 14px !important;
    background: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='20' viewBox='0 0 32 20' fill='none'%3E%3Cpath d='M8 6L4 10L8 14' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M24 6L28 10L24 14' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cline x1='12' y1='5' x2='12' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='16' y1='5' x2='16' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='20' y1='5' x2='20' y2='15' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/32px 20px no-repeat,
        linear-gradient(90deg, #24BDFF 5.77%, #2155FC 157.69%) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(36, 189, 255, 0.3) !important;
    cursor: grab !important;
    margin-top: -9px !important;
    z-index: 10 !important;
}

#hsc-pos:active::-moz-range-thumb,
.hsc-pos:active::-moz-range-thumb,
input.hsc-pos:active::-moz-range-thumb,
input[class*="hsc-pos"]:active::-moz-range-thumb,
.hsc-slider-wrap input:active::-moz-range-thumb,
.hsc-captcha-wrapper input[type="range"]:active::-moz-range-thumb,
.hsc-universal-captcha-wrapper input[type="range"]:active::-moz-range-thumb {
    cursor: grabbing !important;
    box-shadow: 0 4px 12px rgba(36, 189, 255, 0.4) !important;
    transform: scale(1.05) !important;
}

/* Actions */
.hsc-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Button Styles */
.hsc-captcha-wrapper #hsc-verify-btn,
.hsc-universal-captcha-wrapper #hsc-verify-btn,
.hsc-captcha-wrapper .hsc-verify-btn,
.hsc-universal-captcha-wrapper .hsc-verify-btn,
#hsc-verify-btn,
.hsc-verify-btn {
    width: 276px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(90deg, #24BDFF 5.77%, #2155FC 157.69%) !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(36, 189, 255, 0.3) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: white !important;
    margin: 0 auto !important;
    display: block !important;
    padding: 0 !important;
    outline: none !important;
}

.hsc-captcha-wrapper #hsc-verify-btn:hover,
.hsc-universal-captcha-wrapper #hsc-verify-btn:hover,
.hsc-captcha-wrapper .hsc-verify-btn:hover,
.hsc-universal-captcha-wrapper .hsc-verify-btn:hover,
#hsc-verify-btn:hover,
.hsc-verify-btn:hover {
    background: linear-gradient(90deg, #1FA8FF 5.77%, #1A4AFF 157.69%) !important;
    box-shadow: 0 6px 16px rgba(36, 189, 255, 0.4) !important;
    transform: translateY(-2px) !important;
}

.hsc-captcha-wrapper #hsc-verify-btn:active,
.hsc-universal-captcha-wrapper #hsc-verify-btn:active,
.hsc-captcha-wrapper .hsc-verify-btn:active,
.hsc-universal-captcha-wrapper .hsc-verify-btn:active,
#hsc-verify-btn:active,
.hsc-verify-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(36, 189, 255, 0.3) !important;
}

.hsc-captcha-wrapper #hsc-verify-btn:disabled,
.hsc-universal-captcha-wrapper #hsc-verify-btn:disabled,
.hsc-captcha-wrapper .hsc-verify-btn:disabled,
.hsc-universal-captcha-wrapper .hsc-verify-btn:disabled,
#hsc-verify-btn:disabled,
.hsc-verify-btn:disabled {
    background: linear-gradient(90deg, #DADADA 5.77%, #979696 157.69%) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6 !important;
}

/* Status Messages - Improved Design */
.hsc-status {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* ВАЖНО: Принудительно скрываем статусные сообщения с атрибутом hidden */
.hsc-status[hidden],
.hsc-status[hidden=""],
.hsc-status[hidden="hidden"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.hsc-status::before {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    background-size: 12px 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.hsc-status.hsc-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: successPulse 0.6s ease-out;
}

.hsc-status.hsc-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E");
    background-color: rgba(255, 255, 255, 0.2);
}

.hsc-status.hsc-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: errorShake 0.6s ease-out;
}

.hsc-status.hsc-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z'/%3E%3C/svg%3E");
    background-color: rgba(255, 255, 255, 0.2);
}

/* Анимации для статусных сообщений */
@keyframes successPulse {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
        opacity: 0;
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
        opacity: 1;
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
        opacity: 1;
    }
}

/* Улучшенные стили для ошибок формы */
#hsc-form-error-captcha,
.hsc-form-error-captcha {
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: errorFadeIn 0.3s ease-out;
}

/* Принудительно скрываем ошибки с атрибутом hidden или style="display:none" */
#hsc-form-error-captcha[hidden],
#hsc-form-error-captcha[style*="display:none"],
#hsc-form-error-captcha[style*="display: none"],
.hsc-form-error-captcha[hidden],
.hsc-form-error-captcha[style*="display:none"],
.hsc-form-error-captcha[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#hsc-form-error-captcha::before,
.hsc-form-error-captcha::before {
    content: '⚠️';
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes errorFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ACADP Integration */
.acadp-form-group.hsc-captcha-container {
    margin-bottom: 20px;
}

.acadp-form-group .hsc-captcha-wrapper {
    margin-top: 8px;
}

.acadp-dark .hsc-slider-hint {
    color: #ccc;
}

.acadp-dark #hsc-pos::-webkit-slider-track,
.acadp-dark #hsc-pos::-moz-range-track {
    background: rgba(255,255,255,0.1);
}

/* Responsive Design */
@media (max-width: 480px) {
    .hsc-captcha-wrapper {
        width: 90%;
        max-width: 350px;
        padding: 20px;
        margin: 10px;
        min-height: auto;
        max-height: 90vh;
        overflow: hidden;
    }
    
    .hsc-modal-overlay {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }
    
    .hsc-captcha-title {
        width: auto;
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .hsc-captcha-instruction {
        width: auto;
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    #hsc-pos {
        width: 100% !important;
        max-width: 250px !important;
    }
    
    #hsc-verify-btn {
        width: 100% !important;
        max-width: 250px !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 380px) {
    #hsc-pos::-webkit-slider-thumb {
        width: 56px !important;
    }
    
    #hsc-pos::-moz-range-thumb {
        width: 56px !important;
    }
}