/* ===== 1980s TERMINAL STYLING ===== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'VT323', 'Courier New', monospace;
    background: #000;
    color: rgba(100, 241, 225, 0.8);
    min-height: 100vh;
    padding: 10px;
    overflow: hidden;
}

/* ===== TERMINAL CONTAINER ===== */
.terminal-container {
    max-width: 1200px;
    margin: 10px auto;
    min-height: calc(100vh - 20px);
    border: 2px solid #64f1e1;
    border-radius: 8px;
    position: relative;
    background: rgba(0, 0, 0, 0.95);
    overflow: hidden;
}

/* ===== CRT EFFECTS ===== */
.crt-effect {
    width: 100%;
    height: 100%;
    position: relative;
    background:
        radial-gradient(ellipse at center,
            rgba(100, 241, 225, 0.15) 0%,
            rgba(100, 241, 225, 0.05) 50%,
            rgba(0, 0, 0, 0.2) 100%);
    animation: screenFlicker 0.15s infinite linear alternate;
}

/* Scanlines Effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(100, 241, 225, 0.03) 2px,
        rgba(100, 241, 225, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* Screen Flicker Animation */
@keyframes screenFlicker {
    0% { opacity: 1; }
    98% { opacity: 1; }
    99% { opacity: 0.98; }
    100% { opacity: 1; }
}

/* ===== TERMINAL SCREEN ===== */
.terminal-screen {
    width: 100%;
    min-height: calc(100vh - 20px);
    padding: clamp(15px, 3vw, 40px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 10;
}

/* ===== HEADER SECTION ===== */
.terminal-header {
    text-align: center;
    margin-bottom: clamp(15px, 3vh, 30px);
}

.classified-banner {
    font-size: clamp(23px, 4.5vw, 47px);
    font-weight: normal;
    letter-spacing: clamp(3px, 0.7vw, 5px);
    color: rgba(100, 241, 225, 0.8);
    text-shadow: 0 0 15px rgba(100, 241, 225, 0.8), 0 0 25px rgba(100, 241, 225, 0.8);
    margin-bottom: clamp(10px, 2vh, 26px);
}

.system-info {
    display: flex;
    justify-content: space-between;
    font-size: clamp(13px, 2vw, 21px);
    color: rgba(100, 241, 225, 0.64);
}

/* ===== MAIN CONTENT ===== */
.terminal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(10px, 2vh, 20px) 0;
}

.terminal-content > .boot-sequence,
.terminal-content > .welcome-message,
.terminal-content > .login-form {
    align-self: flex-start;
    width: 100%;
}

/* Boot Sequence */
.boot-sequence {
    margin-bottom: clamp(15px, 2vh, 30px);
    opacity: 0;
    animation: fadeIn 1s ease-in-out 0.5s forwards;
}

.boot-line {
    margin-bottom: clamp(8px, 1.3vh, 16px);
    font-size: clamp(16px, 2.6vw, 26px);
    color: rgba(100, 241, 225, 0.8);
    opacity: 0;
    animation: typeIn 0.5s ease-in-out forwards;
}

.boot-line:nth-child(1) { animation-delay: 0.5s; }
.boot-line:nth-child(2) { animation-delay: 1s; }
.boot-line:nth-child(3) { animation-delay: 1.5s; }
.boot-line:nth-child(4) { animation-delay: 2s; }

@keyframes typeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Welcome Message */
.welcome-message {
    margin-bottom: clamp(15px, 2vh, 30px);
    opacity: 0;
    animation: fadeIn 1s ease-in-out 3s forwards;
}

.typewriter-text {
    font-size: clamp(18px, 3.3vw, 31px);
    line-height: 1.6;
    color: rgba(100, 241, 225, 0.8);
    border-right: 2px solid rgba(100, 241, 225, 0.8);
}

/* ===== LOGIN FORM ===== */
.login-form {
    opacity: 0;
    animation: fadeIn 1s ease-in-out 7s forwards;
}

.input-line {
    display: flex;
    align-items: center;
    margin-bottom: clamp(20px, 4vh, 39px);
    font-size: clamp(18px, 3.3vw, 31px);
}

.prompt {
    color: rgba(100, 241, 225, 0.8);
    margin-right: clamp(10px, 2vw, 20px);
    text-shadow: 0 0 5px rgba(100, 241, 225, 0.8);
}

.input-container {
    position: relative;
    display: inline-block;
    cursor: text;
}

.code-display {
    display: flex;
    gap: clamp(8px, 1.3vw, 16px);
    font-family: inherit;
    font-size: clamp(18px, 3.3vw, 31px);
    color: rgba(100, 241, 225, 0.8);
}

