/* ==========================================================================
   AI Forum Simulator - Refreshed Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   ROOT & GENERAL STYLES
   - Defines CSS variables for the theme
   - Sets base styles for the body, fonts, and links
   -------------------------------------------------------------------------- */
:root {
    /* Default Fallback Theme Colors */
    --c-primary: #3c6a9e;
    --c-primary-dark: #2e5279;
    --c-primary-light: #5885b5;
    --c-header-text: #ffffff;
    --c-link: #00599F;
    --c-bg-light: #f7f9fa;
    --c-border: #e1e4e8;
    --c-text-light: #666;
    --c-text-dark: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: var(--c-text-dark);
    margin: 0;
    padding: 20px 0;
    font-size: 14px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   LAYOUT & CONTAINERS
   - Manages the main page structure and columns
   -------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border: 1px solid #d1d5da;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.container-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.content-wrapper {
    display: flex;
    flex-wrap: wrap;
    padding: 20px 15px;
    gap: 25px;
}

.main-column {
    flex: 3;
    min-width: 300px;
}

.sidebar-column {
    flex: 1;
    min-width: 240px;
}

/* --------------------------------------------------------------------------
   HEADER & NAVIGATION
   - Styles for the top bar, main header, and nav menu
   -------------------------------------------------------------------------- */
.top-bar {
    background: #f6f8fa;
    padding: 6px 0;
    border-bottom: 1px solid var(--c-border);
    font-size: 12px;
    text-align: right;
}

.header {
    background: var(--c-primary);
    color: var(--c-header-text);
    padding: 20px;
    border-bottom: 5px solid var(--c-primary-dark);
}
.header h1 { margin: 0; font-size: 28px; font-weight: 700; }
.header p { margin: 5px 0 0; font-style: normal; opacity: 0.9; font-weight: 300; }

