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

body {
    font-family: 'Courier New', Courier, monospace;
    background: #000;
    color: #0f0;
    overflow: hidden;
    height: 100vh;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10vh;
}

#initial-black {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000;
    animation: fadeOut 1s ease-in-out 1s forwards;
}

#connection-text {
    font-size: 5rem;
    font-weight: bold;
    text-align: center;
    z-index: 1001;
    margin-bottom: 60px;
}

#loading-animation {
    width: 90%;
    max-width: 1000px;
    z-index: 1001;
}

/* Glitch Effect */
.glitch-text {
    font-size: 1.5rem;
    text-align: center;
    margin: 20px 0;
    position: relative;
    animation: glitch 3s infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    animation: glitchTop 1.5s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    color: #f00;
}

.glitch-text::after {
    animation: glitchBottom 2s infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    color: #0ff;
}

/* Terminal Lines Animation */
.terminal-lines {
    font-size: 1.4rem;
    line-height: 1.4;
    overflow: hidden;
    height: 400px;
}

.terminal-line {
    opacity: 0;
    animation: fadeInLine 0.3s ease-in forwards;
}

/* Chat Container */
#chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, #0a0a0a 0%, #000 100%);
    position: relative;
}

/* Scanline effect */
#chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 0, 0.03) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 255, 0, 0.03) 3px
    );
    pointer-events: none;
    z-index: 2;
}

/* Chat Header */
#chat-header {
    padding: 15px 20px;
    background: rgba(0, 20, 0, 0.8);
    border-bottom: 2px solid #0f0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.3);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0f0;
    box-shadow: 0 0 10px #0f0;
    animation: pulse 2s infinite;
}

.status-indicator.compromised {
    background: #f00;
    box-shadow: 0 0 10px #f00;
}

#connection-status {
    margin-left: auto;
    font-size: 0.9rem;
    color: #0f0;
}

#connection-status.compromised {
    color: #f00;
}

/* Messages Container */
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message Styles */
.message {
    padding: 10px 15px;
    border-left: 3px solid #0f0;
    background: rgba(0, 50, 0, 0.2);
    animation: messageSlide 0.3s ease-out;
}

.message.user {
    border-left-color: #0ff;
    background: rgba(0, 50, 50, 0.2);
}

.message.admin {
    border-left-color: #0f0;
    background: rgba(0, 50, 0, 0.2);
}

.message.compromised {
    border-left-color: #f00;
    background: rgba(50, 0, 0, 0.3);
    color: #f00;
    font-size: 1.5rem;
    text-align: center;
    font-weight: bold;
}

.message-header {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.message-sender {
    font-weight: bold;
}

.message-time {
    margin-left: 10px;
}

.message-content {
    font-size: 1rem;
    line-height: 1.4;
}

/* Input Container */
#input-container {
    display: flex;
    padding: 20px;
    background: rgba(0, 20, 0, 0.8);
    border-top: 2px solid #0f0;
    gap: 10px;
    align-items: center;
}

#input-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.input-prompt {
    font-size: 1.2rem;
    color: #0f0;
}

#message-input {
    flex: 1;
    background: rgba(0, 50, 0, 0.3);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 12px 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    outline: none;
}

#message-input:focus {
    background: rgba(0, 50, 0, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

#message-input::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

#send-btn {
    padding: 12px 25px;
    background: rgba(0, 100, 0, 0.6);
    border: 1px solid #0f0;
    color: #0f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

#send-btn:hover {
    background: rgba(0, 150, 0, 0.8);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

#send-btn:active {
    transform: scale(0.98);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Scrollbar Styling */
#messages-container::-webkit-scrollbar {
    width: 8px;
}

#messages-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}

#messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.5);
    border-radius: 4px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.7);
}

/* Animations */
@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes glitchText {
    0%, 90%, 100% {
        opacity: 1;
    }
    92% {
        opacity: 0.8;
        transform: translate(-2px, 2px);
    }
    94% {
        opacity: 0.9;
        transform: translate(2px, -2px);
    }
}

@keyframes glitch {
    0%, 100% {
        text-shadow: 0 0 10px #0f0;
    }
    25% {
        text-shadow: -2px 0 #f00, 2px 0 #0ff;
    }
    50% {
        text-shadow: 2px 0 #f00, -2px 0 #0ff;
    }
    75% {
        text-shadow: 0 0 10px #0f0;
    }
}

@keyframes glitchTop {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes glitchBottom {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(2px, -2px);
    }
    40% {
        transform: translate(2px, 2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(-2px, 2px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes fadeInLine {
    to {
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulseFast {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

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