.code-char {
    display: inline-block;
    min-width: clamp(16px, 2.6vw, 26px);
    text-align: center;
    color: rgba(100, 241, 225, 0.56);
}

.code-char.filled {
    color: rgba(100, 241, 225, 0.8);
    text-shadow: 0 0 5px rgba(100, 241, 225, 0.8);
}

#access-code {
    background: transparent;
    border: none;
    color: transparent;
    font-family: inherit;
    font-size: clamp(18px, 3.3vw, 31px);
    outline: none;
    caret-color: transparent;
}

/* Cursor Animation */
.cursor {
    color: rgba(100, 241, 225, 0.8);
    animation: blink-caret 1s step-end infinite;
    position: absolute;
    margin-left: 0;
    font-size: clamp(18px, 3.3vw, 31px);
    top: 0;
}

@keyframes blink-caret {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* Error Messages */
.error-message {
    color: #ff4444;
    font-size: clamp(16px, 2.6vw, 23px);
    margin-top: clamp(15px, 3vh, 30px);
    margin-bottom: 0;
    min-height: clamp(21px, 3.3vh, 39px);
    text-shadow: 0 0 5px #ff4444;
    animation: errorFlash 0.5s ease-in-out;
    display: block;
}

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


.terminal-button {
    background: transparent;
    border: 2px solid rgba(100, 241, 225, 0.8);
    color: rgba(100, 241, 225, 0.8);
    font-family: inherit;
    font-size: clamp(18px, 2.6vw, 26px);
    padding: clamp(13px, 2.3vh, 23px) clamp(23px, 4.5vw, 46px);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.4vw, 4px);
    position: relative;
    overflow: hidden;
}

.terminal-button:hover {
    background: rgba(100, 241, 225, 0.1);
    box-shadow: 0 0 20px rgba(100, 241, 225, 0.5);
    transform: translateY(-2px);
}

.terminal-button:not(.secondary) {
    text-shadow: 0 0 10px rgba(100, 241, 225, 0.8);
    box-shadow: 0 0 15px rgba(100, 241, 225, 0.24);
}

.terminal-button:not(.secondary):hover {
    text-shadow: 0 0 15px rgba(100, 241, 225, 0.8), 0 0 25px rgba(100, 241, 225, 0.8);
    box-shadow: 0 0 25px rgba(100, 241, 225, 0.48), 0 0 35px rgba(100, 241, 225, 0.32);
}

.terminal-button:active {
    transform: translateY(0);
}

.terminal-button.secondary {
    border-color: rgba(100, 241, 225, 0.4);
    color: rgba(100, 241, 225, 0.56);
}

.terminal-button.secondary:hover {
    border-color: rgba(100, 241, 225, 0.8);
    color: rgba(100, 241, 225, 0.8);
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-screen[style*="display: block"] {
    display: flex !important;
}

.loading-text {
    font-size: clamp(21px, 3.6vw, 36px);
    color: rgba(100, 241, 225, 0.8);
    margin-bottom: clamp(20px, 4vh, 39px);
    animation: pulse 1s ease-in-out infinite;
}

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

.loading-bar {
    width: clamp(260px, 52vw, 520px);
    height: clamp(4px, 0.7vh, 8px);
    background: rgba(100, 241, 225, 0.2);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(100, 241, 225, 0.8),
        transparent);
    width: clamp(78px, 15.6vw, 156px);
    position: absolute;
    animation: loadingSlide 2s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% { left: -100px; }
    100% { left: 300px; }
}

/* ===== SUCCESS LOADING SCREEN ===== */
.success-loading-screen {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.success-loading-screen[style*="display: block"] {
    display: flex !important;
}

.success-loading-text {
    font-size: clamp(21px, 3.6vw, 36px);
    color: rgba(100, 241, 225, 0.8);
    margin-bottom: clamp(20px, 4vh, 39px);
    text-shadow: 0 0 10px rgba(100, 241, 225, 0.8);
    animation: successPulse 1s ease-in-out infinite;
}

@keyframes successPulse {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(100, 241, 225, 0.8);
    }
    50% {
        opacity: 0.7;
        text-shadow: 0 0 20px rgba(100, 241, 225, 1);
    }
}

.success-loading-bar {
    width: clamp(260px, 52vw, 520px);
    height: clamp(6px, 1vh, 10px);
    background: rgba(100, 241, 225, 0.2);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(100, 241, 225, 0.4);
}

.success-loading-progress {
    height: 100%;
    background: linear-gradient(90deg,
        rgba(100, 241, 225, 0.6),
        rgba(100, 241, 225, 1),
        rgba(100, 241, 225, 0.6));
    width: 0%;
    position: absolute;
    transition: width 0.8s ease-in-out;
    box-shadow: 0 0 10px rgba(100, 241, 225, 0.8);
}

