/* ==========================================================================
   IIITIHAS UNIVERSAL - Cloudflare Turnstile Verification Component
   ========================================================================== */

/* Outer container wrapper */
.cf-turnstile-wrapper,
.security-check-card {
    display: block !important;
    width: 100% !important;
    max-width: 320px !important;
    margin: 12px 0 16px 0 !important;
    clear: both !important;
}

.security-check-subtitle {
    display: none !important;
}

/* Authentic Cloudflare Turnstile Widget Box */
.cf-turnstile-box,
.turnstile-box,
.recaptcha-wrapper {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 0 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 300px !important;
    max-width: 100% !important;
    height: 65px !important;
    min-height: 65px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    position: relative !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

/* Error / Required Shake State */
.cf-turnstile-box.recaptcha-error,
.turnstile-box.recaptcha-error,
.recaptcha-wrapper.recaptcha-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: cfShake 0.4s ease-in-out !important;
}

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

/* Left Main Interactive Section (Checkbox + Text) */
.cf-turnstile-left,
.turnstile-left,
.recaptcha-main {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    cursor: pointer !important;
    height: 100% !important;
    flex: 1 !important;
    min-width: 0 !important;
}

/* Checkbox Container */
.cf-turnstile-checkbox-wrapper,
.recaptcha-checkbox-container {
    width: 26px !important;
    height: 26px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Default Idle Checkbox */
.cf-turnstile-checkbox,
.turnstile-checkbox,
.recaptcha-checkbox {
    width: 24px !important;
    height: 24px !important;
    border: 2px solid #94a3b8 !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.cf-turnstile-left:hover .cf-turnstile-checkbox,
.turnstile-left:hover .turnstile-checkbox,
.recaptcha-main:hover .recaptcha-checkbox {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12) !important;
}

/* Spinner during verification */
.cf-turnstile-spinner,
.turnstile-spinner-wrapper,
.recaptcha-spinner {
    width: 24px !important;
    height: 24px !important;
    position: relative !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.cf-turnstile-spinner-ring,
.recaptcha-spinner-ring {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    border: 2.5px solid #ffedd5 !important;
    border-top-color: #f97316 !important;
    animation: cfSpin 0.7s linear infinite !important;
    box-sizing: border-box !important;
}

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

/* Success Checkmark */
.cf-turnstile-success,
.turnstile-success-wrapper,
.recaptcha-checkmark {
    width: 26px !important;
    height: 26px !important;
    position: relative !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.cf-check-svg,
.recaptcha-check-svg {
    width: 24px !important;
    height: 24px !important;
    display: block !important;
    animation: cfPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes cfPop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Middle Text Container */
.cf-turnstile-text-container {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    flex: 1 !important;
    min-width: 0 !important;
    line-height: 1.25 !important;
}

.cf-label-idle,
.turnstile-label,
.recaptcha-label {
    color: #1f2937 !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    letter-spacing: -0.1px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
}

.cf-label-verifying {
    color: #4b5563 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: none !important;
    white-space: nowrap !important;
}

.cf-label-verified {
    color: #059669 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: none !important;
    white-space: nowrap !important;
}

/* Right Side: Cloudflare Turnstile Branding */
.cf-turnstile-brand,
.turnstile-right,
.recaptcha-badge {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 76px !important;
    min-width: 76px !important;
    text-align: center !important;
    pointer-events: auto !important;
    flex-shrink: 0 !important;
    border-left: 1px solid #f1f5f9 !important;
    padding-left: 8px !important;
}

.cf-brand-logo,
.turnstile-brand-logo,
.recaptcha-logo-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 2px !important;
}

.cf-brand-name {
    font-size: 9px !important;
    font-weight: 800 !important;
    color: #475569 !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    line-height: 1 !important;
}

.cf-brand-links,
.turnstile-links,
.recaptcha-links {
    margin-top: 3px !important;
    font-size: 8px !important;
    color: #94a3b8 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.cf-brand-links a,
.turnstile-links a,
.recaptcha-links a {
    color: #64748b !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}

.cf-brand-links a:hover,
.turnstile-links a:hover,
.recaptcha-links a:hover {
    color: #ea580c !important;
    text-decoration: underline !important;
}

.cf-bullet {
    color: #cbd5e1 !important;
    font-size: 8px !important;
}

/* ==========================================================================
   STATE TRANSITIONS (MUTUALLY EXCLUSIVE DISPLAY - NO OVERLAPPING!)
   ========================================================================== */

/* State: IDLE */
[data-state="idle"] .cf-turnstile-checkbox,
[data-state="idle"] .turnstile-checkbox,
[data-state="idle"] .recaptcha-checkbox { display: flex !important; }

[data-state="idle"] .cf-turnstile-spinner,
[data-state="idle"] .turnstile-spinner-wrapper,
[data-state="idle"] .recaptcha-spinner { display: none !important; }

[data-state="idle"] .cf-turnstile-success,
[data-state="idle"] .turnstile-success-wrapper,
[data-state="idle"] .recaptcha-checkmark { display: none !important; }

[data-state="idle"] .cf-label-idle { display: block !important; }
[data-state="idle"] .cf-label-verifying { display: none !important; }
[data-state="idle"] .cf-label-verified { display: none !important; }

/* State: VERIFYING */
[data-state="verifying"] .cf-turnstile-checkbox,
[data-state="verifying"] .turnstile-checkbox,
[data-state="verifying"] .recaptcha-checkbox { display: none !important; }

[data-state="verifying"] .cf-turnstile-spinner,
[data-state="verifying"] .turnstile-spinner-wrapper,
[data-state="verifying"] .recaptcha-spinner { display: flex !important; }

[data-state="verifying"] .cf-turnstile-success,
[data-state="verifying"] .turnstile-success-wrapper,
[data-state="verifying"] .recaptcha-checkmark { display: none !important; }

[data-state="verifying"] .cf-label-idle { display: none !important; }
[data-state="verifying"] .cf-label-verifying { display: block !important; }
[data-state="verifying"] .cf-label-verified { display: none !important; }

/* State: VERIFIED */
[data-state="verified"] .cf-turnstile-checkbox,
[data-state="verified"] .turnstile-checkbox,
[data-state="verified"] .recaptcha-checkbox { display: none !important; }

[data-state="verified"] .cf-turnstile-spinner,
[data-state="verified"] .turnstile-spinner-wrapper,
[data-state="verified"] .recaptcha-spinner { display: none !important; }

[data-state="verified"] .cf-turnstile-success,
[data-state="verified"] .turnstile-success-wrapper,
[data-state="verified"] .recaptcha-checkmark { display: flex !important; }

[data-state="verified"] .cf-label-idle { display: none !important; }
[data-state="verified"] .cf-label-verifying { display: none !important; }
[data-state="verified"] .cf-label-verified { display: block !important; }

.cf-turnstile-box[data-state="verified"],
.turnstile-box[data-state="verified"],
.recaptcha-wrapper[data-state="verified"] {
    background-color: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
}

/* Hide old retry button & subtitle */
.security-retry-btn,
.security-check-footer {
    display: none !important;
}

/* Modal dialog support */
.security-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.security-modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    padding: 28px 24px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.security-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

