/* --- Global Styles & Calm Palette --- */
:root {
    --background-color: #1f2023; /* Near-black charcoal */
    --container-bg: #2a2c30; /* Dark grey for cards */
    --accent-color: #F0C987; /* Muted gold */
    --accent-color-dark: #D4AF78; /* Darker gold for hover */
    --primary-text: #EAEAEA; /* Soft, light grey for main text */
    --secondary-text: #9FA4A8; /* Dimmer grey for secondary text */
    --border-color: #383a3e; /* Subtle border for cards */
    --shadow-color: rgba(0, 0, 0, 0.2); /* Darker shadow for dark mode */
    --font-family: 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--primary-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Header --- */
header {
    background-color: var(--container-bg);
    padding: 20px 40px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    margin: 0;
    font-size: 2em;
    color: var(--primary-text);
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header p {
    margin: 5px 0 0;
    color: var(--secondary-text);
    font-size: 1.1em;
}

header h1, header h1 a {
    color: #FF9900; /* Bright Orange */
    text-shadow: 0 0 6px rgba(255, 153, 0, 0.4); /* Subtle glow */
}

/* --- Forms --- */
.post-form-container, .reply-form-container, .thread-list-container, #thread-container {
    background-color: var(--container-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-color);
    margin-bottom: 30px;
}

h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
    box-sizing: border-box;
    background-color: var(--background-color);
    color: var(--primary-text);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

#user-id-display {
    font-size: 0.9em;
    color: var(--secondary-text);
}

button[type="submit"] {
    background-color: var(--accent-color);
    color: #1f2023;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button[type="submit"]:hover {
    background-color: var(--accent-color-dark);
}

/* --- Thread & Post Items --- */
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.thread-item, .post-item {
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 6px;
    transition: box-shadow 0.2s ease;
    margin-bottom: 15px; /* Added space between threads */
}

.thread-item:last-child {
    margin-bottom: 0; /* No margin after the last item */
}

.mini-reply {
    margin-top: 15px;
    margin-left: 25px; /* Indent the mini-reply */
    padding-left: 15px;
    border-left: 3px solid var(--accent-color); /* Subtle visual cue */
    font-size: 0.9em;
    color: var(--secondary-text);
    background-color: var(--background-color); /* Slightly different background */
    padding-top: 10px;
    padding-bottom: 10px;
    border-radius: 0 6px 6px 0;
}

.mini-reply .author {
    font-weight: bold;
    color: var(--primary-text);
}

.mini-reply .content {
    white-space: pre-wrap;
}

.thread-item:hover {
    box-shadow: 0 2px 5px var(--shadow-color);
    border-color: var(--secondary-text);
}

.thread-item a {
    text-decoration: none;
    color: inherit;
}

.thread-item-placeholder, .post-item-placeholder {
    color: var(--secondary-text);
    text-align: center;
    padding: 20px;
}

.post-meta {
    font-size: 0.9em;
    color: var(--secondary-text);
    margin-bottom: 10px;
}

.post-meta .author {
    font-weight: bold;
    color: var(--primary-text);
}

.post-content {
    white-space: pre-wrap; /* Preserves formatting */
}

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

.action-button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--secondary-text);
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.action-button:hover {
    background-color: var(--background-color);
    border-color: var(--secondary-text);
}

/* --- Footer --- */
footer {
    background-color: var(--container-bg);
    text-align: center;
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    display: flex;
    justify-content: center;
    gap: 25px;
}

/* --- Safety Notice --- */
#safety-notice {
    background-color: #3d3a32;
    border: 1px solid #F0C987;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

#safety-notice h2 {
    margin-top: 0;
    color: #F0C987;
    font-size: 1.2em;
    border-bottom: none;
}
#safety-notice a {
    color: #F0C987;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    header {
        padding: 15px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header p {
        font-size: 1em;
    }

    main {
        padding: 15px;
    }

    .post-form-container, .reply-form-container, .thread-list-container, #thread-container {
        padding: 20px;
    }

    textarea {
        min-height: 100px;
    }

    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    button[type="submit"] {
        width: 100%;
        padding: 10px;
    }

    .mini-reply {
        margin-left: 15px;
        padding-left: 10px;
    }

    .action-button {
        padding: 4px 8px;
        font-size: 0.85em;
    }

    footer {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
}