/**
 * ShadowBoard 2.0 - Glyph CAPTCHA CSS
 * Ancient symbols. Quantum effects. No Google.
 */

/* ============================================================================
   CAPTCHA CONTAINER
   ============================================================================ */

.captcha-container {
    background: linear-gradient(180deg, #0a0000 0%, #050000 100%);
    border: 2px solid var(--accent-crimson);
    padding: 15px;
    margin: 15px 0;
    position: relative;
    box-shadow: 
        0 0 30px rgba(255, 0, 51, 0.3),
        inset 0 0 30px rgba(255, 0, 51, 0.05);
    animation: captcha-container-pulse 3s ease-in-out infinite;
}

@keyframes captcha-container-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 51, 0.3); }
    50% { box-shadow: 0 0 50px rgba(255, 0, 51, 0.5), 0 0 80px rgba(255, 102, 0, 0.2); }
}

.captcha-header {
    text-align: center;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.captcha-icon {
    font-size: 1.3em;
    color: var(--accent-crimson);
    animation: glyph-float 2s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(255, 0, 51, 0.8);
}

@keyframes glyph-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.captcha-title {
    color: var(--accent-crimson);
    font-size: 0.85em;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.6);
    animation: title-flicker 4s ease-in-out infinite;
}

@keyframes title-flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.4; }
    94% { opacity: 1; }
    96% { opacity: 0.6; }
    97% { opacity: 1; }
}

.captcha-instruction {
    text-align: center;
    color: #888;
    font-size: 0.75em;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.chain-highlight {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1em;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    animation: chain-glow 1.5s ease-in-out infinite alternate;
}

@keyframes chain-glow {
    0% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    100% { text-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 102, 0, 0.5); }
}

/* ============================================================================
   CAPTCHA GRID
   ============================================================================ */

.captcha-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 200px;
    margin: 0 auto 12px auto;
}

.captcha-cell {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #111 0%, #0a0a0a 100%);
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    animation: cell-idle 4s ease-in-out infinite;
}

@keyframes cell-idle {
    0%, 100% { 
        transform: translate(0); 
    }
    25% { 
        transform: translate(0.5px, -0.5px); 
    }
    50% { 
        transform: translate(-0.5px, 0.5px); 
    }
    75% { 
        transform: translate(0.5px, 0.5px); 
    }
}

.captcha-cell:hover {
    border-color: var(--accent-crimson);
    background: linear-gradient(135deg, #1a0a0a 0%, #0f0505 100%);
    box-shadow: 0 0 20px rgba(255, 0, 51, 0.3);
    animation: cell-hover-glitch 0.3s ease-in-out infinite;
}

@keyframes cell-hover-glitch {
    0%, 100% { 
        transform: translate(0); 
        filter: none;
    }
    25% { 
        transform: translate(-1px, 1px); 
        filter: hue-rotate(20deg);
    }
    50% { 
        transform: translate(1px, -1px); 
        filter: brightness(1.2);
    }
    75% { 
        transform: translate(-1px, -1px); 
        filter: hue-rotate(-20deg);
    }
}

/* Digital scan on hover */
.captcha-cell::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 0, 51, 0.1) 50%,
        transparent 100%
    );
    transform: translateY(-100%);
    pointer-events: none;
}

.captcha-cell:hover::after {
    animation: cell-scan 0.8s linear infinite;
}

@keyframes cell-scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Selected state */
.captcha-cell.selected {
    border-color: #00ff41;
    background: linear-gradient(135deg, #0a1a0a 0%, #051005 100%);
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.4),
        inset 0 0 15px rgba(0, 255, 65, 0.1);
    animation: cell-selected 0.5s ease-in-out infinite alternate;
}

@keyframes cell-selected {
    0% { 
        box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
        transform: scale(1);
    }
    100% { 
        box-shadow: 0 0 25px rgba(0, 255, 65, 0.5), 0 0 40px rgba(0, 255, 65, 0.2);
        transform: scale(1.02);
    }
}

.captcha-cell.selected::before {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.5em;
    color: #00ff41;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.8);
}

/* ============================================================================
   STATUS & CONTROLS
   ============================================================================ */

.captcha-status {
    text-align: center;
    font-size: 0.75em;
    padding: 6px;
    margin-bottom: 8px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.captcha-status.loading {
    color: #ff6600;
    animation: status-pulse 1s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.captcha-status.ready {
    color: #888;
}

.captcha-status.success {
    color: #00ff41;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    animation: success-glow 1s ease-in-out infinite alternate;
}

@keyframes success-glow {
    0% { text-shadow: 0 0 10px rgba(0, 255, 65, 0.5); }
    100% { text-shadow: 0 0 20px rgba(0, 255, 65, 0.8); }
}

.captcha-status.error {
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.captcha-refresh {
    display: block;
    margin: 0 auto;
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 5px 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.captcha-refresh:hover {
    border-color: var(--accent-crimson);
    color: var(--accent-crimson);
    text-shadow: 0 0 10px rgba(255, 0, 51, 0.5);
    box-shadow: 0 0 15px rgba(255, 0, 51, 0.2);
}

/* ============================================================================
   DISABLED SUBMIT BUTTON
   ============================================================================ */

.btn-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    border-color: #333;
    color: #444;
    animation: none;
}

.btn-ghost:disabled:hover {
    box-shadow: none;
    transform: none;
}
