/* =============================================================================
   SHARED STYLES - Global styles used across multiple pages
   ============================================================================= */

/* --- ROOT VARIABLES --- */
:root {
    /* Color Palette */
    --dark-bg: #0d0d0d;
    --content-bg: #1a1a1a;
    --main-red: #ff3b3b;
    --hover-red: #ff5c5c;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    
    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-size-base: 16px;
    --font-size-heading: 3rem;
    
    /* Layout */
    --header-height: 70px;
    --max-content-width: 1200px;
    --spacing-unit: 1rem;
    
    /* Effects */
    --backdrop-blur: 10px;
    --transition-speed: 0.3s;
}

/* --- GLOBAL RESETS & BASE STYLES --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: var(--font-size-base);
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* --- MATRIX BACKGROUND CANVASES --- */
canvas#matrix-bg,
#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

canvas#matrix-bg {
    z-index: -2;
}

#matrix-rain {
    z-index: -1;
    opacity: 0.6;
}

/* --- HEADER & NAVIGATION --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    background: rgba(13, 13, 13, 0.8);
    backdrop-filter: blur(var(--backdrop-blur));
    border-bottom: 1px solid var(--border-color);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-content-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

.nav-logo img {
    height: 45px;
    transition: transform var(--transition-speed) ease;
}

.nav-logo img:hover {
    transform: scale(1.1);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    position: relative;
    transition: color var(--transition-speed) ease;
}

.nav-links a:hover {
    color: var(--main-red);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--main-red);
    transform: translateX(-50%);
    transition: width var(--transition-speed) ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-actions .cta-button {
    background-color: var(--main-red);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 700;
    transition: background-color var(--transition-speed) ease,
                transform var(--transition-speed) ease;
}

.nav-actions .cta-button:hover {
    background-color: var(--hover-red);
    transform: translateY(-2px);
}

/* --- TYPOGRAPHY --- */
h1 {
    font-size: var(--font-size-heading);
    font-weight: 900;
    color: #fff;
    margin-bottom: 40px;
    text-shadow: 0 0 10px var(--main-red),
                 0 0 20px var(--main-red),
                 0 0 30px var(--main-red);
    animation: neon-flicker 1.5s infinite alternate;
}

/* --- COMMENT SYSTEM STYLES --- */
.comment-item {
    margin-top: 20px;
}

.comment-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.comment-pfp {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-pfp-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #555;
    flex-shrink: 0;
}

