/* ==========================================================================
   LA2WORLD FORUM STYLESHEET (High Five Dark-Gold Fantasy Theme)
   ========================================================================== */

:root {
    /* 30% darker obsidian card backgrounds for crisp structure & contrast */
    --forum-bg-card: rgba(11, 8, 6, 0.94);
    --forum-bg-card-hover: rgba(25, 17, 12, 0.98);
    --forum-bg-header: linear-gradient(90deg, rgba(38, 24, 14, 0.98) 0%, rgba(18, 12, 8, 0.98) 100%);
    --forum-border: rgba(255, 140, 0, 0.45);
    --forum-border-subtle: rgba(255, 140, 0, 0.18);
    --forum-border-glow: rgba(255, 180, 0, 0.7);
    --forum-card-shadow: 0 8px 30px rgba(0, 0, 0, 0.92), inset 0 1px 0 rgba(255, 215, 0, 0.12);
    
    /* Golden Palette (Replacing all white fonts) */
    --forum-gold-bright: #ffd700;
    --forum-gold-warm: #f39c12;
    --forum-gold-light: #e8cca0;
    --forum-gold-muted: #ab926e;
    --forum-gold-dark: #6e583c;
    --forum-orange: #ff7a00;
    --site-bg-overlay: rgba(0, 0, 0, 0.60);
    --site-bg-image: url('/img/bg/fantasy-dragon-lava-lineage-lineage_ii-1350444.jpeg');
}

/* --- Fixed Background & Scrollable Body --- */
body.forum-body {
    background-color: #080604 !important;
    background-image: 
        linear-gradient(var(--site-bg-overlay), var(--site-bg-overlay)),
        var(--site-bg-image) !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    background-size: cover !important;
    background-attachment: fixed !important; /* Static background, scrollable content */
    color: var(--forum-gold-light) !important;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    margin: 0 !important;
    padding: 15px 0 40px 0 !important;
    min-height: 100vh !important;
    display: block !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

/* Ensure layout-wrapper adapts to wide forum format */
body.forum-body .layout-wrapper {
    max-width: 1400px !important;
    width: 96% !important;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 18px !important;
}

/* De-constrict .container from main site 600px width */
body.forum-body .container,
body.forum-body .forum-main-container {
    width: auto !important;
    max-width: none !important;
    flex: 1 1 0 !important;
    min-height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    text-align: left !important;
    align-items: stretch !important;
    overflow: visible !important;
    display: block !important;
}

body.forum-body .container::before {
    display: none !important;
}

/* Dedicated Forum Inner Wrapper */
.forum-wrapper {
    width: 100%;
    margin: 0 0 40px 0;
    color: var(--forum-gold-light);
    font-family: inherit;
    text-align: left;
}

/* Global Golden Typography */
body.forum-body h1, 
body.forum-body h2, 
body.forum-body h3, 
body.forum-body h4 {
    color: var(--forum-gold-bright) !important;
    letter-spacing: 0.5px;
}

body.forum-body a {
    color: var(--forum-gold-bright);
    text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
}

body.forum-body a:hover {
    color: #fff9d6;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

/* Sticky Left Side Panel matching forum.png */
body.forum-body .side-panel.left-panel {
    position: sticky !important;
    top: 15px !important;
    align-self: flex-start !important;
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

/* Statically fixed / Sticky Forum Top Header matching forum.png */
.forum-sticky-header {
    position: sticky !important;
    top: 15px !important;
    z-index: 1000 !important;
    background: rgba(11, 8, 6, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
    border: 1px solid var(--forum-border) !important;
    border-radius: 10px !important;
    padding: 14px 22px 12px 22px !important;
    margin-bottom: 20px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 215, 0, 0.15) !important;
}

/* Hide any content scrolling past the top edge of the sticky header */
.forum-sticky-header::before {
    content: '' !important;
    position: absolute !important;
    top: -16px !important;
    left: -1px !important;
    right: -1px !important;
    height: 16px !important;
    background-color: #080604 !important;
    background-image: 
        linear-gradient(var(--site-bg-overlay), var(--site-bg-overlay)),
        var(--site-bg-image) !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    background-size: cover !important;
    background-attachment: fixed !important;
    pointer-events: none !important;
    z-index: 999 !important;
}

.forum-sticky-header .lang-switcher {
    position: absolute !important;
    top: 4px !important;
    right: 14px !important;
    left: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    pointer-events: auto !important;
    z-index: 10 !important;
}

.forum-sticky-header .lang-btn {
    display: inline-block !important;
    padding: 3px 8px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
    border: 1px solid var(--forum-orange) !important;
    color: var(--forum-gold-bright) !important;
    background: rgba(18, 12, 8, 0.95) !important;
    text-align: center !important;
    font-weight: bold !important;
    min-width: 44px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
}

.forum-sticky-header .lang-btn.active {
    background: var(--forum-orange) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(255, 122, 0, 0.6) !important;
}

/* --- Top Header & User Navigation Bar --- */
.forum-nav-bar {
    background: var(--forum-bg-card);
    border: 1px solid var(--forum-border);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    box-shadow: var(--forum-card-shadow);
    backdrop-filter: blur(8px);
}

.forum-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.forum-breadcrumbs a {
    color: var(--forum-gold-bright);
    text-decoration: none;
    transition: color 0.2s;
}

.forum-breadcrumbs a:hover {
    color: #fff9d6;
    text-shadow: 0 0 6px var(--forum-gold-bright);
}

.forum-breadcrumbs span.sep {
    color: var(--forum-gold-muted);
}

.forum-user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.forum-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--forum-orange);
    object-fit: cover;
    box-shadow: 0 0 8px rgba(255, 122, 0, 0.5);
    background: #111;
}

.forum-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    font-size: 12px;
}

