/* Optimized Turnstile Container Styles */
.turnstile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    min-height: 80px;
    position: relative;
}

.turnstile-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Turnstile Loading State */
.turnstile-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.9rem;
    padding: 1rem;
    width: 100%;
}

.turnstile-loading .spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 2px;
    color: #3b82f6;
}

.turnstile-loading .ms-2 {
    margin-left: 0.5rem;
}

/* Cloudflare Turnstile Widget */
.cf-turnstile {
    margin: 0.5rem 0;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Turnstile Error State */
.turnstile-error {
    display: none;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.turnstile-error i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Turnstile Offline State */
.turnstile-offline {
    display: none;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    background: #fffbeb;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.turnstile-offline i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.connection-indicator {
    display: flex;
    align-items: center;
}

.connection-indicator i {
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

/* Turnstile Success State */
.turnstile-container.verified {
    border-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.turnstile-container.verified::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 14px;
    z-index: -1;
    opacity: 0.3;
}

/* Turnstile Failed State */
.turnstile-container.failed {
    border-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .turnstile-container {
        padding: 0.75rem;
        min-height: 70px;
    }
    
    .turnstile-loading,
    .turnstile-error,
    .turnstile-offline {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .connection-status {
        top: 10px;
        right: 10px;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .turnstile-container {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        border-color: #475569;
        color: #e2e8f0;
    }
    
    .turnstile-container:hover {
        border-color: #64748b;
    }
    
    .turnstile-loading {
        color: #cbd5e1;
    }
    
    .turnstile-error {
        background: #450a0a;
        border-color: #991b1b;
        color: #fca5a5;
    }
    
    .turnstile-offline {
        background: #451a03;
        border-color: #a16207;
        color: #fcd34d;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .turnstile-container {
        border-width: 3px;
    }
    
    .turnstile-error,
    .turnstile-offline {
        border-width: 2px;
        font-weight: 600;
    }
}