.comment-body {
    background: #222;
    padding: 8px 12px;
    border-radius: 10px;
    width: 100%;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.comment-author {
    font-weight: bold;
}

.comment-admin-buttons {
    margin-left: auto;
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.comment-content {
    margin: 5px 0 0;
    color: #ddd;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.comment-footer {
    display: flex;
    align-items: center;
    margin-top: 8px;
    gap: 15px;
    flex-wrap: wrap;
}

.comment-date {
    color: #888;
    font-size: 0.7rem;
}

.comment-edited {
    font-style: italic;
    color: #888;
}

.comment-children {
    margin-left: 40px;
}

.reply-form,
.add-comment-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.reply-form {
    margin-left: 40px;
}

.comment-input {
    flex: 1;
    background: #222;
    color: #eee;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 8px;
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.comment-input:focus {
    outline: none;
    border-color: var(--main-red);
    box-shadow: 0 0 5px rgba(255, 59, 59, 0.3);
}

.comment-submit,
.comment-save {
    font-size: 0.8rem;
    padding: 8px 12px;
    margin: 0;
    white-space: nowrap;
}

.comment-cancel,
.comment-cancel-edit {
    font-size: 0.8rem;
    padding: 8px 12px;
    margin: 0;
    background: #555;
    border-color: #777;
    white-space: nowrap;
}

.comment-cancel:hover,
.comment-cancel-edit:hover {
    background: #666;
    box-shadow: 0 0 15px rgba(102, 102, 102, 0.5);
}

.edit-comment-form {
    margin-top: 10px;
}

.comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    background: #111;
    color: #eee;
    border: 1px solid var(--main-red);
    border-radius: 5px;
    padding: 10px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    resize: vertical;
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: var(--hover-red);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.3);
}

.edit-comment-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.post-action-btn {
    background: var(--content-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
}

.post-action-btn:hover {
    background: #2a2a2a;
    border-color: var(--main-red);
}

.post-action-btn.delete {
    color: #ff6b6b;
}

.post-action-btn.delete:hover {
    background: rgba(255, 59, 59, 0.1);
    border-color: #ff6b6b;
}

/* --- SHARED COMPONENTS --- */
.footer {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    padding: 10px 20px;
    background-color: rgba(18, 18, 18, 0.5);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    text-align: center;
    border: 1px solid rgba(255, 59, 59, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.2);
    z-index: 1000;
}

.footer-link {
    color: var(--main-red);
    text-decoration: none;
    transition: color var(--transition-speed) ease,
                text-shadow var(--transition-speed) ease;
}

.footer-link:hover {
    color: var(--hover-red);
    text-shadow: 0 0 6px var(--main-red);
}

.section-connector {
    display: block;
    width: 6px;
    height: 50px;
    margin: 30px auto;
    background: linear-gradient(to bottom, var(--main-red), #555);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out,
                transform 0.8s ease-out;
    animation: wind 2s infinite ease-in-out;
}

.section-connector.visible {
    opacity: 1;
    transform: translateY(0);
}

.cta-button {
    display: inline-block;
    padding: 15px 35px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: var(--main-red);
    border: 2px solid var(--hover-red);
    border-radius: 5px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
    animation: pulseGlow 2s infinite ease-in-out;
}

.cta-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px var(--main-red),
                0 0 50px var(--main-red);
}

/* --- ANIMATIONS --- */
@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 0 0 10px var(--main-red),
                     0 0 20px var(--main-red),
                     0 0 30px var(--main-red);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 10px var(--main-red),
                    0 0 20px var(--main-red);
    }
    50% {
        box-shadow: 0 0 25px var(--main-red),
                    0 0 50px var(--main-red);
    }
}

@keyframes wind {
    0%, 100% {
        transform: translateY(20px) scaleY(1);
    }
    50% {
        transform: translateY(0) scaleY(1.1) skewX(5deg);
    }
}

/* --- ACCESSIBILITY & INTERACTION --- */
a,
button,
[role="button"] {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="10" fill="none" stroke="%23ff3b3b" stroke-width="2" opacity="0.8"/><circle cx="16" cy="16" r="5" fill="%23ff3b3b"/></svg>') 16 16, pointer;
}

a:focus,
button:focus,
[role="button"]:focus {
    outline: 2px solid var(--main-red);
    outline-offset: 2px;
    box-shadow: 0 0 10px var(--main-red);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    :root {
        --font-size-heading: 2rem;
    }
    
    .nav-links,
    .nav-actions {
        display: none;
    }
    
    .navbar {
        justify-content: center;
    }
    
    .footer {
        display: none;
    }
    
    .cta-button {
        padding: 12px 25px;
        font-size: 1rem;
    }

    /* Comment system responsive adjustments */
    .comment-children {
        margin-left: 20px;
    }

    .reply-form {
        margin-left: 20px;
        flex-direction: column;
    }

    .comment-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .comment-admin-buttons {
        margin-left: 0;
        margin-top: 5px;
    }

    .edit-comment-actions {
        flex-direction: column;
    }

    .comment-submit,
    .comment-save,
    .comment-cancel,
    .comment-cancel-edit {
        width: 100%;
        text-align: center;
    }
}

/* --- REDUCED MOTION SUPPORT --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    /* Preserve essential glitch animations */
    .glitch::before {
        animation: glitch-anim-1 2.5s infinite linear alternate-reverse !important;
    }
    
    .glitch::after {
        animation: glitch-anim-2 2.5s infinite linear alternate-reverse !important;
    }
    
    /* Disable decorative animations */
    h1:not(.glitch),
    .section-connector,
    .cta-button {
        animation: none !important;
    }
}