/* ===== DOSSIER WELCOME SCREEN ===== */
.dossier-welcome-screen {
    display: none;
    text-align: center;
    animation: fadeIn 1s ease-in-out;
    padding: clamp(20px, 4vh, 40px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.dossier-welcome-screen[style*="display: block"] {
    display: flex !important;
}

.welcome-header {
    margin-bottom: clamp(30px, 6vh, 60px);
}

.welcome-title {
    font-size: clamp(28px, 5vw, 50px);
    color: rgba(100, 241, 225, 0.9);
    text-shadow: 0 0 15px rgba(100, 241, 225, 0.8), 0 0 25px rgba(100, 241, 225, 0.6);
    margin-bottom: clamp(15px, 3vh, 30px);
    letter-spacing: clamp(2px, 0.5vw, 4px);
}

.security-line {
    font-size: clamp(16px, 2.6vw, 26px);
    color: rgba(100, 241, 225, 0.6);
    letter-spacing: clamp(1px, 0.3vw, 2px);
}

.client-welcome {
    margin-bottom: clamp(40px, 8vh, 80px);
}

.client-greeting {
    font-size: clamp(24px, 4vw, 40px);
    color: rgba(100, 241, 225, 0.8);
    margin-bottom: clamp(20px, 4vh, 30px);
    text-shadow: 0 0 10px rgba(100, 241, 225, 0.6);
}

.dossier-info {
    font-size: clamp(18px, 3.3vw, 28px);
    color: rgba(100, 241, 225, 0.7);
    line-height: 1.4;
    margin-bottom: clamp(10px, 2vh, 20px);
}

.continue-actions {
    display: flex;
    justify-content: center;
}

#continue-btn {
    font-size: clamp(20px, 3vw, 28px);
    padding: clamp(15px, 2.5vh, 25px) clamp(30px, 5vw, 50px);
    text-shadow: 0 0 15px rgba(100, 241, 225, 0.8);
    box-shadow: 0 0 20px rgba(100, 241, 225, 0.4);
}

#continue-btn:hover {
    box-shadow: 0 0 30px rgba(100, 241, 225, 0.6), 0 0 40px rgba(100, 241, 225, 0.4);
    text-shadow: 0 0 20px rgba(100, 241, 225, 1), 0 0 30px rgba(100, 241, 225, 0.8);
}

/* ===== FOOTER SECTION ===== */
.terminal-footer {
    text-align: center;
    font-size: clamp(12px, 1.6vw, 18px);
    color: rgba(100, 241, 225, 0.48);
    margin-top: clamp(20px, 4vh, 39px);
}

.footer-line {
    margin-bottom: clamp(3px, 0.8vh, 8px);
}

.system-status {
    margin-top: clamp(8px, 1.5vh, 15px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.5vw, 15px);
}

