/**
 * Puzzle CAPTCHA Styles - Modal Version
 * Estilos para el componente de verificación puzzle slider en modal
 */

/* ========== Modal Styles ========== */
.captcha-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.captcha-modal.active {
    opacity: 1;
    visibility: visible;
}

.captcha-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.captcha-modal-content {
    position: relative;
    background: linear-gradient(145deg, #1a0a2e 0%, #0d0515 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 175, 55, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.captcha-modal.active .captcha-modal-content {
    transform: scale(1) translateY(0);
}

.captcha-modal-content.success {
    border-color: #38ef7d;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(56, 239, 125, 0.2);
}

.captcha-modal-content.error {
    border-color: #f5576c;
    animation: shake 0.5s ease;
}

.captcha-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.captcha-modal-close:hover {
    background: rgba(245, 87, 108, 0.2);
    color: #f5576c;
}

.captcha-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #d4af37;
    font-size: 1rem;
    font-weight: 500;
}

.captcha-modal-header i {
    font-size: 1.25rem;
}

.captcha-modal-body {
    text-align: center;
}

.captcha-instruction {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ========== Legacy Container Styles (for backwards compatibility) ========== */
.puzzle-captcha {
    background: linear-gradient(145deg, #1a0a2e 0%, #0d0515 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 1rem;
    max-width: 320px;
    margin: 0 auto;
    font-family: inherit;
}

.puzzle-captcha.success {
    border-color: #38ef7d;
    box-shadow: 0 0 15px rgba(56, 239, 125, 0.2);
}

.puzzle-captcha.error {
    border-color: #f5576c;
    animation: shake 0.5s ease;
}

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

/* Header */
.puzzle-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.puzzle-header i {
    color: #d4af37;
    font-size: 1rem;
}

/* Canvas Container */
.puzzle-canvas-container {
    position: relative;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
}

.puzzle-bg {
    display: block;
    border-radius: 8px;
}

.puzzle-piece {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    transition: none;
}

.puzzle-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 10, 46, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4af37;
    font-size: 1.5rem;
}

.puzzle-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Slider */
.puzzle-slider-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.puzzle-slider-track {
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.puzzle-slider-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.3), rgba(156, 39, 176, 0.3));
    border-radius: 20px;
    transition: none;
}

.puzzle-captcha.success .puzzle-slider-fill {
    background: linear-gradient(90deg, rgba(56, 239, 125, 0.4), rgba(17, 153, 142, 0.4));
}

.puzzle-slider-handle {
    position: absolute;
    top: 2px;
    left: 0;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #d4af37, #f0d78c);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a0a2e;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 2;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.puzzle-slider-handle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.puzzle-slider-handle.active {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.5);
}

.puzzle-captcha.success .puzzle-slider-handle {
    background: linear-gradient(135deg, #38ef7d, #11998e);
}

.puzzle-slider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

/* Status */
.puzzle-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 24px;
}

.puzzle-status-text {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.puzzle-captcha.success .puzzle-status-text {
    color: #38ef7d;
}

.puzzle-captcha.error .puzzle-status-text {
    color: #f5576c;
}

.puzzle-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.5);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.puzzle-refresh:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: #d4af37;
}

.puzzle-refresh:active i {
    animation: spin 0.5s ease;
}

/* Modal version refresh button */
.captcha-modal .puzzle-refresh {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    width: auto;
    height: auto;
    display: inline-flex;
    gap: 0.25rem;
}

/* Modal success/error states for status text */
.captcha-modal-content.success .puzzle-status-text {
    color: #38ef7d;
}

.captcha-modal-content.error .puzzle-status-text {
    color: #f5576c;
}

.captcha-modal-content.success .puzzle-slider-fill {
    background: linear-gradient(90deg, rgba(56, 239, 125, 0.4), rgba(17, 153, 142, 0.4));
}

.captcha-modal-content.success .puzzle-slider-handle {
    background: linear-gradient(135deg, #38ef7d, #11998e);
}

/* ========== Verify Button Styles ========== */
.btn-captcha-verify {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(156, 39, 176, 0.15));
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #d4af37;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-captcha-verify:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(156, 39, 176, 0.25));
    border-color: rgba(212, 175, 55, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.btn-captcha-verify.verified {
    background: linear-gradient(135deg, rgba(56, 239, 125, 0.2), rgba(17, 153, 142, 0.2));
    border-color: #38ef7d;
    color: #38ef7d;
    cursor: default;
}

.btn-captcha-verify.verified:hover {
    transform: none;
    box-shadow: none;
}

.btn-captcha-submit {
    background: linear-gradient(135deg, #d4af37, #9c27b0);
    border: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-captcha-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.btn-captcha-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 360px) {
    .puzzle-captcha {
        padding: 0.75rem;
    }

    .puzzle-header {
        font-size: 0.8rem;
    }

    .puzzle-slider-text {
        font-size: 0.75rem;
    }
}

/* Widget Version (más compacto para sidebars) */
.puzzle-captcha.compact {
    padding: 0.75rem;
}

.puzzle-captcha.compact .puzzle-header {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.puzzle-captcha.compact .puzzle-slider-track {
    height: 36px;
}

.puzzle-captcha.compact .puzzle-slider-handle {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

/* Modal responsive */
@media (max-width: 360px) {
    .captcha-modal-content {
        padding: 1rem;
    }

    .captcha-modal-header {
        font-size: 0.9rem;
    }

    .captcha-instruction {
        font-size: 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: light) {
    .puzzle-captcha {
        background: linear-gradient(145deg, #f5f5f5 0%, #e0e0e0 100%);
        border-color: rgba(106, 27, 154, 0.3);
    }

    .puzzle-header {
        color: #333;
    }

    .puzzle-slider-text {
        color: rgba(0, 0, 0, 0.4);
    }
}
