/* Forum Styles */
body { background: #ffffff; font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; color: #333; font-size: 14px; line-height: 1.6; }

/* Layout */
.forum-body { max-width: 1200px; margin: 0 auto !important; padding: 20px; width: 100%; }

/* Page Title */
.page-title { font-size: 22px; color: #333; margin-bottom: 20px; }
.page-title .sub { font-size: 14px; color: #999; font-weight: normal; }

/* Board List */
.board-list { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
.board-item { padding: 18px 22px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.board-item:last-child { border-bottom: none; }
.board-item:hover { background: #fafafa; }
.board-info { flex: 1; }
.board-name { font-size: 16px; font-weight: bold; }
.board-name a { color: #1a1a2e; text-decoration: none; }
.board-name a:hover { color: #027BD6; }
.board-desc { color: #999; font-size: 13px; margin-top: 4px; }
.board-stats { text-align: right; color: #999; font-size: 13px; white-space: nowrap; padding-left: 20px; }
.board-stats span { margin-left: 15px; }
.board-stats .num { color: #333; font-weight: bold; }
.board-last { font-size: 12px; color: #999; margin-top: 2px; }

/* Topic List */
.topic-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.topic-toolbar .breadcrumb { font-size: 14px; color: #999; }
.topic-toolbar .breadcrumb a { color: #333; text-decoration: none; }
.topic-toolbar .breadcrumb a:hover { color: #027BD6; }
.topic-list { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
.topic-header { display: flex; background: #fafafa; padding: 10px 18px; font-weight: bold; color: #555; font-size: 13px; border-bottom: 2px solid #eee; }
.topic-header .th-title { flex: 1; }
.topic-header .th-stats { width: 140px; text-align: center; }
.topic-header .th-last { width: 160px; text-align: right; }
.topic-row { display: flex; padding: 13px 18px; border-bottom: 1px solid #f0f0f0; align-items: center; }
.topic-row:hover { background: #fafafa; }
.topic-row .tc-main { flex: 1; min-width: 0; }
.topic-row .tc-main .title { font-size: 15px; }
.topic-row .tc-main .title a { color: #333; text-decoration: none; }
.topic-row .tc-main .title a:hover { color: #027BD6; }
.topic-row .tc-main .title .pinned { background: #027BD6; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-right: 5px; }
.topic-row .tc-main .meta { font-size: 12px; color: #999; margin-top: 3px; }
.topic-row .tc-main .meta a { color: #027BD6; text-decoration: none; }
.topic-row .tc-stats { width: 140px; text-align: center; font-size: 13px; color: #555; }
.topic-row .tc-last { width: 160px; text-align: right; font-size: 12px; color: #999; }

/* Topic View */
.topic-view { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; margin-bottom: 20px; }
.post-item { border-bottom: 1px solid #f0f0f0; }
.post-item:last-child { border-bottom: none; }
.post-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: #fafafa; border-bottom: 1px solid #f0f0f0; }
.post-author { font-weight: bold; color: #333; }
.post-author .badge { display: inline-block; background: #027BD6; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-left: 5px; font-weight: normal; }
.post-time { color: #999; font-size: 13px; }
.post-content { padding: 20px; line-height: 1.8; font-size: 14px; min-height: 60px; }
.post-content img { max-width: 100%; }
.post-content table { border-collapse: collapse; margin: 10px 0; }
.post-content table td, .post-content table th { border: 1px solid #ddd; padding: 8px; }
.post-content pre { background: #f5f5f5; padding: 12px; border-radius: 4px; overflow-x: auto; }
.post-content blockquote { border-left: 4px solid #027BD6; padding: 10px 15px; margin: 10px 0; background: #f9f9f9; }
.post-actions { padding: 10px 20px; border-top: 1px solid #f0f0f0; text-align: right; }
.post-actions a { color: #999; font-size: 13px; text-decoration: none; margin-left: 12px; }
.post-actions a:hover { color: #027BD6; }

/* Forms */
.forum-form { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 25px; }
.forum-form .form-group { margin-bottom: 18px; }
.forum-form label { display: block; font-weight: bold; color: #333; margin-bottom: 6px; font-size: 14px; }
.forum-form input[type="text"], .forum-form input[type="password"], .forum-form input[type="email"], .forum-form select, .forum-form textarea { width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; font-family: inherit; }
.forum-form input:focus, .forum-form select:focus, .forum-form textarea:focus { border-color: #027BD6; outline: none; }
.forum-form .form-help { font-size: 12px; color: #999; margin-top: 4px; }

/* Rich Text Editor */
.editor-wrapper { border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.editor-toolbar { background: #f8f8f8; border-bottom: 1px solid #ddd; padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.editor-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent; background: transparent; border-radius: 3px; cursor: pointer; font-size: 13px; color: #555; }
.editor-btn:hover { background: #e8e8e8; border-color: #ccc; }
.editor-btn.active { background: #ddd; border-color: #bbb; }
.editor-sep { display: inline-block; width: 1px; height: 22px; background: #ddd; margin: 0 4px; }
.editor-select { height: 28px; border: 1px solid #ddd; border-radius: 3px; font-size: 12px; padding: 0 4px; background: #fff; cursor: pointer; }
.editor-color { width: 28px; height: 28px; border: 1px solid #ddd; border-radius: 3px; padding: 2px; cursor: pointer; vertical-align: middle; }
.editor-iframe-container { background: #fff; }
.editor-iframe { display: block; }
.editor-source { font-family: "Courier New", monospace; font-size: 13px; line-height: 1.5; resize: vertical; }

/* Buttons */
.btn { display: inline-block; padding: 8px 22px; border-radius: 4px; font-size: 14px; cursor: pointer; text-decoration: none; border: none; font-family: inherit; }
.btn-primary { background: #027BD6; color: #fff; }
.btn-primary:hover { background: #a00; }
.btn-danger { background: #027BD6; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-default { background: #f5f5f5; color: #333; border: 1px solid #ddd; }
.btn-default:hover { background: #e8e8e8; }
.btn-sm { padding: 5px 14px; font-size: 13px; }

/* Pagination */
.pagination { margin-top: 20px; text-align: center; }
.pagination a, .pagination span { display: inline-block; padding: 6px 12px; margin: 0 3px; border-radius: 4px; font-size: 13px; }
.pagination a { background: #fff; color: #333; border: 1px solid #ddd; text-decoration: none; }
.pagination a:hover { background: #f5f5f5; }
.pagination .current { background: #027BD6; color: #fff; border-color: #027BD6; }

/* Admin */
.admin-wrap { display: flex; min-height: calc(100vh - 56px); }
.admin-sidebar { width: 200px; background: #fff; border-right: 1px solid #e8e8e8; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 12px 20px; color: #555; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.admin-sidebar a:hover { background: #f5f5f5; color: #027BD6; }
.admin-sidebar a.active { background: #fff5f5; color: #027BD6; border-left-color: #027BD6; font-weight: bold; }
.admin-main { flex: 1; padding: 25px; min-width: 0; }
.admin-main h2 { font-size: 20px; color: #333; margin-bottom: 20px; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 20px; margin-bottom: 20px; }
.card h3 { font-size: 16px; margin-bottom: 15px; color: #333; border-bottom: 1px solid #f0f0f0; padding-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { background: #fafafa; padding: 10px 12px; text-align: left; font-weight: bold; color: #555; border-bottom: 2px solid #eee; }
table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; color: #333; }
table tr:hover td { background: #fafafa; }
.msg-bar { padding: 10px 15px; border-radius: 4px; margin-bottom: 18px; font-size: 14px; }
.msg-bar.success { background: #f0f9eb; color: #67c23a; border: 1px solid #e1f3d8; }
.msg-bar.error { background: #fef0f0; color: #027BD6; border: 1px solid #fde2e2; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-inline input, .form-inline select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.form-inline input:focus, .form-inline select:focus { border-color: #027BD6; outline: none; }
.empty-state { text-align: center; padding: 40px; color: #999; font-size: 14px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eee; color: #666; }
.badge-admin { background: #027BD6; color: #fff; }

/* Login/Register */
.auth-box { max-width: 400px; margin: 60px auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 30px; }
.auth-box h2 { text-align: center; margin-bottom: 25px; font-size: 22px; }
.auth-box .form-group { margin-bottom: 16px; }
.auth-box label { display: block; margin-bottom: 5px; color: #555; font-size: 14px; }
.auth-box input[type="text"], .auth-box input[type="password"], .auth-box input[type="email"] { width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.auth-box input:focus { border-color: #027BD6; outline: none; }
.auth-box .btn { width: 100%; text-align: center; }
.auth-box .auth-link { text-align: center; margin-top: 15px; font-size: 13px; color: #999; }
.auth-box .auth-link a { color: #027BD6; text-decoration: none; }
.auth-box .error { color: #027BD6; font-size: 13px; text-align: center; margin-bottom: 10px; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.gap-10 { gap: 10px; }

/* === Homepage Layout === */

/* Page Title Bar */
.page-title-bar {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    padding: 0 2px;
}

/* Welcome Banner */
.welcome-card {
    background: #2c3e50;
    border-radius: 8px;
    padding: 32px 28px;
    margin-bottom: 16px;
    color: #fff;
}
.welcome-content { text-align: center; }
.welcome-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}
.welcome-desc {
    font-size: 14px;
    color: #b0bec5;
    margin: 0 0 20px;
}
.stats-row {
    display: flex;
    justify-content: center;
    gap: 40px;
}
.stat-item {
    text-align: center;
}
.stat-num {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.stat-label {
    display: block;
    font-size: 11px;
    color: #90a4ae;
    letter-spacing: 1px;
    margin-top: 2px;
}
.welcome-newest {
    font-size: 12px;
    color: #90a4ae;
    margin-top: 14px;
}
.welcome-newest strong {
    color: #fff;
}

/* Contact Admin Card */
.contact-card {
    background: #c0392b;
    border-radius: 8px;
    padding: 18px 24px;
    margin-bottom: 24px;
}
.contact-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.contact-text { flex: 1; }
.contact-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px;
}
.contact-desc {
    font-size: 13px;
    color: #ef9a9a;
    margin: 0;
}
.btn-contact {
    display: inline-block;
    padding: 9px 22px;
    background: #fff;
    color: #c0392b;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-contact:hover {
    background: #fce4e4;
    color: #a93226;
}

/* Forum Boards Section */
.boards-section { margin-bottom: 20px; }
.boards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.boards-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.boards-search {
    font-size: 14px;
    color: #027BD6;
    text-decoration: none;
}
.boards-search:hover { color: #a00; }

/* Board Cards */
.boards-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.board-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    transition: background 0.15s;
}
.board-card:last-child { border-bottom: none; }
.board-card:hover { background: #f9f9f9; }

/* Search */
.search-form-group { display: flex; gap: 10px; }
.search-form-group input[type="text"] { flex: 1; padding: 9px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.search-form-group input:focus { border-color: #027BD6; outline: none; }

/* Board Card Body */
.board-card-body {
    flex: 1;
    min-width: 0;
}
.board-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 2px;
}
.board-card-desc {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.board-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 600;
    vertical-align: middle;
    text-transform: uppercase;
}
.board-badge-private {
    background: #fce4e4;
    color: #027BD6;
}
.board-badge-admin {
    background: #fef3e2;
    color: #e67e22;
}

/* Board Card Stats */
.board-card-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    margin-left: 14px;
}
.board-stat-item {
    font-size: 12px;
    color: #999;
    text-align: center;
}
.board-stat-val {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #027BD6;
}

/* Responsive */
@media (max-width: 768px) {
    .forum-body { padding: 10px; }
    .forum-header-inner { padding: 0 10px; }
    .board-stats { display: none; }
    .topic-header .th-stats, .topic-header .th-last { display: none; }
    .topic-row .tc-stats, .topic-row .tc-last { display: none; }
    .admin-sidebar { width: 160px; }
    .admin-main { padding: 15px; }

    /* Homepage responsive */
    .welcome-card { padding: 20px 16px; }
    .welcome-title { font-size: 18px; }
    .welcome-desc { font-size: 13px; margin-bottom: 14px; }
    .stats-row { gap: 16px; }
    .stat-num { font-size: 20px; }
    .stat-label { font-size: 10px; letter-spacing: 0.5px; }
    .welcome-newest { font-size: 11px; }
    .contact-card { padding: 14px 16px; }
    .contact-content { flex-direction: column; text-align: center; }
    .contact-title { font-size: 14px; }
    .contact-desc { font-size: 12px; }
    .btn-contact { width: 100%; text-align: center; padding: 8px 16px; font-size: 13px; }
    .board-card { padding: 12px 14px; }
    .board-card-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .board-card-desc { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .board-card-stats { gap: 8px; margin-left: 10px; flex-shrink: 0; }
    .board-stat-item { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; white-space: nowrap; }
    .board-stat-val { font-size: 12px; display: inline; }
    .boards-title { font-size: 16px; }
    .boards-search { font-size: 13px; }

    /* Topic list responsive */
    .topic-toolbar { flex-direction: column; align-items: flex-start; }
    .topic-toolbar .breadcrumb { font-size: 13px; word-break: break-all; }
    .topic-header { display: none; }
    .topic-row { flex-wrap: wrap; padding: 10px 12px; }
    .topic-row .tc-main { width: 100%; }
    .topic-row .tc-main .title { font-size: 14px; }
    .topic-row .tc-main .meta { font-size: 11px; }
    .topic-row .tc-stats { display: none; }
    .topic-row .tc-last { display: none; }

    /* Topic view responsive */
    .topic-view { border-radius: 6px; }
    .post-header { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; }
    .post-author { font-size: 13px; }
    .post-time { font-size: 12px; }
    .post-content { padding: 14px; font-size: 13px; min-height: 40px; }
    .post-content pre { padding: 8px; font-size: 12px; }
    .post-content blockquote { padding: 8px 12px; }
    .post-actions { padding: 8px 14px; }
    .post-actions a { font-size: 12px; margin-left: 8px; }

    /* Forms responsive */
    .forum-form { padding: 16px; }
    .forum-form label { font-size: 13px; }
    .forum-form input[type="text"], .forum-form input[type="password"], .forum-form input[type="email"], .forum-form select, .forum-form textarea { padding: 7px 10px; font-size: 13px; }

    /* Editor responsive */
    .editor-toolbar { padding: 4px 6px; gap: 1px; }
    .editor-btn { min-width: 26px; height: 26px; font-size: 12px; }
    .editor-select { height: 24px; font-size: 11px; }
    #editor-container { min-height: 200px !important; }

    /* Auth responsive */
    .auth-box { max-width: 100%; margin: 20px 10px; padding: 20px; }
    .auth-box h2 { font-size: 18px; }
    .auth-box input[type="text"], .auth-box input[type="password"], .auth-box input[type="email"] { padding: 8px 10px; font-size: 13px; }

    /* Pagination responsive */
    .pagination { margin-top: 14px; }
    .pagination a, .pagination span { padding: 4px 8px; margin: 0 2px; font-size: 12px; }

    /* Buttons responsive */
    .btn { padding: 6px 16px; font-size: 13px; }
    .btn-sm { padding: 4px 10px; font-size: 12px; }

    /* Admin responsive */
    .admin-sidebar { width: 100%; position: static; height: auto; border-right: none; border-bottom: 1px solid #e8e8e8; }
    .admin-sidebar h3 { display: none; }
    .admin-sidebar a { display: inline-block; padding: 8px 12px; font-size: 12px; border-left: none; border-bottom: 2px solid transparent; }
    .admin-sidebar a.active { border-left-color: transparent; border-bottom-color: #027BD6; }
    .admin-main { margin-left: 0; padding: 12px; }
    .admin-main h2 { font-size: 17px; }
    .card { padding: 12px; }
    .card h3 { font-size: 14px; }
    table { font-size: 12px; }
    table th, table td { padding: 6px 8px; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline input, .form-inline select { width: 100% !important; }

    /* Quick reply */
    .card textarea { min-height: 80px; }

    /* Search form */
    .search-form-group { flex-direction: column; }
    .search-form-group input[type="text"] { width: 100%; }

    /* Navbar mobile */
    .navbar .navbar-nav { margin: 0; }
    .navbar .navbar-nav > li > a { padding: 8px 15px !important; font-size: 13px !important; white-space: normal !important; }
    .navbar-collapse { border-top: 1px solid #e7e7e7; max-height: none; }
    .navbar-fixed-top .navbar-collapse { max-height: 80vh; overflow-y: auto; }
}

/* Extra small devices */
@media (max-width: 480px) {
    .forum-body { padding: 6px; }
    .welcome-card { padding: 16px 12px; border-radius: 6px; }
    .welcome-title { font-size: 16px; }
    .stats-row { gap: 12px; }
    .stat-num { font-size: 17px; }
    .board-card { padding: 10px 12px; }
    .board-card-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .board-card-desc { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .board-card-stats { gap: 4px; margin-left: 6px; }
    .board-stat-item { font-size: 10px; }
    .board-stat-val { font-size: 11px; }
    .post-content { padding: 10px; font-size: 12px; }
    .auth-box { padding: 16px; margin: 10px 6px; }
    .admin-main { padding: 8px; }
    .card { padding: 10px; border-radius: 6px; }
    .forum-form { padding: 12px; }
    #editor-container { min-height: 150px !important; }
    .page-title { font-size: 18px; }
    .pagination a, .pagination span { padding: 3px 6px; margin: 0 1px; font-size: 11px; }
    .post-actions a { font-size: 11px; }
}

/* Landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar-fixed-top .navbar-collapse { max-height: 60vh; }
    .post-content { min-height: 30px; }
    #editor-container { min-height: 120px !important; }
}

/* Embed mode for CMS admin */
body.embed-mode .forum-header,
body.embed-mode .forum-footer { display: none; }
body.embed-mode .forum-wrap { min-height: auto; }
body.embed-mode .forum-body { padding: 15px; max-width: none; }