/*
 * Jason's Front Gate Code Portal
 * Approved Visual Direction: Futuristic Data Center Aesthetic
 * KISS Principle - Zero heavy dependencies, pure lightweight CSS
 */

:root {
    --bg-dark: #050a14;
    --navy-deep: #0a1426;
    --navy-mid: #0f203c;
    --cyan-glow: #00f0ff;
    --blue-glow: #0077ff;
    --blue-dim: #1c3d6e;
    --text-primary: #e6f1ff;
    --text-muted: #7997be;
    --accent-red: #ff3366;
    --accent-amber: #ffaa00;
    --panel-border: rgba(0, 240, 255, 0.22);
    --panel-bg: rgba(6, 14, 28, 0.82);
    --idle-blur: 27px;
    --approved-blur: 17px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Background Scene Container */
.scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform-origin: 65% 50%;
    transition: transform 2.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* High-resolution Data Center Background Image */
.bg-image {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-image: url('../img/bg-tech-blur.png');
    background-size: cover;
    background-position: center center;
    filter: blur(var(--idle-blur)) brightness(0.65) contrast(1.15);
    transition: filter 2.4s ease-out, transform 2.6s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: filter, transform;
}

/* Atmospheric Ambient Lighting & Scanline Overlays */
.ambient-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 65% 45%, rgba(0, 240, 255, 0.12) 0%, transparent 60%),
                radial-gradient(circle at 35% 65%, rgba(0, 119, 255, 0.15) 0%, transparent 65%),
                linear-gradient(180deg, rgba(5, 10, 20, 0.6) 0%, rgba(5, 10, 20, 0.3) 50%, rgba(5, 10, 20, 0.75) 100%);
    pointer-events: none;
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.18) 0px,
        rgba(0, 0, 0, 0.18) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    opacity: 0.6;
}

/* Independent Server Overlay (Power-On Sequence) */
.server-overlay {
    position: absolute;
    top: 25%;
    right: 18%;
    width: 160px;
    height: 380px;
    background: linear-gradient(180deg, rgba(10, 20, 36, 0.75) 0%, rgba(5, 12, 24, 0.9) 100%);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 119, 255, 0.2);
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 1.2s ease, box-shadow 1.5s ease, border-color 1.2s ease;
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    gap: 8px;
    z-index: 2;
}

.server-blade {
    height: 18px;
    background: rgba(15, 32, 60, 0.8);
    border-radius: 2px;
    border-left: 3px solid var(--blue-dim);
    display: flex;
    align-items: center;
    padding: 0 6px;
    gap: 6px;
}

.server-led {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #24416b;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.server-led.amber {
    background-color: rgba(255, 170, 0, 0.3);
}

/* Ambient idle LED pulsing */
@keyframes led-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.server-led.active-idle {
    animation: led-pulse 3s infinite ease-in-out;
}

/* Approved Power-On State */
.scene-container.authorized .bg-image {
    filter: blur(var(--approved-blur)) brightness(0.85) contrast(1.2);
}

.scene-container.authorized .server-overlay {
    opacity: 1;
    border-color: rgba(0, 240, 255, 0.8);
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.6), inset 0 0 20px rgba(0, 240, 255, 0.3);
}

.scene-container.authorized .server-blade {
    border-left-color: var(--cyan-glow);
}

.scene-container.authorized .server-led {
    background-color: var(--cyan-glow);
    box-shadow: 0 0 8px var(--cyan-glow);
}

.scene-container.authorized .server-led.amber {
    background-color: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
}

/* Camera push toward server */
.scene-container.authorized {
    transform: scale(1.35) translate(-4%, -2%);
}

/* Main Code Entry Portal Panel (K.I.S.S.) */
.portal-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 24px;
    margin: 0 auto;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scene-container.authorized .portal-wrapper {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
    pointer-events: none;
}

.portal-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 36px 32px 32px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75),
                0 0 24px rgba(0, 240, 255, 0.08),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.portal-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cyan-glow);
    text-align: center;
    margin-bottom: 24px;
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.entry-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Hidden Honeypot */
.trap-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
    height: 0;
    width: 0;
}

.input-container {
    position: relative;
    width: 100%;
}

.code-input {
    width: 100%;
    height: 48px;
    background: rgba(5, 12, 26, 0.9);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 4px;
    padding: 0 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.08em;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.code-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: normal;
}

.code-input:focus {
    border-color: var(--cyan-glow);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
    background: rgba(7, 18, 38, 0.95);
}

.code-input[readonly] {
    cursor: wait;
    opacity: 0.85;
}

.validate-btn {
    width: 100%;
    height: 48px;
    background: linear-gradient(180deg, #00c8e0 0%, #0088cc 100%);
    border: 1px solid rgba(0, 240, 255, 0.6);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #04101e;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.25s ease;
    outline: none;
}

.validate-btn:hover {
    filter: brightness(1.12);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.validate-btn:active {
    transform: scale(0.98);
}

.validate-btn:disabled {
    cursor: wait;
    opacity: 0.7;
    filter: grayscale(0.2);
}

/* Small Status / Message Area */
.status-area {
    min-height: 24px;
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
    transition: opacity 0.2s ease;
}

.status-message {
    color: var(--text-muted);
}

.status-message.error {
    color: var(--accent-red);
    text-shadow: 0 0 8px rgba(255, 51, 102, 0.3);
}

.status-message.validating {
    color: var(--cyan-glow);
    animation: status-pulse 1.2s infinite ease-in-out;
}

.status-message.success {
    color: var(--cyan-glow);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

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

/* Critical 10-Failure Ban Panel View */
/* NO inputs, NO buttons, NO retry, NO countdown */
.banned-panel {
    text-align: center;
}

.banned-message {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 12px 4px;
}

/* Accessibility: Focus visible outline for keyboard users */
.code-input:focus-visible,
.validate-btn:focus-visible {
    outline: 2px solid var(--cyan-glow);
    outline-offset: 2px;
}

/* Mobile & Small Screen Adaptations */
@media (max-width: 600px) {
    .portal-wrapper {
        padding: 16px;
    }

    .portal-panel {
        padding: 28px 20px 24px;
    }

    .server-overlay {
        right: 5%;
        width: 110px;
        height: 280px;
        opacity: 0.2;
    }
}

/* Prefers Reduced Motion Compliance */
@media (prefers-reduced-motion: reduce) {
    .scene-container {
        transition: none !important;
    }

    .scene-container.authorized {
        transform: none !important;
    }

    .bg-image {
        transition: filter 0.4s ease !important;
    }

    .portal-wrapper {
        transition: opacity 0.4s ease !important;
    }

    .scene-container.authorized .portal-wrapper {
        transform: none !important;
    }

    .server-overlay,
    .server-led {
        transition: opacity 0.4s ease !important;
        animation: none !important;
    }

    .status-message.validating {
        animation: none !important;
    }
}
