/* Login Page Specific Styles */

/* Hide scrollbar on body when login page */
body.login-page {
    overflow-y: hidden !important; /* Force hide vertical scrollbar */
    overflow-x: hidden !important;
    height: 100vh !important; /* Fixed height to prevent dynamic changes */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
body.login-page::-webkit-scrollbar {
    display: none !important;
}

/* Override body for login page */
.login-page {
    overflow: hidden !important; /* Prevent any overflow */
    animation: subtle-shake 0.1s infinite;
    /* Fixed height and centering without scroll */
    height: 100vh !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* Prevent overlap with fixed status bar at bottom */
    padding-bottom: 40px;
    position: relative;
}

/* Align with site wrapper without extra top offset */
.login-page .main-content {
    margin-top: 0;
    padding-top: 20px;
}

@keyframes subtle-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(0.5px); }
    75% { transform: translateX(-0.5px); }
}

/* Background layers */
.glitch-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 0, 110, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(131, 56, 236, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(6, 255, 180, 0.05) 0%, transparent 50%);
    animation: bg-shift 8s infinite;
}

@keyframes bg-shift {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(1deg) scale(1.02); }
    66% { transform: rotate(-1deg) scale(0.98); }
}

/* Digital rain effect */
.digital-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.1;
}

.matrix-char {
    position: absolute;
    color: rgba(0, 255, 0, 0.3);
    font-family: 'Courier New', monospace;
    animation: fall linear infinite;
    top: 0; /* Ensure they start from the top */
    pointer-events: none; /* Don't affect layout */
    will-change: transform; /* Optimize animations */
}

@keyframes fall {
    0% { transform: translateY(-100vh); opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

/* Terminal container */
.terminal {
    position: relative;
    z-index: 10;
    max-width: 1800px; /* Much larger for wide screens */
    width: 100%; 
    max-height: calc(100vh - 80px); /* Prevent overflow */
    overflow: hidden; /* Contain any overflow */
    /* Allow body flexbox to handle vertical centering */
    margin: 0 auto;
    background: 
        linear-gradient(135deg, rgba(0, 0, 0, 0.98) 0%, rgba(10, 10, 10, 0.95) 100%),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0, 255, 0, 0.03) 2px, rgba(0, 255, 0, 0.03) 4px);
    border: 3px solid #00ff00;
    border-radius: 0;
    padding: 25px;
    box-shadow: 
        0 0 30px rgba(0, 255, 0, 0.8),
        0 0 60px rgba(255, 0, 110, 0.3),
        0 0 90px rgba(131, 56, 236, 0.2),
        inset 0 0 30px rgba(0, 255, 0, 0.1),
        inset 0 0 60px rgba(0, 0, 0, 0.8);
    transform: perspective(1000px) rotateX(2deg);
    animation: terminal-pulse 3s infinite ease-in-out;
}

/* For very large screens, make it even wider */
@media (min-width: 1600px) {
    .terminal {
        max-width: 2000px; /* Even larger for very wide screens */
        width: 95%;
    }
}

@media (min-width: 2000px) {
    .terminal {
        max-width: 2400px; /* Ultra-wide support */
        width: 90%;
    }
}