.forum-user-name {
    font-weight: bold;
    color: var(--forum-gold-bright);
    display: flex;
    align-items: center;
    gap: 6px;
}

.forum-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(180deg, #c63901 0%, #8e2800 100%);
    color: var(--forum-gold-bright);
    border: 1px solid var(--forum-orange);
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(198, 57, 1, 0.4);
}

.forum-btn:hover {
    background: linear-gradient(180deg, #e04402 0%, #aa3000 100%);
    box-shadow: 0 0 14px rgba(255, 122, 0, 0.7);
    transform: translateY(-1px);
    color: #fff9d6;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

.forum-btn.secondary {
    background: rgba(30, 20, 14, 0.88);
    border-color: rgba(255, 140, 0, 0.35);
    color: var(--forum-gold-light);
    box-shadow: none;
}

.forum-btn.secondary:hover {
    background: rgba(45, 30, 20, 0.95);
    border-color: var(--forum-orange);
    color: var(--forum-gold-bright);
}

.forum-btn.danger {
    background: linear-gradient(180deg, #b0281b 0%, #7e1e14 100%);
    border-color: #e74c3c;
    color: #ffd7d7;
}

.forum-btn.danger:hover {
    background: linear-gradient(180deg, #cf3121 0%, #992518 100%);
    color: #fff;
}

/* --- Badges --- */
.badge-admin {
    background: linear-gradient(90deg, #b84500, #d35400);
    color: #ffd700;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 0.5px;
    border: 1px solid #ffd700;
    text-shadow: 1px 1px 1px #000;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

.badge-pinned {
    background: linear-gradient(135deg, #d35400 0%, #b84500 100%);
    color: #ffd700;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 215, 0, 0.45);
    box-shadow: 0 0 6px rgba(211, 84, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.badge-locked {
    background: #443c33;
    color: #cbb9a3;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #665b4f;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* --- Section Card & Topic Table (Darkened +30% Obsidian Boxes) --- */
.forum-card {
    background: var(--forum-bg-card);
    border: 1px solid var(--forum-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--forum-card-shadow);
    backdrop-filter: blur(8px);
}

.forum-card-header {
    background: var(--forum-bg-header);
    border-bottom: 2px solid var(--forum-border);
    padding: 13px 20px;
    font-size: 15px;
    font-weight: bold;
    color: var(--forum-gold-bright);
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.section-row {
    display: grid;
    grid-template-columns: 55px 1fr 140px 240px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--forum-border-subtle);
    align-items: center;
    transition: background 0.18s, border-left 0.18s;
    text-align: left;
    background: rgba(14, 10, 7, 0.88);
}

.section-row:last-child {
    border-bottom: none;
}

.section-row:hover {
    background: var(--forum-bg-card-hover);
    border-left: 3px solid var(--forum-orange);
}

.section-icon {
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.section-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.section-info h4 a {
    color: var(--forum-gold-bright);
    text-decoration: none;
    transition: color 0.2s;
}

.section-info h4 a:hover {
    color: #fff9d6;
    text-shadow: 0 0 6px var(--forum-gold-bright);
}

.section-desc {
    margin: 0;
    font-size: 12px;
    color: var(--forum-gold-muted);
    line-height: 1.4;
}

.section-stats {
    font-size: 12px;
    color: var(--forum-gold-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.section-stats b {
    color: var(--forum-gold-bright);
    font-size: 13px;
}

.section-last-post {
    font-size: 12px;
    color: var(--forum-gold-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-last-post a {
    color: var(--forum-gold-bright);
    text-decoration: none;
}

.section-last-post a:hover {
    color: #fff9d6;
    text-decoration: underline;
}

/* --- Topics List Table --- */
.topic-row {
    display: grid;
    grid-template-columns: 48px 1fr 120px 200px;
    padding: 13px 20px;
    border-bottom: 1px solid var(--forum-border-subtle);
    align-items: center;
    transition: background 0.18s, border-left 0.18s;
    text-align: left;
    background: rgba(14, 10, 7, 0.88);
}

.topic-row:hover {
    background: var(--forum-bg-card-hover);
    border-left: 3px solid var(--forum-orange);
}

.topic-row.pinned {
    background: rgba(255, 122, 0, 0.08);
    border-left: 3px solid var(--forum-orange);
}

.topic-icon {
    font-size: 22px;
    text-align: center;
    line-height: 1;
}

.topic-main h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topic-main h4 a {
    color: var(--forum-gold-bright);
    text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.topic-main h4 a:hover {
    color: #fff9d6;
    text-shadow: 0 0 6px var(--forum-gold-bright);
}

.topic-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.topic-meta {
    font-size: 11px;
    color: var(--forum-gold-muted);
}

.topic-meta b {
    color: var(--forum-gold-light);
}

/* --- Post View inside Topic --- */
.post-card {
    display: grid;
    grid-template-columns: 190px 1fr;
    border-bottom: 1px solid var(--forum-border-subtle);
    background: var(--forum-bg-card);
    text-align: left;
}

.post-card:last-child {
    border-bottom: none;
}

.post-author {
    padding: 20px 15px;
    background: rgba(0, 0, 0, 0.35);
    border-right: 1px solid var(--forum-border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 9px;
}

.post-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--forum-orange);
    object-fit: cover;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
    background: #111;
}

.post-author-name {
    font-weight: bold;
    font-size: 14px;
    color: var(--forum-gold-bright);
    word-break: break-all;
}

.post-content-wrap {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--forum-border-subtle);
    padding-bottom: 8px;
    margin-bottom: 14px;
    font-size: 11px;
    color: var(--forum-gold-muted);
}

.post-body {
    font-size: 14px;
    line-height: 1.65;
    color: var(--forum-gold-light);
    min-height: 60px;
    word-break: break-word;
}

.post-attachment {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--forum-border-subtle);
}

.post-attachment img {
    max-width: 500px;
    max-height: 400px;
    border-radius: 6px;
    border: 1px solid var(--forum-border);
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-attachment img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.9);
}

.forum-drop-zone.drag-over {
    border-color: var(--forum-orange) !important;
    background: rgba(255, 122, 0, 0.18) !important;
}

.post-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* --- Inline Formatting & Smileys --- */
.forum-inline-smiley {
    width: 22px;
    height: 22px;
    vertical-align: -4px;
    display: inline-block;
    margin: 0 1px;
}

.forum-quote {
    background: rgba(0, 0, 0, 0.45);
    border-left: 3px solid var(--forum-gold-bright);
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #ded1bf;
}

.quote-author {
    font-weight: bold;
    color: var(--forum-gold-bright);
    margin-bottom: 4px;
    font-size: 12px;
    font-style: normal;
}

.forum-code {
    background: #090705;
    border: 1px solid rgba(255, 140, 0, 0.25);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: Consolas, monospace;
    font-size: 12px;
    color: #4ade80;
}

/* --- Editor & Smileys Drawer --- */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: rgba(18, 12, 8, 0.9);
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--forum-border);
    border-bottom: none;
}

.editor-btn {
    background: rgba(45, 30, 20, 0.85);
    border: 1px solid rgba(255, 140, 0, 0.3);
    color: var(--forum-gold-light);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.15s;
}

.editor-btn:hover {
    background: var(--forum-orange);
    color: #fff;
    border-color: var(--forum-gold-bright);
}

.forum-textarea {
    width: 100%;
    min-height: 140px;
    background: rgba(9, 6, 4, 0.95);
    border: 1px solid var(--forum-border);
    border-radius: 0 0 8px 8px;
    color: var(--forum-gold-light);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}

.forum-textarea:focus {
    outline: none;
    border-color: var(--forum-gold-bright);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
}

.smileys-drawer {
    display: none;
    background: rgba(12, 9, 6, 0.98);
    border: 1px solid var(--forum-border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    max-height: 170px;
    overflow-y: auto;
}

.smileys-drawer.open {
    display: grid;
}

.smileys-drawer img {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: transform 0.15s, background 0.15s;
}

.smileys-drawer img:hover {
    transform: scale(1.3);
    background: rgba(255, 122, 0, 0.3);
}

/* --- Modal Dialog for Login / Images --- */
.forum-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    backdrop-filter: blur(6px);
}

.forum-modal-box {
    background: #0d0a07;
    border: 2px solid var(--forum-orange);
    border-radius: 12px;
    padding: 26px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 0 35px rgba(255, 122, 0, 0.6);
    position: relative;
    text-align: left;
    color: var(--forum-gold-light);
}

.forum-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: var(--forum-gold-muted);
    font-size: 22px;
    cursor: pointer;
    transition: color 0.15s;
}

.forum-modal-close:hover {
    color: #fff;
}

/* --- Responsive Adjustments --- */
@media (max-width: 900px) {
    body.forum-body .layout-wrapper {
        flex-direction: column;
    }
    body.forum-body .side-panel.left-panel {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 768px) {
    .section-row {
        grid-template-columns: 40px 1fr;
        gap: 10px;
        padding: 12px 14px;
    }
    .section-stats, .section-last-post {
        display: none;
    }
    .topic-row {
        grid-template-columns: 35px 1fr;
        padding: 12px 14px;
    }
    .topic-row .section-stats, .topic-row .section-last-post {
        display: none;
    }
    .post-card {
        grid-template-columns: 1fr;
    }
    .post-author {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--forum-border-subtle);
        padding: 12px 16px;
    }
    .post-avatar {
        width: 44px;
        height: 44px;
    }
}

/* Site-wide style.css hides every scrollbar (* { scrollbar-width: none }).
   Restore a visible themed scrollbar on forum pages only. */
html {
    scrollbar-width: thin !important;
    -ms-overflow-style: auto !important;
}
html::-webkit-scrollbar { width: 12px; height: 10px; display: block; }
html::-webkit-scrollbar-track { background: rgba(8, 6, 4, 0.85); }
html::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #b8862f, #6e5317);
    border-radius: 7px;
    border: 2px solid #0a0806;
}
html::-webkit-scrollbar-thumb:hover { background: #c9973a; }

/* Wiki map images: cap display size, full image opens on click (a href already wraps img) */
body.forum-body a.forum-img-wrapper {
    display: block;
    text-align: center;
    cursor: zoom-in;
}
body.forum-body img.forum-embedded-img {
    max-width: min(100%, 900px);
    max-height: 75vh;
    width: auto;
    height: auto;
    background: #0d0a06;
    border: 1px solid var(--border-subtle, rgba(200, 170, 90, 0.25));
    border-radius: 6px;
    padding: 4px;
}