.nav-bar {
    background: var(--c-primary-light);
    padding: 5px 15px;
    display: flex;
    gap: 5px;
    border-bottom: 1px solid var(--c-primary-dark);
    transition: box-shadow 0.2s;
}
.nav-button {
    padding: 8px 15px;
    color: var(--c-header-text);
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.nav-button:hover { background-color: var(--c-primary); text-decoration: none; }

/* --------------------------------------------------------------------------
   POSTS & FORMS
   - Styling for the main content: topics, posts, and forms
   -------------------------------------------------------------------------- */
.topic-title-header {
    background: var(--c-bg-light);
    border: 1px solid var(--c-border);
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}
.topic-title-header h2 { font-size: 22px; margin: 0; }

.post {
    border: 1px solid var(--c-border);
    margin-bottom: 15px;
    border-radius: 5px;
    overflow: hidden;
}
.post-header {
    background: var(--c-bg-light);
    color: var(--c-text-light);
    padding: 8px 12px;
    font-size: 12px;
    border-bottom: 1px solid var(--c-border);
}
.post-body { display: flex; }
.post-author {
    width: 170px;
    text-align: center;
    padding: 15px 10px;
    border-right: 1px solid var(--c-border);
    background: #fcfcfc;
    flex-shrink: 0;
}
.post-author .username { font-weight: bold; color: var(--c-link); display: block; margin-bottom: 10px; word-wrap: break-word; }
.post-avatar { width: 48px; height: 48px; border-radius: 50%; margin-top: 5px; }
.post-content { flex-grow: 1; padding: 15px; line-height: 1.6; }
.post-content p { margin: 0; }
.post-content p:not(:last-child) { margin-bottom: 1em; }

/* Forms */
.form-section { border-radius: 5px; overflow: hidden; border: 1px solid var(--c-border); }
.sub-header-form {
    background: var(--c-primary);
    color: var(--c-header-text);
    font-weight: bold;
    padding: 12px 15px;
}
.sub-header-form span { display: flex; align-items: center; gap: 8px; }
form { padding: 15px; background: #fff; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: bold; margin-bottom: 5px; }
.form-row input[type="text"], .form-row textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
}
.form-row textarea { resize: vertical; }
.form-actions { margin-top: 20px; }
button {
    background: var(--c-primary);
    color: var(--c-header-text);
    padding: 10px 18px;
    border: 1px solid var(--c-primary-dark);
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}
button:hover { background-color: var(--c-primary-dark); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.reply-form form { padding-top: 15px; }
.reply-form .form-row { margin: 0; }
.reply-form .form-actions { margin-top: 10px; text-align: right; }

/* --------------------------------------------------------------------------
   SIDEBAR & WIDGETS
   -------------------------------------------------------------------------- */
.sidebar-ad { text-align: center; margin-bottom: 20px; }
.sidebar-ad img { max-width: 100%; border: 1px solid var(--c-border); border-radius: 5px; }
.sidebar-widget { border: 1px solid var(--c-border); margin-bottom: 20px; border-radius: 5px; overflow: hidden; }
.widget-title {
    background: var(--c-bg-light);
    color: var(--c-text-dark);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid var(--c-border);
}
.widget-content { padding: 12px; background: #fff; font-size: 13px; line-height: 1.6; }
.poll-option { margin: 8px 0; }
.poll-button { margin-top: 10px; font-size: 12px !important; padding: 6px 12px !important; }

/* --------------------------------------------------------------------------
   FOOTER & MISC
   -------------------------------------------------------------------------- */
.footer { border-top: 1px solid #d1d5da; margin-top: 20px; padding: 20px; font-size: 12px; text-align: center; }
.footer-breadcrumb { color: var(--c-text-light); }
.footer-breadcrumb a { color: var(--c-text-light); }
.footer-bottom { margin-top: 10px; color: var(--c-text-light); }
.reset-link { color: #b0b0b0; font-size: 11px; margin-top: 15px; display: inline-block; }
.reset-link:hover { color: var(--c-link); }

/* Icons & Helpers */
.header-icon, .panel-icon { width: 16px; height: 16px; vertical-align: middle; }
.panel-icon { margin-right: 8px; }
.settings-trigger-btn { float: right; margin-left: 15px; width: 30px; height: 30px; cursor: pointer; border-radius: 5px; z-index: 1000; padding: 0; display: flex; align-items: center; justify-content: center; }
.settings-trigger-btn img { width: 18px; height: 18px; }

/* Error Box */
.error-box { background-color: #ffebe9; border: 1px solid #ffc2b8; color: #c82100; padding: 15px; margin-bottom: 15px; border-radius: 5px; }

/* --------------------------------------------------------------------------
   SETTINGS PANEL
   -------------------------------------------------------------------------- */
.settings-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1001; opacity: 0; visibility: hidden; transition: opacity 0.3s ease; }
.settings-backdrop.open { opacity: 1; visibility: visible; }
.settings-panel { position: fixed; top: 0; right: 0; width: 350px; max-width: 90%; height: 100%; background: #fff; box-shadow: -2px 0 8px rgba(0,0,0,0.2); z-index: 1002; padding: 20px; box-sizing: border-box; transform: translateX(100%); transition: transform 0.3s ease-in-out; }
.settings-panel.open { transform: translateX(0); }
.settings-panel .close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 28px; color: #999; cursor: pointer; }
.settings-panel h2 { display: flex; align-items: center; color: var(--c-link); }

/* ==========================================================================
   MOBILE & RESPONSIVE STYLES
   ========================================================================== */
@media (max-width: 768px) {
    body { padding: 0; }
    .container { border: none; box-shadow: none; }
    .content-wrapper { padding: 15px 10px; }

    /* --- ANCHORED MOBILE NAVIGATION --- */
    .nav-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    /* --- FIX FOR EMPTY SPACE IN POSTS --- */
    .post-body {
        flex-direction: column; /* Stack author/content vertically */
    }
    .post-author {
        width: auto; /* Allow author block to be full-width */
        border-right: none;
        border-bottom: 1px solid var(--c-border);
        display: flex; /* Make the author info a row */
        align-items: center;
        gap: 12px;
        text-align: left;
        padding: 10px;
    }
    .post-author .username { margin-bottom: 0; }
    .post-avatar { margin-top: 0; flex-shrink: 0; }
}