.status-active {
    color: rgba(100, 241, 225, 0.8);
    text-shadow: 0 0 5px rgba(100, 241, 225, 0.8);
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 80%, 100% { opacity: 1; }
    40% { opacity: 0.5; }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
        height: 100vh;
        overflow: hidden;
    }

    .terminal-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border-width: 0;
        border: none;
        margin: 0;
    }

    .terminal-screen {
        padding: 15px;
        min-height: 100vh;
        height: 100vh;
        overflow-y: auto;
    }

    .terminal-header {
        margin-bottom: 10px;
    }

    .classified-banner {
        font-size: 16px;
        letter-spacing: 1.5px;
        margin-bottom: 10px;
    }

    .system-info {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }

    .terminal-content {
        padding: 10px 0;
    }

    .typewriter-text {
        font-size: 18px;
        white-space: normal;
        border-right: none;
        line-height: 1.5;
    }

    .boot-line {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .login-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .input-line {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
        text-align: center;
    }

    .prompt {
        font-size: 20px;
    }

    .code-display {
        gap: 12px;
        font-size: 24px;
    }

    .code-char {
        min-width: 20px;
        font-size: 24px;
    }

    .cursor {
        font-size: 24px;
    }

    .login-actions {
        flex-direction: column;
        gap: 8px;
    }

    .error-message {
        font-size: 16px;
        margin-top: 15px;
        text-align: center;
    }

    .terminal-button {
        width: 100%;
        text-align: center;
        padding: 12px 24px;
        font-size: 16px;
    }

    .loading-bar {
        width: 220px;
    }

    .loading-text, .success-loading-text {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .terminal-footer {
        margin-top: 15px;
        font-size: 11px;
    }

    .footer-line {
        margin-bottom: 3px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
        height: 100vh;
        overflow: hidden;
    }

    .terminal-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        margin: 0;
    }

    .terminal-screen {
        padding: 10px;
        min-height: 100vh;
        height: 100vh;
    }

    .terminal-header {
        margin-bottom: 8px;
    }

    .classified-banner {
        font-size: 14px;
        margin-bottom: 8px;
        letter-spacing: 1.2px;
    }

    .system-info {
        font-size: 10px;
        gap: 3px;
    }

    .terminal-content {
        padding: 8px 0;
    }

    .typewriter-text {
        font-size: 16px;
        line-height: 1.4;
    }

    .boot-line {
        font-size: 14px;
        margin-bottom: 7px;
    }

    .login-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .input-line {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-bottom: 18px;
        text-align: center;
    }

    .prompt {
        font-size: 18px;
    }

    .code-display {
        gap: 10px;
        font-size: 22px;
    }

    .code-char {
        min-width: 18px;
        font-size: 22px;
    }

    .cursor {
        font-size: 22px;
    }

    .error-message {
        font-size: 14px;
        margin-top: 12px;
        text-align: center;
    }

    .terminal-button {
        font-size: 15px;
        padding: 10px 20px;
    }

    .loading-text, .success-loading-text {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .terminal-footer {
        margin-top: 10px;
        font-size: 10px;
    }

    .footer-line {
        margin-bottom: 2px;
    }
}

/* ===== HIDDEN STATES ===== */
.hidden {
    display: none !important;
}

.fade-out {
    animation: fadeOut 0.5s ease-in-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== DENIAL VIDEO OVERLAY ===== */
.denial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.denial-overlay.active {
    display: flex;
    animation: fadeInOverlay 0.8s ease-in-out;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
        background: rgba(0, 0, 0, 0);
    }
    to {
        opacity: 1;
        background: #000;
    }
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#denial-video {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.close-video-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(100, 241, 225, 0.8);
    color: rgba(100, 241, 225, 0.8);
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 10000;
}

.close-video-btn:hover {
    background: rgba(100, 241, 225, 0.1);
    box-shadow: 0 0 20px rgba(100, 241, 225, 0.5);
    transform: scale(1.1);
}

.close-x {
    font-size: 28px;
    line-height: 1;
    font-weight: normal;
}

/* ===== GLITCH EFFECT OVERLAY ===== */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 8888;
    display: none;
    pointer-events: none;
}

.glitch-overlay.active {
    display: block;
}

.glitch-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 0, 0, 0.03) 2px,
        rgba(255, 0, 0, 0.03) 4px
    );
    animation: glitchScanlines 0.1s infinite linear;
}

.glitch-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 0, 0, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(0, 255, 0, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 40% 40%, rgba(0, 0, 255, 0.1) 0%, transparent 30%);
    animation: glitchNoise 0.2s infinite ease-in-out;
    mix-blend-mode: screen;
}

@keyframes glitchScanlines {
    0% {
        background-position: 0 0;
        filter: hue-rotate(0deg);
    }
    25% {
        background-position: 2px 0;
        filter: hue-rotate(90deg);
    }
    50% {
        background-position: 0 2px;
        filter: hue-rotate(180deg);
    }
    75% {
        background-position: -2px 0;
        filter: hue-rotate(270deg);
    }
    100% {
        background-position: 0 0;
        filter: hue-rotate(360deg);
    }
}

@keyframes glitchNoise {
    0%, 100% {
        opacity: 0.8;
        transform: translateX(0) scaleX(1);
    }
    20% {
        opacity: 0.4;
        transform: translateX(-2px) scaleX(1.02);
    }
    40% {
        opacity: 0.6;
        transform: translateX(2px) scaleX(0.98);
    }
    60% {
        opacity: 0.3;
        transform: translateX(-1px) scaleX(1.01);
    }
    80% {
        opacity: 0.7;
        transform: translateX(1px) scaleX(0.99);
    }
}

/* Additional glitch effect for terminal container */
.terminal-container.glitching {
    animation: terminalGlitch 0.6s ease-in-out;
}

@keyframes terminalGlitch {
    0%, 100% {
        transform: translateX(0) scale(1);
        filter: hue-rotate(0deg) contrast(1);
    }
    10% {
        transform: translateX(-3px) scale(1.002);
        filter: hue-rotate(10deg) contrast(1.2);
    }
    20% {
        transform: translateX(3px) scale(0.998);
        filter: hue-rotate(-10deg) contrast(0.8);
    }
    30% {
        transform: translateX(-2px) scale(1.001);
        filter: hue-rotate(5deg) contrast(1.1);
    }
    40% {
        transform: translateX(2px) scale(0.999);
        filter: hue-rotate(-5deg) contrast(0.9);
    }
    50% {
        transform: translateX(-1px) scale(1);
        filter: hue-rotate(0deg) contrast(1);
    }
}
