/* --- BATTLEWARZ THEME VARIABLES --- */
:root {
    --primary-red: #cf0000;
    --primary-blue: #00a8ff;
    --bg-dark: #121212;
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --panel-bg: rgba(255, 255, 255, 0.05);
}

/* --- MAIN BODY & LAYOUT --- */
body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #2a2a2a 0%, #121212 60%);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif;
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
    margin: 0;
    overflow-y: scroll;
}

/* Link Styles */
a:link, a:visited { color: #4db8ff; text-decoration: none; }
a:hover, a:active { color: #ff6666; text-decoration: none; transition: color 0.2s; }

/* The main container for content */
#container {
    color: var(--text-main);
    text-align: left;
    line-height: 1.5;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif;
    font-size: 13px;
}

/* Wrapper */
.wrapper {
    width: 85%;
    min-width: 970px;
    max-width: 1500px;
    margin: auto auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
}

/* --- HEADER & LOGO --- */
#logo {
    background: transparent;
    padding: 15px 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 20px;
}

#content {
    background: transparent;
    width: auto !important;
    padding: 20px 0;
    overflow: hidden;
}

/* Search Container */
#search {
    border: none;
    padding: 0;
    margin: 0;
    float: right;
    display: flex;
    align-items: center;
}

/* HEADER MENU */
#header ul.menu {
    margin: 1rem;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

#header ul.menu li {
    display: inline-block;
}

#header ul.menu li a {
    color: #fff;
    font-weight: 700;
    font-size: 13px; 
    padding: 6px 12px; 
    border-radius: 6px;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap; 
    display: inline-block;
}

#header ul.menu li a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* --- PANEL (Welcome Back & User Links) --- */
#panel {
    background: var(--panel-bg); 
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
}

#panel .upper {
    background: rgba(40, 40, 40, 0.8); 
    color: #fff;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

#panel .upper a:link, #panel .upper a:visited {
    color: #fff;
    font-weight: bold;
    margin-left: 10px;
    white-space: nowrap;
}

#panel .upper a:hover { color: var(--primary-blue); }

/* Panel Lower (User CP etc) */
#panel .lower {
    background: rgba(40, 40, 40, 0.8);
    color: #ddd;
    padding: 8px 15px; 
    font-size: 11px;
    display: flex; 
    flex-direction: row; 
    flex-wrap: nowrap;   
    justify-content: flex-start;
    align-items: center;
    border-top: none;
    gap: 0;
    overflow: hidden;
}

#panel .lower ul.panel_links,
#panel .lower ul.user_links {
    margin: 0;
    padding: 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
}

#panel .lower ul.panel_links { float: none !important; margin-right: 10px; }
#panel .lower ul.user_links { float: none !important; }

#panel .lower ul.panel_links li,
#panel .lower ul.user_links li {
    display: inline-block;
    list-style: none;
}

#panel .lower a:link, #panel .lower a:visited {
    color: #ddd; 
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 8px; 
    margin-right: 5px;
    background: rgba(0,0,0,0.2); 
    border-radius: 4px;
    border: 1px solid transparent;
    display: inline-block;
}

#panel .lower a:hover {
    color: #fff; 
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    text-shadow: 0 0 5px var(--primary-blue);
}


/* --- GLASSMORPHISM TABLES --- */
.tborder {
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    width: 100%;
    margin: auto auto;
    padding: 0;
    overflow: hidden;
}

