/**
 * ============================================================================
 * Calculator Security Captcha Shield - CSS Stylesheet
 * Government Polytechnic Khagaria (gpkhagaria.ac.in)
 * High-Tech Interactive Cyber-Gatekeeper & Bot Protection
 * ============================================================================
 */

/* ── Prevent content flash & scroll lock while locked ──────────────────── */
html.gp-captcha-locked {
    overflow: hidden !important;
    height: 100% !important;
}

html.gp-captcha-locked body {
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none;
}

html.gp-captcha-locked .gpk-h21-wrapper,
html.gp-captcha-locked .page-content-wrapper,
html.gp-captcha-locked #college-main-footer,
html.gp-captcha-locked .gpa-floating-social,
html.gp-captcha-locked .exact-floating-tab-wrap,
html.gp-captcha-locked .floating-theme-switch {
    filter: blur(14px) brightness(0.65) !important;
    pointer-events: none !important;
    user-select: none !important;
    transition: filter 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s ease;
}

/* ── Fullscreen Barrier Container ───────────────────────────────────────── */
#gp-calc-captcha-barrier {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483647; /* Highest possible layer */
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 45%, #0b1528 0%, #030712 100%);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.55s ease,
                filter 0.55s ease;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#gp-calc-captcha-barrier.gp-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(1.05) translateY(-20px) !important;
    filter: blur(12px) !important;
}

/* ── Background Particle Canvas ────────────────────────────────────────── */
#gp-calc-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ── Confetti Canvas ───────────────────────────────────────────────────── */
#gp-calc-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

/* ── Ambient Glowing Cyber Orbs ────────────────────────────────────────── */
.calc-ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.28;
    pointer-events: none;
    z-index: 2;
    animation: orbPulse 8s ease-in-out infinite alternate;
}

.calc-orb-1 {
    width: 380px;
    height: 380px;
    background: #0284c7;
    top: -100px;
    left: 10%;
}

.calc-orb-2 {
    width: 420px;
    height: 420px;
    background: #059669;
    bottom: -120px;
    right: 10%;
    animation-delay: -4s;
}

.calc-orb-3 {
    width: 300px;
    height: 300px;
    background: #7c3aed;
    top: 40%;
    left: 60%;
    animation-delay: -2s;
}

@keyframes orbPulse {
    0% { transform: scale(1) translate(0, 0); opacity: 0.22; }
    50% { transform: scale(1.15) translate(20px, -20px); opacity: 0.35; }
    100% { transform: scale(0.95) translate(-20px, 20px); opacity: 0.25; }
}

/* ── Central Main Card ─────────────────────────────────────────────────── */
.calc-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    margin: auto;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 24px;
    box-shadow: 0 25px 70px -10px rgba(0, 0, 0, 0.85),
                0 0 50px rgba(2, 132, 199, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    padding: 22px 20px 18px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: center center;
}

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Card Header & College Emblem ──────────────────────────────────────── */
.calc-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.calc-emblem-wrap {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.calc-emblem-radar {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed rgba(56, 189, 248, 0.45);
    animation: radarSpin 12s linear infinite;
}

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

.calc-emblem-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    padding: 3px;
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.45);
}

.calc-college-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin: 0 0 3px 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.calc-college-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
    margin: 0 0 6px 0;
}

.calc-shield-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 700;
    color: #7dd3fc;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.calc-badge-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: dotPulse 1.8s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* ── Calculator Hardware Body ──────────────────────────────────────────── */
.calc-machine {
    background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
    border: 1.5px solid #334155;
    border-radius: 18px;
    padding: 14px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.08),
                inset 0 -3px 6px rgba(0, 0, 0, 0.6),
                0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Solar Strip & Model Badge ─────────────────────────────────────────── */
.calc-solar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.calc-model-brand {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 1px;
}

.calc-solar-cell-box {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #090d16;
    border: 1px solid #334155;
    padding: 3px 6px;
    border-radius: 4px;
}

.calc-solar-cell-box span {
    width: 14px;
    height: 10px;
    background: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
    border: 0.5px solid #312e81;
    border-radius: 1px;
}

