/* =========================================================
   VIETBOOT FORUM & CHATBOX - STYLESHEET
   Accurate recreation of VietBoot / XenForo Shoutbox Theme
   ========================================================= */

:root {
    --primary-blue: #185a9d;
    --primary-gradient: linear-gradient(180deg, #2b78c9 0%, #155799 100%);
    --chatbox-border: #1a62ab;
    --accent-blue: #0073e6;
    --bg-light: #edf2f7;
    --bg-body: #dce5ec;
    --bg-white: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #d1d8e0;
    --quote-bg: #f4f6f9;
    --quote-border: #a4b0be;
    
    /* User Role Colors */
    --color-admin: #d63031;
    --color-mod: #0984e3;
    --color-vip: #00b894;
    --color-member: #2d3436;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-dark);
    font-size: 13.5px;
    line-height: 1.45;
}

/* ================= HEADER ================= */
.main-header {
    background: #ffffff;
    border-bottom: 2px solid var(--primary-blue);
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area .logo-text {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #1a4f8b;
    text-decoration: none;
    text-transform: uppercase;
    text-shadow: 1px 1px 0px #e0e0e0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#authHeaderContainer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-logged-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}

.user-logged-avatar {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    object-fit: cover;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: #2b78c9;
    color: #fff;
}
.btn-primary:hover {
    background: #185a9d;
}

.btn-secondary {
    background: #4a6572;
    color: #fff;
}
.btn-secondary:hover {
    background: #344955;
}

.btn-outline {
    background: #ffffff;
    color: #2b78c9;
    border: 1px solid #2b78c9;
}
.btn-outline:hover {
    background: #f0f7ff;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}
.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}
.btn-success:hover {
    background: #219653;
}

/* Sub-navbar */
.sub-navbar {
    background: var(--primary-gradient);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

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

.nav-item {
    color: #e8f0fe;
    text-decoration: none;
    padding: 9px 16px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-right: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: rgba(0,0,0,0.15);
    color: #ffffff;
}

/* ================= MAIN WRAPPER ================= */
.main-container {
    max-width: 1200px;
    margin: 15px auto 30px auto;
    padding: 0 15px;
}

/* ================= CHATBOX WIDGET ================= */
.chatbox-widget {
    background: #ffffff;
    border: 1px solid var(--chatbox-border);
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

/* Chatbox Top Header */
.chatbox-header {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #13467b;
}

.cb-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
}

.cb-badge {
    background: #27ae60;
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

.cb-link-btn {
    color: #cce4ff;
    text-decoration: none;
    font-size: 12px;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.cb-link-btn:hover {
    color: #ffffff;
    text-decoration: underline;
}

.cb-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cb-action-btn {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 3px 9px;
    border-radius: 3px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cb-action-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Input Area & Toolbar */
.chatbox-input-wrapper {
    background: #f8fafc;
    border-bottom: 1px solid #dce4ec;
    padding: 8px 12px;
}

.cb-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.tb-btn {
    background: #ffffff;
    border: 1px solid #ced6e0;
    color: #4b6584;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.tb-btn:hover {
    background: #e4e9f0;
    color: #1e272e;
    border-color: #a4b0be;
}

/* Color palette picker */
.color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.color-palette {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    padding: 6px;
    border-radius: 4px;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    z-index: 100;
}

.color-picker-wrapper:hover .color-palette {
    display: grid;
}

.color-palette span {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.2);
}

.current-user-tag {
    margin-left: auto;
    font-size: 12px;
    color: #576574;
}

/* Chat Form */
.cb-form {
    display: flex;
    gap: 8px;
}

.input-container {
    flex: 1;
    position: relative;
}

#chatInput {
    width: 100%;
    border: 1px solid #bac7d5;
    border-radius: 3px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    resize: none;
    font-family: inherit;
    background: #fff;
    min-height: 34px;
    max-height: 80px;
}

#chatInput:focus {
    border-color: #2b78c9;
    box-shadow: 0 0 0 2px rgba(43, 120, 201, 0.2);
}

.btn-submit {
    background: #185a9d;
    color: #ffffff;
    border: 1px solid #13467b;
    border-radius: 3px;
    padding: 0 16px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    height: 34px;
}

.btn-submit:hover {
    background: #0f4074;
}

/* Emoji Picker Panel */
.emoji-picker-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    padding: 8px;
    width: 280px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 120;
    margin-bottom: 6px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.emoji-item {
    font-size: 18px;
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    transition: background 0.15s;
    user-select: none;
}

.emoji-item:hover {
    background: #e2e8f0;
}

/* Notice Banner */
.cb-notice-banner {
    background: #fff9db;
    border: 1px solid #ffe066;
    color: #856404;
    padding: 6px 12px;
    border-radius: 4px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.notice-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #856404;
}

/* ================= CHATBOX BODY ================= */
.chatbox-body {
    display: flex;
    height: 380px;
    background: #ffffff;
}

/* Messages Stream */
.cb-messages-stream {
    flex: 1;
    padding: 10px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    border-right: 1px solid #e2e8f0;
}

/* Individual Message Row */
.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

.chat-msg:hover {
    background: #f1f5f9;
}

.chat-msg.msg-highlight {
    background: #eaf3ff;
    border-left: 3px solid #2b78c9;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #d1d8e0;
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-author-row {
    display: inline;
    margin-right: 6px;
}

.user-badge-icon {
    font-size: 11px;
    margin-right: 3px;
}

.author-name {
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.author-name:hover {
    text-decoration: underline;
}

/* Roles */
.author-admin { color: #d63031; }
.author-mod { color: #0984e3; }
.author-vip { color: #009432; }
.author-member { color: #006699; }

.msg-text {
    display: inline;
    word-break: break-word;
    color: #1e293b;
}

/* User Tag @username */
.user-mention {
    color: #0d5ca8;
    font-weight: 700;
    background: rgba(13, 92, 168, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
}
.user-mention:hover {
    text-decoration: underline;
    background: rgba(13, 92, 168, 0.15);
}

/* Quote Box in Message */
.quote-box {
    background: var(--quote-bg);
    border-left: 3px solid var(--quote-border);
    padding: 6px 10px;
    border-radius: 2px;
    margin: 4px 0 6px 0;
    font-size: 12.5px;
    color: #4b6584;
}

.quote-header {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
}

.quote-content {
    font-style: italic;
    color: #576574;
}

/* Embedded image in chat */
.chat-embedded-img {
    max-width: 260px;
    max-height: 160px;
    border-radius: 4px;
    margin-top: 4px;
    display: block;
    border: 1px solid #cbd5e1;
    cursor: pointer;
}

/* Meta & Actions on right of message */
.msg-meta-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-left: 10px;
}

.msg-time {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.msg-actions {
    display: none;
    align-items: center;
    gap: 4px;
}

.chat-msg:hover .msg-actions {
    display: flex;
}

.msg-action-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 11.5px;
    padding: 2px;
    transition: color 0.15s;
}

.msg-action-btn:hover {
    color: #2b78c9;
}

.btn-del-msg:hover {
    color: #e74c3c !important;
}

/* System Messages */
.chat-msg-system {
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 16px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #64748b;
    margin: 10px auto;
    width: 90%;
}

/* ================= ONLINE USERS SIDEBAR ================= */
.cb-online-sidebar {
    width: 210px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.online-header {
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    background: #f1f5f9;
}

.online-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.online-empty-hint {
    padding: 15px 10px;
    text-align: center;
    color: #94a3b8;
    font-size: 11.5px;
    font-style: italic;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.online-user-item:hover {
    background: #e2e8f0;
}

.online-avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
}

.online-name {
    font-size: 12px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 3px #2ecc71;
    margin-left: 4px;
}

/* ================= CHATBOX FOOTER STATUS ================= */
.chatbox-footer {
    background: #edf2f7;
    border-top: 1px solid #dce4ec;
    padding: 5px 12px;
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-tag {
    background: #dbeafe;
    color: #1e40af;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.cb-tip code {
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 3px;
    color: #0f172a;
    font-size: 11px;
}

/* ================= FORUM CATEGORIES ================= */
.forum-category-block {
    background: #ffffff;
    border: 1px solid #ced6e0;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.cat-header {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 9px 14px;
    font-weight: 700;
    font-size: 14px;
    border-radius: 3px 3px 0 0;
}

.forum-item-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f6;
    transition: background 0.15s;
}

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

.forum-item-row:hover {
    background: #f8fafc;
}

.forum-icon {
    color: #64748b;
    margin-right: 14px;
    width: 32px;
    text-align: center;
}

.forum-details {
    flex: 1;
    min-width: 0;
}

.forum-name {
    font-size: 14.5px;
    font-weight: 700;
    color: #185a9d;
    text-decoration: none;
}

.forum-name:hover {
    text-decoration: underline;
}

.forum-desc {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

.forum-stats {
    width: 140px;
    text-align: center;
    font-size: 12px;
    color: #475569;
    border-left: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    padding: 0 10px;
}

.forum-latest {
    width: 250px;
    padding-left: 15px;
    font-size: 12px;
}

.latest-text {
    color: #94a3b8;
    font-style: italic;
}

/* ================= FOOTER ================= */
.main-footer {
    background: #2c3e50;
    color: #cbd5e1;
    padding: 20px 0;
    font-size: 12.5px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-links a {
    color: #60a5fa;
    text-decoration: none;
}
.footer-links a:hover {
    text-decoration: underline;
}

/* ================= AUTH MODAL & TABS ================= */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}

.auth-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    font-size: 13.5px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.auth-tab-btn.active {
    color: #2b78c9;
    border-bottom-color: #2b78c9;
}

.auth-error-msg {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 10px;
}

/* ================= MODAL DIALOGS ================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: 6px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}

.modal-lg {
    max-width: 720px;
}

@keyframes modalIn {
    from { transform: translateY(-15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.modal-body {
    padding: 16px 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    background: #f8fafc;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 12.5px;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.form-control:focus {
    border-color: #2b78c9;
    box-shadow: 0 0 0 2px rgba(43, 120, 201, 0.15);
}

.color-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-select-row input[type="color"] {
    border: none;
    width: 36px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
}

/* Command Table */
.command-table-wrapper {
    margin: 12px 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.cmd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cmd-table th {
    background: #f1f5f9;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
    color: #334155;
}

.cmd-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.cmd-admin-row {
    background: #fff8f8;
}

.cmd-table code {
    background: #e2e8f0;
    padding: 2px 5px;
    border-radius: 3px;
    color: #d63031;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 700;
}

.badge-admin {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-member {
    background: #e0f2fe;
    color: #0369a1;
}

.note-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 10px 14px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #1e40af;
    margin-top: 12px;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 850px) {
    .chatbox-body {
        flex-direction: column;
        height: 480px;
    }
    
    .cb-online-sidebar {
        width: 100%;
        height: 120px;
        border-top: 1px solid #e2e8f0;
    }
}
