@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

html, body {
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    font-family: 'VT323', monospace;
    font-size: 20px;
    line-height: 1.5;
    overflow-x: hidden;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.15);
}

/* ── Split layout ─────────────────────────────────────── */

#layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

#terminal-panel {
    width: 50%;
    min-height: 100vh;
    border-right: 1px solid #222;
}

#right-panel {
    width: 50%;
    min-height: 100vh;
}

/* ── Terminal ─────────────────────────────────────────── */

#terminal {
    width: 80ch;
    max-width: 92%;
    min-height: 100vh;
    margin: 0 auto;
    padding: 60px 20px 40px;
}

#terminal-text {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

#prompt-line {
    display: none;
    line-height: inherit;
}

#prompt-line.active {
    display: block;
}

.blink {
    animation: blink-animation 1s step-end infinite;
}

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

#hidden-input {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    width: 1px;
    height: 1px;
}

::selection {
    background: #fff;
    color: #000;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #333;
}

/* ── Chat panel (right side) ─────────────────────────── */

#chat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #333;
    font-size: 18px;
}

#chat-container {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: #0a0a0a;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #333;
}

.chat-empty {
    color: #555;
    text-align: center;
    margin-top: 40px;
}

/* ── Date separators ──────────────────────────────────── */

.chat-date-sep {
    text-align: center;
    color: #555;
    font-size: 16px;
    padding: 12px 0 6px;
}

/* ── Message rows ─────────────────────────────────────── */

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 80%;
    position: relative;
    padding: 2px 0;
}

.chat-msg-other {
    align-self: flex-start;
}

.chat-msg-self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Avatar (other users only) */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e1e2e;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
    text-shadow: none;
}

/* Hide avatar on continuation messages */
.chat-msg-cont .chat-avatar {
    visibility: hidden;
}

.chat-msg-cont .chat-meta {
    display: none;
}

.chat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-meta {
    display: flex;
    gap: 8px;
    font-size: 15px;
    color: #666;
    text-shadow: none;
}

.chat-msg-self .chat-meta {
    justify-content: flex-end;
}

.chat-username {
    color: #999;
}

.chat-time {
    color: #555;
}

/* ── Bubbles ──────────────────────────────────────────── */

.chat-bubble {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-shadow: none;
}

.chat-msg-other .chat-bubble {
    background: #1e1e2e;
    color: #ddd;
}

.chat-msg-self .chat-bubble {
    background: #1a2744;
    color: #ddd;
}

.chat-bubble img {
    max-width: 280px;
    max-height: 200px;
    border-radius: 4px;
    display: block;
    margin-top: 6px;
}

/* ── Admin delete button ──────────────────────────────── */

.chat-delete-btn {
    position: absolute;
    top: 4px;
    color: #993333;
    cursor: pointer;
    font-size: 18px;
    padding: 0 6px;
    opacity: 0;
    transition: opacity 0.15s;
    text-shadow: none;
}

.chat-msg:hover .chat-delete-btn {
    opacity: 1;
}

.chat-msg-other .chat-delete-btn {
    right: -24px;
}

.chat-msg-self .chat-delete-btn {
    left: -24px;
    right: auto;
}

/* ── Image preview ────────────────────────────────────── */

#chat-image-preview {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #0e0e0e;
    border-top: 1px solid #1a1a1a;
}

#chat-image-preview img {
    max-height: 60px;
    border-radius: 4px;
}

.remove-preview {
    color: #993333;
    cursor: pointer;
    font-size: 20px;
    padding: 0 6px;
}

/* ── Chat input area ──────────────────────────────────── */

#chat-input-area {
    display: none;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #222;
    background: #0a0a0a;
    align-items: center;
}

#chat-text-input {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ddd;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 12px;
    outline: none;
    text-shadow: none;
}

#chat-text-input::placeholder {
    color: #444;
}

#chat-text-input:focus {
    border-color: #444;
}

#chat-send-btn,
#chat-upload-btn {
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px 14px;
    cursor: pointer;
    text-shadow: none;
}

#chat-send-btn:hover,
#chat-upload-btn:hover {
    background: #222;
    color: #ccc;
}

/* ── Delete modal ─────────────────────────────────────── */

#delete-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#delete-modal.active {
    display: flex;
}

#delete-modal-content {
    background: #111;
    border: 1px solid #333;
    padding: 30px 40px;
    text-align: center;
    text-shadow: none;
}

#delete-modal-content p {
    margin-bottom: 20px;
    font-size: 20px;
}

#delete-modal-content button {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 24px;
    margin: 0 8px;
    border: 1px solid #333;
    cursor: pointer;
}

#delete-confirm-btn {
    background: #661a1a;
    color: #fff;
}

#delete-confirm-btn:hover {
    background: #882222;
}

#delete-cancel-btn {
    background: #222;
    color: #ccc;
}

#delete-cancel-btn:hover {
    background: #333;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 900px) {
    #layout {
        flex-direction: column;
    }

    #terminal-panel {
        width: 100%;
        border-right: none;
    }

    #right-panel {
        display: none;
    }

    /* On postings page, show the right panel stacked below */
    body[data-page="postings"] #right-panel {
        display: block;
        width: 100%;
        height: 60vh;
    }

    body[data-page="postings"] #terminal-panel {
        min-height: auto;
    }

    body[data-page="postings"] #terminal {
        min-height: auto;
    }

    body[data-page="postings"] #chat-container {
        height: 60vh;
    }
}

@media (max-width: 600px) {
    html, body {
        font-size: 16px;
    }

    #terminal {
        padding: 30px 12px 20px;
    }
}