.calc-tech-chip {
    font-size: 9.5px;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── Digital LCD Display Screen ────────────────────────────────────────── */
.calc-lcd-screen {
    background: #05141b;
    border: 2px solid #0e3b43;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.9),
                0 0 16px rgba(6, 182, 212, 0.15);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

/* LCD Scanline effect */
.calc-lcd-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 234, 0.03),
        rgba(0, 255, 234, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

/* Upper challenge row */
.calc-challenge-row {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    border-bottom: 1px dashed rgba(6, 182, 212, 0.25);
    padding-bottom: 6px;
}

.calc-equation-display {
    font-family: 'Fira Code', monospace;
    font-size: 14.5px;
    font-weight: 700;
    color: #22d3ee;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

.calc-equation-badge {
    font-size: 10px;
    font-weight: 600;
    background: rgba(6, 182, 212, 0.18);
    color: #67e8f9;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.calc-lcd-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calc-icon-btn {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #94a3b8;
    width: 27px;
    height: 27px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-icon-btn:hover {
    color: #ffffff;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.25);
    transform: translateY(-1px);
}

.calc-icon-btn.active {
    color: #38bdf8;
    border-color: #38bdf8;
}

.calc-icon-btn.speaking {
    color: #10b981;
    border-color: #10b981;
    animation: speakPulse 0.8s infinite alternate;
}

@keyframes speakPulse {
    from { transform: scale(1); box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    to { transform: scale(1.15); box-shadow: 0 0 12px rgba(16, 185, 129, 0.6); }
}

/* Lower input row */
.calc-input-row {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    min-height: 38px;
    padding: 2px 0;
}

.calc-input-value {
    font-family: 'Fira Code', monospace;
    font-size: 28px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
    min-width: 10px;
    text-align: right;
    word-break: break-all;
}

.calc-input-placeholder {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.calc-blinking-cursor {
    font-family: 'Fira Code', monospace;
    font-size: 26px;
    color: #38bdf8;
    animation: cursorBlink 0.9s infinite;
    font-weight: 300;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Sub-status prompt */
.calc-status-hint {
    position: relative;
    z-index: 2;
    font-size: 10.5px;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.calc-attempt-counter {
    color: #f59e0b;
    font-weight: 700;
}

/* ── Screen Error State ─────────────────────────────────────────────────── */
.calc-lcd-screen.calc-state-error {
    background: #1c0a0e !important;
    border-color: #ef4444 !important;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.9),
                0 0 20px rgba(239, 68, 68, 0.4) !important;
}

.calc-lcd-screen.calc-state-error .calc-input-value {
    color: #f87171 !important;
    text-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
}

/* ── Screen Success State ───────────────────────────────────────────────── */
.calc-lcd-screen.calc-state-success {
    background: #061c14 !important;
    border-color: #10b981 !important;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.9),
                0 0 25px rgba(16, 185, 129, 0.5) !important;
}

.calc-lcd-screen.calc-state-success .calc-input-value {
    color: #34d399 !important;
    text-shadow: 0 0 16px rgba(52, 211, 153, 0.8) !important;
}

/* ── Keypad Grid ───────────────────────────────────────────────────────── */
.calc-keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Keypad Button Base */
.calc-btn {
    position: relative;
    overflow: hidden;
    appearance: none;
    border: 1px solid #334155;
    border-radius: 10px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #e2e8f0;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 4px 0 #020617,
                0 5px 8px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.calc-btn:hover {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    color: #ffffff;
    border-color: #475569;
}

.calc-btn:active,
.calc-btn.calc-btn-active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #020617,
                0 2px 4px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    background: #0f172a;
}

/* Clear Button (Amber/Red) */
.calc-btn-clear {
    background: linear-gradient(180deg, #7f1d1d 0%, #450a0a 100%) !important;
    border-color: #991b1b !important;
    color: #fca5a5 !important;
    box-shadow: 0 4px 0 #280505,
                0 5px 8px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.calc-btn-clear:hover {
    background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 100%) !important;
    color: #ffffff !important;
}

.calc-btn-clear:active,
.calc-btn-clear.calc-btn-active {
    background: #450a0a !important;
    box-shadow: 0 1px 0 #280505 !important;
}

/* Action / Operator Buttons */
.calc-btn-op {
    background: linear-gradient(180deg, #1e3a5f 0%, #0c213c 100%) !important;
    border-color: #2563eb !important;
    color: #60a5fa !important;
    font-size: 18px;
    box-shadow: 0 4px 0 #081628,
                0 5px 8px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.calc-btn-op:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
}

.calc-btn-action {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important;
    color: #93c5fd !important;
}

/* Verify Action Button (Large Emerald Green Button) */
.calc-btn-verify {
    grid-column: span 2;
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%) !important;
    border: 1px solid #10b981 !important;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 0 #022c22,
                0 6px 14px rgba(16, 185, 129, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.calc-btn-verify:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 0 #022c22,
                0 8px 20px rgba(16, 185, 129, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

.calc-btn-verify:active,
.calc-btn-verify.calc-btn-active {
    background: #047857 !important;
    box-shadow: 0 1px 0 #022c22 !important;
}

.calc-btn-verify.verified {
    background: #10b981 !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 25px rgba(52, 211, 153, 0.8) !important;
}

/* ── Tactile Click Ripple ──────────────────────────────────────────────── */
.calc-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: rippleWave 0.5s linear;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

@keyframes rippleWave {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── Card Footer & Shortcuts ───────────────────────────────────────────── */
.calc-footer-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    padding-top: 4px;
}

.calc-kb-shortcuts {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.calc-kb-key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #38bdf8;
}

.calc-security-stamp {
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
}

/* ── Shake Animation on Error ──────────────────────────────────────────── */
.calc-shake {
    animation: calcShakeAnim 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes calcShakeAnim {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(5px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
    40%, 60% { transform: translate3d(7px, 0, 0); }
}

/* ── Refresh Button Spin Animation ─────────────────────────────────────── */
.calc-spin {
    animation: refreshSpinAnim 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ── Mobile Viewports Optimization ─────────────────────────────────────── */
@media (max-width: 480px) {
    #gp-calc-captcha-barrier {
        padding: 10px;
    }

    .calc-card {
        padding: 16px 14px 14px 14px;
        border-radius: 20px;
        gap: 12px;
    }

    .calc-emblem-wrap {
        width: 50px;
        height: 50px;
        margin-bottom: 6px;
    }

    .calc-college-title {
        font-size: 13.5px;
    }

    .calc-machine {
        padding: 10px;
        gap: 10px;
    }

    .calc-lcd-screen {
        padding: 10px;
    }

    .calc-equation-display {
        font-size: 13px;
    }

    .calc-input-value {
        font-size: 24px;
    }

    .calc-btn {
        height: 44px;
        font-size: 16px;
    }

    .calc-btn-verify {
        font-size: 13.5px;
    }

    .calc-kb-shortcuts {
        display: none; /* Hide keyboard hint on mobile touch devices */
    }
}
