:root {
    --bg-color: #0d0d0d;
    --card-bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --admin-color: #ff3b30; /* Red */
    --user-color: #4a90e2; /* Blue */
    --border-color: #333;
    --highlight-color: #c0c0c0;
    --glitch-color1: #ff00c1;
    --glitch-color2: #00e8ff;
}

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

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: filter 0.3s ease;
}

header {
    background-color: var(--card-bg-color);
    padding: 20px 40px;
    border-bottom: 2px solid var(--highlight-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
}

.glitch {
    font-family: 'Oswald', sans-serif;
    font-size: 2.5rem;
    color: var(--highlight-color);
    position: relative;
    animation: glitch-anim-text 2s infinite linear alternate;
}

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

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--glitch-color1);
    animation: glitch-anim-1 2s infinite linear alternate;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--glitch-color2), 2px 2px var(--glitch-color1);
    animation: glitch-anim-2 2s infinite linear alternate;
}

@keyframes glitch-anim-text {
    0% { clip-path: inset(30% 0 10% 0); }
    20% { clip-path: inset(5% 0 85% 0); }
    40% { clip-path: inset(10% 0 20% 0); }
    60% { clip-path: inset(70% 0 10% 0); }
    80% { clip-path: inset(20% 0 70% 0); }
    100% { clip-path: inset(40% 0 40% 0); }
}
@keyframes glitch-anim-1 {
    0% { clip-path: inset(5% 0 85% 0); }
    20% { clip-path: inset(70% 0 10% 0); }
    40% { clip-path: inset(20% 0 70% 0); }
    60% { clip-path: inset(40% 0 40% 0); }
    80% { clip-path: inset(10% 0 20% 0); }
    100% { clip-path: inset(30% 0 10% 0); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(40% 0 40% 0); }
    20% { clip-path: inset(10% 0 20% 0); }
    40% { clip-path: inset(70% 0 10% 0); }
    60% { clip-path: inset(5% 0 85% 0); }
    80% { clip-path: inset(30% 0 10% 0); }
    100% { clip-path: inset(20% 0 70% 0); }
}

.user-info-container {
    display: flex;
    align-items: center;
}

#loggedInUser {
    margin-right: 15px;
    font-size: 1.1rem;
    color: var(--admin-color);
    font-weight: bold;
}

button {
    font-family: 'Roboto Mono', monospace;
    padding: 10px 20px;
    background-color: var(--highlight-color);
    color: var(--bg-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #fff;
    transform: translateY(-2px);
}

main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.admin-controls-panel {
    background-color: var(--card-bg-color);
    border: 1px solid var(--admin-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}
.admin-controls-panel hr {
    border-color: var(--border-color);
    margin: 15px 0;
}
.control-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.control-group input {
    flex-grow: 1;
}

.post-form-container {
    position: sticky;
    top: 90px; /* Adjust this value to be below the header */
    z-index: 10;
    padding: 20px 0;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.post-form, .post {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
}

.post {
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-form h2 {
    color: var(--highlight-color);
    margin-bottom: 15px;
    font-family: 'Oswald', sans-serif;
}

.post-form input, .post-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 5px;
    resize: vertical;
    font-family: 'Roboto Mono', monospace;
    transition: border-color 0.3s ease;
}

.post-form input:focus, .post-form textarea:focus {
    outline: none;
    border-color: var(--highlight-color);
}

.post-form button {
    width: 100%;
    background-color: var(--highlight-color);
}

.post h3 {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.post .nickname.admin-prefix {
    color: var(--admin-color);
    text-shadow: 0 0 8px rgba(255, 59, 48, 0.7);
    font-weight: bold;
    font-family: 'Oswald', sans-serif;
    animation: flash-red 2s infinite;
}
@keyframes flash-red {
    0%, 100% { color: var(--admin-color); }
    50% { color: #ff8c8c; }
}

.post .nickname.user-prefix {
    color: var(--user-color);
    font-weight: bold;
}

.post .timestamp {
    font-size: 0.8rem;
    color: #888;
    margin-left: auto;
}

.post-content-text {
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.post-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.post-actions button {
    padding: 8px 15px;
    font-size: 0.9rem;
    background-color: var(--border-color);
    color: var(--text-color);
}

.post-actions .edit-btn:hover { background-color: #2e7d32; }
.post-actions .delete-btn:hover { background-color: #c62828; }

footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--card-bg-color);
    margin-top: auto;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    position: relative;
    transform: scale(0.95);
    animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes modal-pop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-button {
    color: var(--text-color);
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}
.close-button:hover { color: var(--highlight-color); }

.modal-content h2 {
    color: var(--highlight-color);
    margin-bottom: 20px;
    text-align: center;
    font-family: 'Oswald', sans-serif;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 5px;
    font-family: 'Roboto Mono', monospace;
}

.forum-closed-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10;
    color: var(--admin-color);
    font-size: 3rem;
    text-align: center;
    padding-top: 30vh;
    font-family: 'Oswald', sans-serif;
    text-shadow: 0 0 10px var(--admin-color);
}