@keyframes terminal-pulse {
    0%, 100% { 
        box-shadow: 
            0 0 30px rgba(0, 255, 0, 0.8),
            0 0 60px rgba(255, 0, 110, 0.3),
            0 0 90px rgba(131, 56, 236, 0.2),
            inset 0 0 30px rgba(0, 255, 0, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 40px rgba(0, 255, 0, 1.0),
            0 0 80px rgba(255, 0, 110, 0.5),
            0 0 120px rgba(131, 56, 236, 0.4),
            inset 0 0 40px rgba(0, 255, 0, 0.2);
    }
}

/* Terminal header */
.terminal-header {
    border-bottom: 1px solid #00ff00;
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.system-title {
    font-family: 'Orbitron', 'ShareTechMono', monospace;
    font-weight: 700;
    font-size: 36px; /* Increased from 32px */
    color: #ff006e;
    text-shadow: 
        0 0 10px #ff006e,
        0 0 20px #ff006e,
        0 0 40px #ff006e,
        2px 2px 0px #00ff00,
        4px 4px 0px #06ffb4;
    animation: extreme-glitch 4s infinite;
    position: relative;
    overflow: hidden;
    letter-spacing: 2px; /* Reduced from 3px to save space */
    text-transform: uppercase;
    background: linear-gradient(45deg, #ff006e, #00ff00, #06ffb4, #8338ec);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: extreme-glitch 4s infinite, gradient-shift 3s infinite;
}

/* Allow text wrapping on all screens to prevent cut-off */
@media (min-width: 1024px) {
    .system-title {
        /* Removed white-space: nowrap to allow text wrapping when needed */
        word-break: break-word; /* Allow breaking long words if necessary */
    }
}

/* For very wide screens, allow even larger text */
@media (min-width: 1600px) {
    .system-title {
        font-size: 42px;
        letter-spacing: 3px;
    }
}

@media (min-width: 2000px) {
    .system-title {
        font-size: 48px;
        letter-spacing: 4px;
    }
}

.system-title::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: #00ff00;
    animation: glitch-layer1 4s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.system-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: #06ffb4;
    animation: glitch-layer2 4s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

.system-subtitle {
    color: #8338ec;
    margin-top: 10px;
    text-shadow: 0 0 10px #8338ec;
    animation: pulse-glow 2s infinite;
}

.protocol-version {
    color: #06ffb4;
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.8;
}

@keyframes extreme-glitch {
    0%, 100% { 
        transform: translateX(0);
        text-shadow: 0 0 20px #ff006e;
        filter: hue-rotate(0deg);
    }
    10% { 
        transform: translateX(-3px) scaleY(1.1);
        text-shadow: -3px 0 0 red, 3px 0 0 blue, 0 0 20px #ff006e;
        filter: hue-rotate(90deg);
    }
    20% { 
        transform: translateX(3px) scaleY(0.9);
        text-shadow: 3px 0 0 red, -3px 0 0 blue, 0 0 25px #ff006e;
        filter: hue-rotate(180deg);
    }
    30% { 
        transform: translateX(-1px) scaleX(1.1);
        text-shadow: -2px 0 0 red, 2px 0 0 blue, 0 0 30px #ff006e;
        filter: hue-rotate(270deg);
    }
}

@keyframes glitch-layer1 {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-5px); }
    20% { transform: translateX(5px); }
    30% { transform: translateX(-2px); }
}

@keyframes glitch-layer2 {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(3px); }
    20% { transform: translateX(-3px); }
    30% { transform: translateX(1px); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 10px #8338ec; }
    50% { text-shadow: 0 0 20px #8338ec, 0 0 30px #8338ec; }
}

/* Boot sequence */
.boot-sequence {
    margin-bottom: 30px;
}

.boot-line {
    opacity: 0;
    animation: typewriter 0.5s ease-in-out forwards;
    margin-bottom: 5px;
}

.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 typewriter {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Login form */
.login-section {
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out 3s forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.prompt-line {
    margin-bottom: 15px;
}

.cursor {
    animation: blink 1s infinite;
}

.cursor-container {
    margin-top: 30px;
    font-size: 14px;
    opacity: 0.7;
    line-height: 1.4;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Password input */
.password-container {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.password-input {
    background: transparent;
    border: none;
    color: #00ff00;
    font-family: 'ShareTechMono', 'Courier New', monospace;
    font-size: 18px;
    outline: none;
    padding: 5px 10px;
    border-bottom: 1px solid #00ff00;
    margin-left: 10px;
    min-width: 300px;
}

.password-input:focus {
    outline: 2px solid #00ff41;
    outline-offset: 2px;
}

.password-input::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

/* Button */
.breach-btn {
    background: transparent;
    border: 2px solid #ff006e;
    color: #ff006e;
    padding: 10px 20px;
    font-family: 'Orbitron', 'ShareTechMono', monospace;
    font-weight: 700;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.breach-btn:hover {
    background: #ff006e;
    color: #000;
    box-shadow: 0 0 20px #ff006e;
    animation: glitch-btn 0.3s ease-in-out;
}

.breach-btn:focus {
    outline: 2px solid #ff006e;
    outline-offset: 3px;
}

@keyframes glitch-btn {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

/* Error messages */
.error-msg {
    color: #ff0033;
    margin-top: 15px;
    display: none;
    animation: glitch-text 0.5s ease-in-out;
}

@keyframes glitch-text {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px) scaleX(1.1); }
    75% { transform: translateX(2px) scaleX(0.9); }
    100% { transform: translateX(0); }
}

/* Success message */
.success-msg {
    color: #06ffb4;
    margin-top: 15px;
    display: none;
}

/* Access attempt logger */
.access-log {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 11px;
    opacity: 0.6;
    width: 200px;
    height: 120px;
    overflow: hidden;
    padding: 5px;
    line-height: 14px;
    text-align: right;
    z-index: 20;
}

.log-entry {
    margin-bottom: 2px;
    opacity: 0;
    animation: logEntry 0.5s ease-in-out forwards;
}

@keyframes logEntry {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 0.7; transform: translateX(0); }
}

/* Scan lines effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 50%, rgba(0, 255, 0, 0.03) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
    animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .login-page,
    .system-title,
    .glitch-bg,
    .scanlines,
    .digital-rain,
    .matrix-char,
    .cursor,
    .boot-line,
    .terminal {
        animation: none !important;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .terminal {
        margin: 2% 5px;
        padding: 15px;
        font-size: 14px;
        max-width: calc(100% - 10px);
        width: calc(100% - 10px);
        max-height: calc(100vh - 120px); /* Leave more space for messages */
        overflow-y: auto; /* Allow scrolling within terminal if needed */
        transform: none;
        perspective: none;
    }
    
    .system-title {
        font-size: 20px;
        letter-spacing: 2px;
    }
    
    .password-input {
        min-width: 180px;
        max-width: 100%;
        font-size: 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .breach-btn {
        font-size: 16px;
        padding: 12px 20px;
        width: 100%;
        box-sizing: border-box;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(255, 0, 110, 0.3);
        cursor: pointer;
        user-select: none;
    }
    
    .breach-btn:active {
        transform: scale(0.98);
        background: rgba(255, 0, 110, 0.1);
    }
    
    .access-log {
        display: none;
    }
}

@media (max-width: 480px) {
    .terminal {
        margin: 1% 3px;
        padding: 12px;
        font-size: 13px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    
    .system-title {
        font-size: 18px;
        letter-spacing: 1.5px;
    }
    
    .password-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .password-input {
        min-width: 160px;
        font-size: 16px;
    }
    
    .breach-btn {
        font-size: 14px;
        padding: 10px 16px;
        margin-top: 15px;
    }
}

@media (max-width: 360px) {
    .terminal {
        margin: 1% 2px;
        padding: 10px;
        font-size: 12px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    
    .system-title {
        font-size: 16px;
        letter-spacing: 1px;
    }
    
    .password-input {
        min-width: 140px;
        font-size: 16px;
    }
    
    .breach-btn {
        font-size: 13px;
        padding: 10px 14px;
        margin-top: 12px;
    }
}

/* Durian bonus effect animations */
@keyframes durian-glow {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
        filter: hue-rotate(0deg);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 0 40px rgba(255, 107, 107, 0.6);
        filter: hue-rotate(10deg);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
        filter: hue-rotate(0deg);
    }
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) rotate(360deg);
    }
}

/* ULTIMATE CHAOS ANIMATIONS - MAXIMUM MAGNIFICENCE! */
@keyframes epic-text-chaos {
    0% { 
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) saturate(100%);
    }
    50% { 
        transform: scale(1.02) rotate(0.5deg);
        filter: hue-rotate(180deg) saturate(150%);
    }
    100% { 
        transform: scale(0.98) rotate(-0.5deg);
        filter: hue-rotate(360deg) saturate(200%);
    }
}

@keyframes ultimate-chaos-terminal {
    0% { 
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg) brightness(100%) contrast(100%);
        box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
    }
    25% { 
        transform: scale(1.05) rotate(1deg);
        filter: hue-rotate(90deg) brightness(120%) contrast(150%);
        box-shadow: 0 0 40px rgba(0, 255, 255, 0.7);
    }
    50% { 
        transform: scale(0.95) rotate(-1deg);
        filter: hue-rotate(180deg) brightness(150%) contrast(200%);
        box-shadow: 0 0 60px rgba(255, 255, 0, 0.8);
    }
    75% { 
        transform: scale(1.08) rotate(0.5deg);
        filter: hue-rotate(270deg) brightness(110%) contrast(180%);
        box-shadow: 0 0 80px rgba(255, 0, 128, 0.9);
    }
    100% { 
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(360deg) brightness(100%) contrast(100%);
        box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
    }
}

@keyframes chaos-reality-distortion {
    0% { 
        opacity: 0.7;
        transform: rotate(0deg) scale(1);
        filter: hue-rotate(0deg);
    }
    33% { 
        opacity: 0.9;
        transform: rotate(120deg) scale(1.1);
        filter: hue-rotate(120deg);
    }
    66% { 
        opacity: 0.8;
        transform: rotate(240deg) scale(0.9);
        filter: hue-rotate(240deg);
    }
    100% { 
        opacity: 0.7;
        transform: rotate(360deg) scale(1);
        filter: hue-rotate(360deg);
    }
}

@keyframes glitch-particle-chaos {
    0% { 
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
        filter: hue-rotate(0deg);
    }
    25% { 
        opacity: 0.8;
        transform: translate(20px, -30px) rotate(90deg) scale(1.2);
        filter: hue-rotate(90deg);
    }
    50% { 
        opacity: 0.6;
        transform: translate(-15px, 40px) rotate(180deg) scale(0.8);
        filter: hue-rotate(180deg);
    }
    75% { 
        opacity: 0.4;
        transform: translate(35px, -20px) rotate(270deg) scale(1.5);
        filter: hue-rotate(270deg);
    }
    100% { 
        opacity: 0;
        transform: translate(-40px, 60px) rotate(360deg) scale(0);
        filter: hue-rotate(360deg);
    }
}

@keyframes temporal-anomaly-spin {
    0% { 
        transform: rotate(0deg) scale(0.5);
        opacity: 0.3;
    }
    50% { 
        transform: rotate(180deg) scale(1.2);
        opacity: 0.8;
    }
    100% { 
        transform: rotate(360deg) scale(0.5);
        opacity: 0.3;
    }
}

@keyframes dimension-breach-explode {
    0% { 
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
        filter: blur(10px);
    }
    50% { 
        transform: translate(-50%, -50%) scale(2) rotate(180deg);
        opacity: 1;
        filter: blur(0px);
    }
    100% { 
        transform: translate(-50%, -50%) scale(0.5) rotate(360deg);
        opacity: 0;
        filter: blur(5px);
    }
}

@keyframes konami-appear {
    0% { 
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
        filter: blur(10px);
    }
    100% { 
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        filter: blur(0px);
    }
}

@keyframes sound-wave-expand {
    0% { 
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% { 
        transform: translate(-50%, -50%) scale(10);
        opacity: 0;
    }
}

@keyframes durian-matrix-fall {
    0% { 
        transform: translateY(-20px) rotate(0deg);
        opacity: 1;
    }
    100% { 
        transform: translateY(calc(100vh + 50px)) rotate(360deg);
        opacity: 0;
    }
}

@keyframes surveillance-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes fade-out {
    to { opacity: 0; }
}

/* Ensure ultimate chaos animations respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    @keyframes durian-glow {
        0%, 100% { 
            transform: scale(1);
            box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
            filter: hue-rotate(0deg);
        }
    }
    
    @keyframes float-up {
        0%, 100% {
            opacity: 0;
            transform: translateY(0) rotate(0deg);
        }
    }
    
    @keyframes epic-text-chaos,
    @keyframes ultimate-chaos-terminal,
    @keyframes chaos-reality-distortion,
    @keyframes glitch-particle-chaos,
    @keyframes temporal-anomaly-spin,
    @keyframes dimension-breach-explode,
    @keyframes durian-matrix-fall {
        0%, 100% { 
            transform: scale(1);
            opacity: 0.5;
            filter: none;
        }
    }
}

/* Login Page Mobile Responsive */
@media (max-width: 768px) {
    .login-page {
        padding: 10px;
        padding-bottom: 35px;
    }

    .login-page .main-content {
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: 8px;
        padding-bottom: 30px;
    }

    .login-page .main-content {
        padding: 8px;
    }
}

@media (max-width: 360px) {
    .login-page {
        padding: 5px;
        padding-bottom: 25px;
    }

    .login-page .main-content {
        padding: 5px;
    }
}