.thead {
    background: linear-gradient(90deg, #222, #333);
    border-bottom: 2px solid var(--primary-red);
    color: #ffffff;
    padding: 12px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 14px;
}
.thead a:link, .thead a:visited { color: #ffffff; }
.thead a:hover, .thead a:active { color: #ccc; text-decoration: underline; }

.tcat {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-bottom: 1px solid var(--glass-border);
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.tcat a:link, .tcat a:visited { color: #fff; }

.trow1 {
    background: rgba(40, 40, 40, 0.4);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px;
}

.trow2 {
    background: rgba(60, 60, 60, 0.4);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px;
}

.trow_shaded {
    background: rgba(207, 0, 0, 0.15);
    border-bottom: 1px solid var(--primary-red);
}

.trow_selected, tr.trow_selected td {
    background: rgba(0, 168, 255, 0.2);
    color: #fff;
}

/* --- THREAD LAYOUT (FLEXBOX REPAIR) --- */
/* Ensure the post container is a flex row */
.post {
    display: flex;
    flex-direction: row;
    align-items: stretch; /* Keep columns equal height */
    width: 100%;
    border-bottom: 1px solid var(--glass-border);
    overflow: hidden; /* Clear floats */
}

/* Override Classic Postbit specific styles if present */
.post.classic {
    display: flex;
    flex-direction: row;
}

/* Left Column: Author Info */
.post_author {
    width: 220px; /* Fixed width */
    min-width: 220px; /* Force minimum width so it doesn't squish */
    flex-shrink: 0; /* Do NOT allow shrinking */
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--glass-border);
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center avatar and text */
}

/* Author Avatar Image */
.post_author .author_avatar img {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: 4px;
    border: 3px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
    display: block; /* Ensure it's a block to prevent inline weirdness */
}

/* Stats Text */
.post_author .author_statistics {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 5px;
    width: 100%; /* Ensure it fills the column width */
}

/* Right Column: Content */
.post_content {
    flex-grow: 1; /* Take up all remaining space */
    width: 0; /* Hack to prevent flex item overflow */
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    position: relative; /* Context for absolute positioning if needed */
}

/* Post Header (Date, #1) */
.post_head {
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 15px;
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* Post Body (The Message) */
.post_body {
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    min-height: 100px;
}

/* Post Controls (Buttons) */
.post_controls {
    margin-top: 0px;
    padding-top: 5px;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

/* Buttons */
.postbit_buttons > a {
    display: inline-block;
    padding: 4px 8px;
    margin: 0 2px;
    font-size: 11px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    border-radius: 4px;
    white-space: nowrap;
}

.postbit_buttons > a:hover {
    color: #fff;
    border-color: var(--primary-blue);
    background: rgba(0, 168, 255, 0.1);
    text-decoration: none;
}

/* --- RATINGS ALIGNMENT FIX --- */
.thread_legend dd, .forum_legend dd, .rating {
    display: inline-block; 
    margin-right: 10px;
    vertical-align: middle;
}

.rating img {
    display: inline; 
    vertical-align: middle;
    width: 14px; 
    height: 14px;
}

/* --- BUTTONS & INPUTS --- */
button, input.button {
    padding: 6px 12px; 
    margin: 5px; 
    cursor: pointer;
    font-family: 'Segoe UI', sans-serif;
    font-size: 12px; 
    background: var(--primary-red);
    border: none;
    color: #fff;
    outline: 0;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    display: inline-block;
}

button:hover, input.button:hover {
    background: #ff3333;
    box-shadow: 0 0 15px rgba(207, 0, 0, 0.6);
}

/* Inputs/Textareas */
input.textbox, textarea, select {
    background: rgba(255,255,255,0.1); 
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1); 
    padding: 8px;
    outline: 0;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    border-radius: 4px;
}

input.textbox:focus, textarea:focus {
    border-color: var(--primary-blue);
    background: rgba(255,255,255,0.15);
}

/* --- UTILITIES & NAVIGATION --- */
#footer ul.menu {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

#footer ul.menu li a {
    color: #888;
    font-weight: bold;
    white-space: nowrap;
}
#footer ul.menu li a:hover { color: #fff; }

#footer .upper {
    background: rgba(30, 30, 30, 0.9);
    padding: 15px;
    color: #aaa;
}

/* Fix for icons */
.forum_status { filter: grayscale(100%); opacity: 0.8; }
.forum_on { filter: none; opacity: 1; } 

/* Blockquote & Code */
blockquote {
    border: 1px solid var(--primary-red);
    margin: 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-left-width: 4px;
    color: #e0e0e0;
    border-radius: 4px;
}

.codeblock {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 10px;
    color: #0f0;
    border-radius: 4px;
}

/* Pagination */
.pagination a {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    border-radius: 3px;
}

.pagination .pagination_current {
    background: var(--primary-red);
    color: #fff;
    border: none;
    font-weight: bold;
    border-radius: 3px;
}

/* Misc */
.tfoot {
    border-top: 1px solid var(--glass-border);
    background: rgba(30,30,30,0.8);
    color: #aaa;
    padding: 10px;
}

.bottommenu {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 10px;
    color: #aaa;
    border-radius: 6px;
    margin-top: 10px;
}