/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --bg-body: #131313;
    --bg-header: #18181b;
    --bg-card: #1c1c1c;
    --bg-block-header: #1e1e2d;
    --text-main: #e4e4e7;
    --text-muted: #a1a1aa;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border: #27272a;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* BBCode Styles */
.bb-size-1 {
    font-size: 10px;
}

.bb-size-2 {
    font-size: 12px;
}

.bb-size-3 {
    font-size: 14px;
}

.bb-size-4 {
    font-size: 16px;
}

.bb-size-5 {
    font-size: 20px;
}

.bb-size-6 {
    font-size: 24px;
}

.bb-size-7 {
    font-size: 32px;
}

/* Media Queries */
/* Header */
header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Main Content Wrapper */
.layout-wrapper {
    flex: 1 0 auto;
}

/* Navigation */
.nav-menu {
    display: flex;
    gap: 5px;
    align-items: center;
}

.nav-item {
    padding: 8px 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

/* User Controls */
.user-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.mobile-menu-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-top: 20px;
}

/* Thread List */
.thread-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.thread-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.thread-row:last-child {
    border-bottom: none;
}

.thread-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.thread-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.thread-main {
    flex: 1;
    min-width: 0;
}

.thread-title {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.thread-title:hover {
    color: var(--primary);
}

.thread-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.thread-stats {
    width: 80px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.thread-last-post {
    width: 180px;
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Thread Badges */
.thread-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    margin-right: 6px;
}

.badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-green {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Filter Items (Tabs) */
.filter-item {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.editor-btn {
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #a1a1aa;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.editor-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.filter-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.filter-item.active {
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 15px;
}

/* User Profile Widget */
.user-profile-widget {
    text-align: center;
}

.user-avatar-lg {
    width: 96px;
    height: 96px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    text-align: center;
}

/* Online List */
.online-list {
    font-size: 12px;
    line-height: 1.8;
}

.online-user {
    font-weight: 500;
}

/* Button */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-telegram {
    width: 100%;
    background: #0088cc;
    margin-bottom: 8px;
}

/* Utility Classes */
.d-flex {
    display: flex;
}

.gap-2 {
    gap: 10px;
}

.justify-between {
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 10px 15px;
    background: #18181b;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .sidebar-card {
        margin-bottom: 0;
    }

    .thread-last-post {
        display: none;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }

    .thread-stats {
        display: none;
    }

    .announcement-banner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .announcement-banner .d-flex {
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center;
    }

    .footer-social {
        justify-content: center;
    }

    /* Header Mobile Fixes */
    header .container {
        padding: 0 15px;
        height: 60px;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-header);
        flex-direction: column;
        padding: 10px;
        border-bottom: 1px solid var(--border);
        gap: 0;
        z-index: 1000;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-item {
        width: 100%;
        padding: 12px 15px;
        border-radius: 0;
    }

    .user-controls {
        gap: 10px;
    }

    .user-controls .d-flex.gap-2 {
        display: flex !important;
    }

    .lang-link:hover {
        opacity: 1 !important;
        transform: scale(1.1);
    }

    .user-controls .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    @media (max-width: 480px) {
        .user-name-header {
            display: none;
        }

        .header-left div span:last-child {
            display: none;
            /* Hide CNR part of logo if needed, but let's keep it for now */
        }
    }

    /* view_forum mobile fixes */
    .thread-list header,
    .thread-list [style*="display: flex;"] {
        font-size: 11px;
    }

    .thread-row {
        gap: 10px;
        padding: 10px;
    }

    .thread-icon {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    /* view_topic mobile fixes */
    .post-container {
        flex-direction: column !important;
    }

    .post-sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        display: flex !important;
        align-items: center;
        text-align: left !important;
        padding: 10px 15px !important;
        gap: 15px;
    }

    .post-sidebar img {
        width: 40px !important;
        height: 40px !important;
        margin-bottom: 0 !important;
    }

    .post-sidebar .user-info-brief {
        display: flex;
        flex-direction: column;
    }

    .post-sidebar .user-stats-minimal {
        display: none !important;
    }

    .post-content {
        padding: 15px !important;
    }
}

.announcement-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #18181b;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #27272a;
}

/* Specific Sidebar Widgets */
.widget-server {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: none !important;
}

.widget-discord {
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%) !important;
    border: none !important;
}

.widget-title {
    color: white;
    font-size: 14px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-inner {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.widget-btn {
    background: white !important;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    display: block;
    text-decoration: none;
    width: 100%;
    padding: 10px;
    border-radius: 6px;
}

.widget-server .widget-btn {
    color: #059669 !important;
}

.widget-discord .widget-btn {
    color: #5865F2 !important;
}

/* Footer Styling */
footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 40px 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: white;
    font-size: 15px;
    margin-bottom: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.social-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.social-icon:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
}

.social-icon.discord {
    color: #5865F2;
}

.social-icon.telegram {
    color: #0088cc;
}

.social-icon.youtube {
    color: #ff0000;
}

.social-icon.twitter {
    color: #1DA1F2;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 25px;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 5px;
}

/* Flag Icons */
.fi {
    width: 22px;
    height: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: inline-block;
    vertical-align: middle;
}

.lang-link {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Staff Dropdown */
.dropdown-staff:hover .staff-dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.staff-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 10px 0;
    margin-top: 10px;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.staff-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10;
}

.staff-item {
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    border-bottom: 1px solid #27272a;
}

.staff-item:last-child {
    border-bottom: none;
}

.staff-item:hover {
    background: #27272a;
}

.staff-name {
    color: #f4f4f5;
    font-size: 13px;
    font-weight: 500;
}

.staff-rank {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
}

/* Premium Buttons */
.btn-premium {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: white;
    background: rgba(59, 130, 246, 0.05);
}