/* --- GLOBAL CUSTOM SLIM SCROLLBAR (QUY CHUẨN THANH CUỘN TOÀN CỤC KPG) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.25);
    border-radius: 10px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.6);
}

/* Tương thích Firefox Standard Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.3) transparent;
}

/* Root Variables: CSS Design Tokens (Ocean Blue + White Light Theme) */
:root {
    --bg-main: hsl(210, 40%, 96.1%);
    /* Slate 50 (#F8FAFC) */
    --bg-card: hsl(0, 0%, 100%);
    /* Pure White (#FFFFFF) */
    --bg-card-hover: hsl(210, 40%, 94%);
    /* Light Slate Hover */
    --border-color: hsl(214.3, 31.8%, 91.4%);
    /* Light Gray Border (#E2E8F0) */
    --border-focus: hsl(221.2, 83.2%, 53.3%);
    /* Ocean Blue (#2563EB) */

    --text-primary: hsl(222.2, 47.4%, 11.2%);
    /* Dark Slate (#0F172A) */
    --text-muted: hsl(215.4, 16.3%, 46.9%);
    /* Muted Slate (#64748B) */

    /* Brand Accents */
    --accent-blue: hsl(221.2, 83.2%, 53.3%);
    /* Ocean Blue (#2563EB) */
    --accent-gold: hsl(221.2, 83.2%, 53.3%);
    /* Replacing gold accent with Blue */

    /* Button Gradients */
    --grad-primary: linear-gradient(135deg, hsl(221.2, 83.2%, 53.3%), hsl(224.3, 76.3%, 48%));
    --grad-hover: linear-gradient(135deg, hsl(224.3, 76.3%, 48%), hsl(226, 70%, 40%));

    /* System States */
    --state-success: hsl(142.1, 76.2%, 36.3%);
    /* Green (#10B981) */
    --state-error: hsl(346.8, 77.2%, 49.8%);
    /* Red (#EF4444) */
    --state-warning: hsl(37.9, 90.2%, 50.2%);
    /* Yellow/Gold (#F59E0B) */
    --state-info: hsl(199, 89%, 48%);

    /* Soft shadows matching light mode aesthetics */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* App Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.1));
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

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

.user-email {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    background-color: var(--bg-main);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* Base Layout Container */
.app-main-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 14px 14px 14px 92px; /* Tỉ lệ vàng: Cách trên 14, Phải 14, Dưới 14, Cách Sidebar 14 (78+14=92) */
    height: calc(100vh - 81px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cards & Layout panels */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}

/* --- FLOATING SOLID SIDEBAR --- */
.kpg-floating-sidebar {
    position: fixed;
    top: 95px; /* Dưới header 81px + 14px margin */
    bottom: 14px; 
    left: 14px;
    transform: none; 
    width: 64px;
    background: #ffffff; /* Nền trắng đục */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Tách 2 cụm trên và dưới */
    z-index: 9999;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.kpg-floating-sidebar:hover {
    width: 275px; /* Độ rộng khi bung ra chứa vừa vặn tiêu đề + mô tả phụ */
    box-shadow: var(--shadow-md);
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    color: var(--text-muted); /* slate-500 */
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-item:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.sidebar-item:active {
    transform: scale(0.97);
}

.sidebar-item.active {
    background: #eff6ff; /* Nền xanh dương nhạt */
    color: #2563eb; /* Chữ và Icon xanh dương đậm */
    box-shadow: none;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: none;
}

.sidebar-icon svg {
    width: 100%;
    height: 100%;
}

.sidebar-text-group {
    display: flex;
    flex-direction: column;
    margin-left: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.kpg-floating-sidebar:hover .sidebar-text-group {
    opacity: 1;
    transition-delay: 0.08s;
}

.sidebar-text-main {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    color: inherit;
}

.sidebar-text-sub {
    font-size: 10.5px;
    font-weight: 400;
    color: #94a3b8;
    line-height: 1.2;
    margin-top: 1px;
}

.sidebar-item.active .sidebar-text-sub {
    color: #60a5fa; /* Xanh dương nhẹ khi đang chọn */
}

/* Đường kẻ ngang phân cách */
.sidebar-divider {
    height: 1.5px;
    background: #cbd5e1;
    margin: 4px 6px;
    border-radius: 1px;
    transition: background 0.2s, margin 0.2s;
}

.kpg-floating-sidebar:hover .sidebar-divider {
    background: #e2e8f0;
    margin: 6px 10px;
}

/* Tiêu đề phân nhóm Sidebar */
.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 6px 10px 2px 10px;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    user-select: none;
}

.kpg-floating-sidebar:hover .sidebar-section-title {
    opacity: 1;
    transition-delay: 0.05s;
}

/* Footer Widget & Tem phiên bản */
.sidebar-footer-widget {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    overflow: hidden;
}

.sidebar-status-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.kpg-floating-sidebar:hover .sidebar-status-box {
    opacity: 1;
    transition-delay: 0.1s;
}

.status-dot-pulse {
    width: 6px;
    height: 6px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.status-box-text {
    font-size: 10.5px;
    font-weight: 600;
    color: #15803d;
}

.sidebar-badge {
    padding: 4px 8px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.kpg-floating-sidebar:hover .sidebar-badge {
    opacity: 1;
    transition-delay: 0.1s;
}

/* --- PREMIUM SAAS SPLIT-SCREEN & 3D FLOATING CARDS LOGIN SCREEN --- */
body.auth-mode {
    background-color: #f8fafc !important;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(99, 102, 241, 0.14) 0%, transparent 45%),
        radial-gradient(#cbd5e1 1px, transparent 1px) !important;
    background-size: 100% 100%, 100% 100%, 28px 28px !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-mode .app-header {
    display: none !important;
}

body.auth-mode .app-main-container {
    padding: 40px 24px !important;
    margin: 0 !important;
    max-width: 100% !important;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-section {
    width: 100%;
    max-width: 1240px;
    margin: auto;
    animation: authFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-split-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 64px;
    width: 100%;
}

/* --- CỘT TRÁI: HERO SHOWCASE & 3D FEATURE CARDS --- */
.auth-hero-side {
    flex: 1.15;
    max-width: 600px;
    text-align: left;
}

.hero-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 30px;
    font-size: 11.5px;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: 0.6px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}

.hero-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 10px #2563eb;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.hero-main-heading {
    font-size: 38px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin: 0 0 16px 0;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #0f172a 30%, #1e40af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 30px 0;
    font-weight: 400;
}

/* 3D Feature Cards */
.hero-feature-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}

.feature-card-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    box-shadow: 0 10px 25px -10px rgba(15, 23, 42, 0.05);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card-item:hover {
    transform: translateX(8px) translateY(-2px);
    background: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 16px 32px -10px rgba(37, 99, 235, 0.15), 0 0 0 1px #bfdbfe;
}

.feature-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.ai-icon-bg { background: #eff6ff; border: 1px solid #dbeafe; }
.fb-icon-bg { background: #f0f9ff; border: 1px solid #e0f2fe; }
.cloud-icon-bg { background: #ecfdf5; border: 1px solid #d1fae5; }

.feature-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.feature-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
}

.hero-tech-partners {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 10px;
}

.partners-label {
    font-size: 12.5px;
    color: #64748b;
    font-weight: 600;
}

.partner-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.partner-chip {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* --- CỘT PHẢI: KHUNG ĐĂNG NHẬP BỀ THẾ --- */
.auth-form-side {
    flex: 0.95;
    max-width: 490px;
    width: 100%;
}

.auth-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 24px;
    padding: 38px 36px 30px 36px;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.9);
    transition: box-shadow 0.3s ease;
}

.auth-card:hover {
    box-shadow: 0 30px 70px -15px rgba(37, 99, 235, 0.16), 0 0 0 1px rgba(255, 255, 255, 1);
}

/* Logo phóng to & cân chỉnh hoàn hảo */
.auth-logo-badge {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px auto;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -4px rgba(37, 99, 235, 0.25), 0 0 0 4px rgba(37, 99, 235, 0.08);
    padding: 8px;
}

.auth-brand-logo {
    height: 72px;
    width: 72px;
    object-fit: contain;
}

.auth-main-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-pro-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.auth-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 24px 0;
    font-weight: 400;
}

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

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-left {
    position: absolute;
    left: 15px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.2s;
}

.input-with-icon:focus-within .input-icon-left {
    color: #2563eb;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding-left: 46px !important;
    padding-right: 16px;
    font-size: 14.5px;
    border-radius: 12px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.auth-input:focus {
    background: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14) !important;
    outline: none !important;
}

.auth-toggle-pwd {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    color: #94a3b8;
    transition: color 0.2s;
}

.auth-toggle-pwd:hover {
    color: #334155;
}

.btn-auth-submit {
    width: 100%;
    height: 50px;
    margin-top: 22px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    font-size: 15.5px;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38);
    transition: all 0.25s ease;
}

.btn-auth-submit:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.48);
}

.btn-auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

/* Hộp hỗ trợ kích hoạt Zalo */
.auth-support-box {
    margin-top: 20px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #475569;
    user-select: none;
    -webkit-user-select: none;
}

.support-zalo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0284c7;
    text-decoration: none;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    background: #e0f2fe;
    transition: all 0.2s;
}

.support-zalo-link:hover {
    background: #bae6fd;
    color: #0369a1;
    transform: scale(1.02);
}

.zalo-icon-badge {
    background: #0284c7;
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.4px;
}

/* Trust Badges */
.auth-trust-badges {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    user-select: none;
    -webkit-user-select: none;
}

.trust-badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

/* Footer Copyright */
.auth-footer-copyright {
    text-align: center;
    margin-top: 16px;
    font-size: 11.5px;
    color: #94a3b8;
    user-select: none;
    -webkit-user-select: none;
}

/* Responsive cho màn hình nhỏ & Mobile */
@media (max-width: 1024px) {
    .auth-split-container {
        flex-direction: column;
        gap: 40px;
    }
    .auth-hero-side {
        max-width: 100%;
        text-align: center;
    }
    .hero-brand-badge {
        margin: 0 auto 16px auto;
    }
    .hero-feature-cards {
        text-align: left;
    }
    .hero-tech-partners {
        justify-content: center;
    }
    .auth-form-side {
        max-width: 500px;
        margin: 0 auto;
    }
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-color);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--grad-primary);
}

/* Form Elements */
.form-group {
    margin-bottom: 8px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea {
    width: 100%;
    height: 120px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
    gap: 8px;
}

.btn-primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    background: var(--grad-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-ai {
    background-color: hsl(220, 90%, 96%);
    border: 1px solid hsl(220, 90%, 85%);
    color: var(--accent-blue);
}

.btn-ai:hover {
    background-color: hsl(220, 90%, 92%);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon-only {
    padding: 10px;
    width: 40px;
    height: 40px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background-color: var(--border-color);
    transform: scale(1.1);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(370px, 32%) 1fr; /* Mở rộng thêm khoảng 50px so với bản cũ */
    gap: 14px;
    width: 100%;
    height: calc(100vh - 109px);
    max-height: calc(100vh - 109px);
    min-height: 580px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Left Panel: Write & Config */
.control-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden !important;
    /* Giữ nguyên 4 góc bo tròn 12px của Card ngoài */
    padding: 0 !important;
}

.control-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 18px 24px 24px;
    /* Tháo lề bên phải để thanh cuộn nằm lùi vào trong */
    box-sizing: border-box;
}

/* Custom Scrollbar siêu mỏng 5px phong cách macOS */
.control-panel-inner::-webkit-scrollbar {
    width: 5px;
}

.control-panel-inner::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel-inner::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.25);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.control-panel-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.6);
}

/* Tab buttons for content spin */
.tab-container {
    margin-bottom: 10px;
}

.tabs {
    display: flex;
    background-color: var(--bg-main);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 4px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.textarea-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.post-textarea {
    height: 409px;
    padding: 10px;
    font-size: 13px;
    resize: vertical;
}

.join-textarea {
    height: 498px;
    padding: 10px;
    font-size: 13px;
    resize: vertical;
}

/* Upload zone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    background-color: var(--bg-main);
    border-radius: 8px;
    padding: 16px 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--border-focus);
    background-color: rgba(37, 99, 235, 0.03);
}

.dropzone-text {
    font-size: 13px;
    color: var(--text-muted);
}

.dropzone-text span {
    color: var(--accent-blue);
    font-weight: 600;
}

.media-preview-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.media-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-item .btn-remove-media {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Range Inputs */
.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.range-inputs span {
    color: var(--text-muted);
    font-size: 12px;
}

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

/* Custom Checkbox Design */
.checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    color: var(--text-primary);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 1px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.checkbox-container:hover input~.checkmark {
    border-color: var(--text-muted);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Logs and Progress Panel (Bottom Left) */
.log-panel {
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.log-status-badge {
    font-size: 11px;
    font-weight: 600;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-primary);
}

.log-list {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 200px;
    /* Tăng lên tròn số 200px theo chỉ đạo của Sếp */
    overflow-y: auto;
    padding: 6px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-item {
    padding: 6px 10px;
    border-radius: 6px;
    background-color: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

/* Fullscreen Progress Log Modal Mode (Phóng to Bảng Tiến Trình) */
.log-panel.fullscreen-expanded {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    z-index: 999999 !important;
    background-color: rgba(248, 250, 252, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    padding: 24px 32px !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.log-panel.fullscreen-expanded .log-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.log-panel.fullscreen-expanded .log-title {
    font-size: 20px !important;
    color: #0f172a !important;
    font-weight: 700 !important;
}

.log-panel.fullscreen-expanded .log-list {
    flex: 1 !important;
    height: calc(100vh - 120px) !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    padding: 16px !important;
    font-size: 14px !important;
    gap: 8px !important;
    border-radius: 12px !important;
}

.log-panel.fullscreen-expanded .log-item {
    font-size: 14px !important;
    padding: 12px 16px !important;
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

.btn-expand-log {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    transition: var(--transition-smooth);
}

.btn-expand-log:hover {
    background-color: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Badge Đếm Ngược Nằm Bên Trái */
.log-countdown-badge {
    font-size: 11px;
    font-weight: 600;
    background-color: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #d97706;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    animation: pulseNotice 2s infinite ease-in-out;
}

@keyframes pulseNotice {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.75;
    }
}

/* Dòng Thông Báo Khóa Form */
.posting-lock-notice {
    font-size: 12px;
    font-weight: 600;
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    color: #dc2626;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
    text-align: center;
}

/* Vô hiệu hóa checkbox khi đang đăng bài */
.checkbox-disabled {
    pointer-events: none !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}
}

.log-item.success {
    border-left: 3px solid var(--state-success);
}

.log-item.success a {
    color: var(--accent-blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.log-item.error {
    border-left: 3px solid var(--state-error);
    color: var(--state-error);
}

/* Right Panel: Groups & Profiles */
.content-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.content-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

/* Facebook Profile Sync Card */
.account-sync-state {
    display: flex;
    align-items: center;
}

.profile-info-empty {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.profile-info-active {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    object-fit: cover;
}

.profile-meta {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
}

.profile-uid {
    font-size: 11px;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.online {
    background-color: var(--state-success);
    box-shadow: 0 0 8px var(--state-success);
}

.status-indicator.offline {
    background-color: var(--text-muted);
}

/* Filtering & Collection Bar */
.filter-bar {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 16px;
    margin-bottom: 16px;
}

.collection-wrapper {
    display: flex;
    gap: 8px;
}

/* Group Table Styling */
.table-wrapper {
    flex: 1;
    height: 0;
    min-height: 0;
    overflow-y: auto !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-card);
}

.group-table tbody tr {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.group-table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.04);
}

.group-table tbody tr.selected-row {
    background-color: rgba(37, 99, 235, 0.08);
}

/* Selected Group Badge */
.selected-count-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-blue);
    background-color: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
}

/* 2-line Group Title & UID Styling */
.group-title-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.group-info-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-name-link {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.3;
}

.group-uid-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.btn-copy-uid {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    opacity: 0.6;
    padding: 0 4px;
    transition: var(--transition-smooth);
}

.btn-copy-uid:hover {
    opacity: 1;
    transform: scale(1.15);
}

.group-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.group-table th {
    background-color: var(--bg-card);
    padding: 12px;
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.group-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.group-table tbody tr {
    transition: var(--transition-smooth);
}

.group-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.group-table a {
    color: var(--text-primary);
    text-decoration: none;
}

.group-table a:hover {
    color: var(--accent-blue);
}

/* Group row badges */
.badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--state-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #D97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important; /* Luôn đè lên toàn bộ Sidebar (9999) và Header */
}

.modal {
    max-width: 480px;
    width: 100%;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast Notifications (Custom Popup alerts) */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
}

.toast.success {
    border-left: 4px solid var(--state-success);
}

.toast.error {
    border-left: 4px solid var(--state-error);
}

/* Keyframes Animations */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- REAL-TIME CRAWLING PROGRESS INDICATOR --- */
.crawling-loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    gap: 14px;
}

.spinner-blue {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(24, 119, 242, 0.12);
    border-top: 4px solid #1877f2;
    border-radius: 50%;
    animation: kpgSpin 0.75s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

@keyframes kpgSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.crawling-status-title {
    font-weight: 700;
    color: #1877f2;
    font-size: 15px;
    letter-spacing: 0.5px;
    margin: 0;
}

.crawling-status-count {
    font-size: 14px;
    font-weight: 500;
    color: #65676b;
    margin: 0;
    background: #f0f2f5;
    padding: 6px 16px;
    border-radius: 20px;
}

/* --- FACEBOOK WEB-LIKE BACKGROUND COMPOSER STYLES --- */
.post-composer-box {
    position: relative;
    width: 100%;
    min-height: 240px;
    border-radius: 12px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    overflow: visible;
    box-sizing: border-box;
}

.post-composer-box:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.post-composer-box .form-textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 12px;
    width: 100% !important;
    min-height: 240px !important;
    margin: 0 !important;
    padding: 14px 16px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    resize: vertical !important;
    /* Khôi phục nút kéo dãn dài/ngắn ô nhập */
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

/* Visual Background Selector Toolbar Button & Badge */
.btn-select-bg-visual {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e4e6eb);
    background: #f0f2f5;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #050505;
    transition: all 0.15s ease;
}

.btn-select-bg-visual:hover {
    background: #e4e6eb;
}

/* State Mờ đi khi quá 130 ký tự hoặc có ảnh đính kèm (Không mất đi) */
.btn-select-bg-visual.is-disabled,
.upload-dropzone.is-disabled {
    opacity: 0.5 !important;
    filter: grayscale(80%) !important;
    cursor: not-allowed !important;
    background: #e4e6eb !important;
}

/* Mouse-Following Sleek Tooltip cho nút bị mờ quá 130 ký tự */
.floating-mouse-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: opacity 0.1s ease;
}

.aa-img-icon-small {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
}

.bg-selected-preview-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #e7f3ff;
    border: 1px solid #1877f2;
    font-size: 13px;
    font-weight: 600;
    color: #1877f2;
}

.bg-badge-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-clear-bg {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #65676b;
    padding: 0 2px;
    line-height: 1;
}

.btn-clear-bg:hover {
    color: #dc2626;
}

/* Side-by-Side Char Counter & Emoji Button (CẮN NGHỆ SĨ CÙNG 1 HÀNG NGANG: 1217 ký tự 😊) */
.char-counter-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    margin-top: 8px !important;
    width: 100% !important;
    position: relative !important;
}

.char-counter-bar #char-counter,
.char-counter-text {
    font-size: 13px !important;
    color: #8a8d91 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    margin: 0 !important;
}

/* Nút Mặt Cười Emoji 😊 nằm CÙNG 1 HÀNG NGANG ngay bên phải của đếm ký tự */
.char-counter-bar #btn-emoji-trigger,
.btn-emoji-counter-side {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    font-size: 20px !important;
    width: auto !important;
    height: auto !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
    transition: transform 0.15s ease !important;
}

.char-counter-bar #btn-emoji-trigger:hover,
.btn-emoji-counter-side:hover {
    transform: scale(1.15) !important;
    background: transparent !important;
}

/* Official Facebook Aa Toggle Button */

/* Official Facebook Aa Toggle Button */
.btn-aa-toggle {
    position: absolute !important;
    bottom: 10px !important;
    left: 12px !important;
    top: auto !important;
    right: auto !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.15s ease !important;
    z-index: 50 !important;
    padding: 0 !important;
}

.btn-aa-toggle:hover {
    transform: scale(1.08);
}

.aa-img-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

/* Horizontal Quick Background Picker (Lồng đáy khung phông nền phẳng chuẩn 100% Ảnh 2 FB Web) */
.bg-quick-bar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 52px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.bg-quick-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible !important;
    /* Đảm bảo viền 5px không bị xén mép */
    flex: 1;
    padding: 6px 6px;
}

.bg-quick-scroll::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Rounded square nav buttons matching FB Web (#242526) */
.bg-quick-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #242526;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #e4e6eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.bg-quick-btn:hover {
    background: #3a3b3c;
    transform: scale(1.05);
}

.bg-quick-item {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.bg-quick-item:hover {
    transform: scale(1.08);
}

/* Active double-ring outline matching 100% zoomed photo from Sếp Vinh */
.bg-quick-item.active {
    box-shadow: 0 0 0 2.5px #ffffff, 0 0 0 5px #0064d1 !important;
    transform: scale(1.05);
}

/* Disable icon item */
.bg-none-item {
    background: #242526;
    color: #b0b3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bg-grid-trigger {
    background: #242526;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    transform: translateX(-5px);
}

.bg-grid-trigger:hover {
    background: #242526 !important;
    transform: translateX(-5px) !important;
}

/* Background Modal Custom Grid (Sạch - Sáng - White Mode) */
.bg-grid-modal-card {
    max-width: 480px !important;
    width: 90% !important;
    border-radius: 12px !important;
    padding: 16px 20px !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.bg-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.btn-modal-back {
    background: var(--bg-hover) !important;
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    color: var(--text-primary) !important;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.bg-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.bg-grid-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.bg-grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding: 10px 12px 10px 10px !important;
    /* Vùng đệm an toàn 10px 4 chiều chống cắt viền hover mép trên & mép trái */
    box-sizing: border-box !important;
}

.bg-grid-item {
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.bg-grid-item:hover {
    transform: scale(1.05);
}

.bg-grid-item.active {
    box-shadow: 0 0 0 2.5px #ffffff, 0 0 0 5px #0064d1 !important;
    border-color: transparent !important;
    transform: scale(1.05);
}

/* --- EMOJI PICKER POPOVER (KHỚP 100% ẢNH SẾP VINH) --- */
.emoji-picker-popover {
    position: absolute;
    bottom: 54px;
    right: 0;
    width: 320px;
    background: #242526;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 100;
    overflow: hidden;
    color: #e4e6eb;
    display: flex;
    flex-direction: column;
}

.emoji-popover-arrow {
    position: absolute;
    bottom: -6px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: #242526;
    transform: rotate(45deg);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.emoji-picker-body {
    padding: 12px;
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emoji-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #b0b3b8;
    margin-bottom: 6px;
}

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

.emoji-item-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.emoji-item-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.15);
}

.emoji-category-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 6px 8px;
    background: #18191a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.emoji-cat-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #b0b3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.emoji-cat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e4e6eb;
}

.emoji-cat-btn.active {
    color: #1877f2;
    border-bottom: 2px solid #1877f2;
    border-radius: 0;
}

/* Styling cho Container Nút AI Viết Lại */
.post-composer-box {
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e4e6eb);
    background: #ffffff;
}

textarea.form-textarea {
    width: 100%;
    background: #ffffff !important;
    color: #050505 !important;
    opacity: 1 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    border: none !important;
    outline: none !important;
}

/* Styling Nút AI Viết Lại (AI Rewrite Button) CHUẨN 1:1 THEO ẢNH SẾP VINH GỬI */
button.btn-ai-rewrite,
#btn-ai-rewrite,
.char-counter-bar button.btn-ai-rewrite {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 4px 9px !important;
    border-radius: 20px !important;
    background: #ffffff !important;
    border: 1.5px solid #d0d7de !important;
    color: #6e7781 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    user-select: none !important;
    line-height: 1.2 !important;
}

button.btn-ai-rewrite .ai-btn-img-icon,
#btn-ai-rewrite .ai-btn-img-icon {
    width: 18px !important;
    height: 18px !important;
    object-fit: contain !important;
    opacity: 0.75 !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
}

button.btn-ai-rewrite:hover:not(.is-disabled) .ai-btn-img-icon,
#btn-ai-rewrite:hover:not(.is-disabled) .ai-btn-img-icon {
    opacity: 1 !important;
    transform: scale(1.08) !important;
}

button.btn-ai-rewrite:hover:not(.is-disabled),
#btn-ai-rewrite:hover:not(.is-disabled) {
    background: #f6f8fa !important;
    border-color: #0969da !important;
    color: #0969da !important;
    box-shadow: 0 2px 6px rgba(9, 105, 218, 0.15) !important;
}

button.btn-ai-rewrite:hover:not(.is-disabled) .ai-btn-icon,
#btn-ai-rewrite:hover:not(.is-disabled) .ai-btn-icon {
    color: #0969da !important;
}

button.btn-ai-rewrite:active:not(.is-disabled),
#btn-ai-rewrite:active:not(.is-disabled) {
    background: #ebf0f4 !important;
    transform: scale(0.98) !important;
}

/* State Nút mờ đi khi đã bọc đủ 5 dòng {{...}} */
button.btn-ai-rewrite.is-disabled,
#btn-ai-rewrite.is-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
    color: #9ca3af !important;
}

button.btn-ai-rewrite.is-disabled .ai-btn-icon,
#btn-ai-rewrite.is-disabled .ai-btn-icon {
    color: #9ca3af !important;
}

/* Instant Custom Mouse Tooltip cho Nút AI Viết Lại (0.0s Latency) */
.ai-instant-tooltip {
    position: fixed;
    z-index: 999999;
    padding: 6px 12px;
    background: rgba(24, 25, 26, 0.95);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.05s linear;
}

.ai-instant-tooltip.show {
    opacity: 1;
}

/* ============================================================================
   USER GUIDE (HƯỚNG DẪN SỬ DỤNG) STYLES
   ============================================================================ */
.guide-panel-container {
    padding: 28px 32px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.guide-badge-version {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.guide-content-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.guide-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.guide-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.guide-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.guide-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.guide-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.guide-card-body {
    padding: 20px;
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
}

.guide-desc {
    margin-top: 0;
    margin-bottom: 14px;
}

.guide-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 14px;
}

.guide-alert.info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.guide-troubleshoot-box {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
}

.guide-box-title {
    font-weight: 700;
    color: #0f172a;
    display: block;
    margin-bottom: 8px;
}

.guide-list, .guide-bullet-list {
    margin: 0;
    padding-left: 20px;
}

.guide-list li, .guide-bullet-list li {
    margin-bottom: 6px;
}

.guide-subsections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 14px;
}

.guide-sub-block {
    background: #fafafa;
    border: 1px solid #f1f5f9;
    padding: 14px 16px;
    border-radius: 8px;
}

.guide-sub-title {
    margin: 0 0 8px 0;
    font-size: 14.5px;
    font-weight: 700;
    color: #1e293b;
}

.guide-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.guide-trouble-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.guide-trouble-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid #e2e8f0;
}

.guide-trouble-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.guide-trouble-table tr:last-child td {
    border-bottom: none;
}

.guide-issue-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12.5px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.guide-issue-badge.warning {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

.guide-issue-badge.danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.guide-issue-badge.info {
    background: #f0f9ff;
    color: #0284c7;
    border-color: #bae6fd;
}

/* ============================================================================
   SYSTEM SETTINGS MODAL (CÀI ĐẶT HỆ THỐNG & AI API KEYS) STYLES
   ============================================================================ */
.system-settings-modal {
    width: 600px;
    max-width: 95vw;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.settings-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-icon {
    font-size: 26px;
    line-height: 1;
}

.settings-modal-title h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}

.settings-subtitle {
    margin: 3px 0 0 0;
    font-size: 12.5px;
    color: #64748b;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-close-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.settings-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-label {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-recommended {
    font-size: 11px;
    font-weight: 600;
    color: #15803d;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.text-security-note {
    font-size: 11.5px;
    font-weight: normal;
    color: #059669;
}

.settings-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    font-size: 14px;
    color: #1e293b;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.settings-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-password-wrapper {
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.settings-input,
.settings-textarea {
    width: 100%;
    padding: 10px 42px 10px 14px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    font-size: 13.5px;
    color: #1e293b;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: monospace;
    line-height: 1.5;
}

.settings-textarea {
    min-height: 78px;
    resize: vertical;
}

.settings-input:focus,
.settings-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.text-multi-key-hint {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.4;
    margin-top: 2px;
}

.btn-key-eye {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: #64748b;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}

.btn-key-eye:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.settings-test-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-test-key {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    color: #334155;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-test-key:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.test-key-badge {
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeInBadge 0.2s ease;
}

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

.test-key-badge.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.test-key-badge.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.test-key-badge.loading {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.settings-guide-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.guide-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}

.btn-external-link {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    background: #eff6ff;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #dbeafe;
    transition: all 0.15s;
}

.btn-external-link:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.guide-card-content ol {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.guide-card-content ol li {
    margin-bottom: 4px;
}

.settings-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.btn-delete-key {
    background: none;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-delete-key:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.footer-right-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* State Nút AI Rewrite bị mờ khi CHƯA CÀI ĐẶT API KEY */
button.btn-ai-rewrite.is-no-key,
#btn-ai-rewrite.is-no-key {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    background: #fffbeb !important;
    border-color: #fde68a !important;
    color: #b45309 !important;
    box-shadow: none !important;
}

button.btn-ai-rewrite.is-no-key .ai-btn-icon,
#btn-ai-rewrite.is-no-key .ai-btn-icon {
    color: #d97706 !important;
}

/* Tooltip Cảnh báo Mouse-following khi chưa cài key */
.ai-instant-tooltip.warning {
    background: rgba(180, 83, 9, 0.96) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
    color: #ffffff !important;
}

/* GUIDE PANEL: AI REWRITE & API KEY SECTION STYLES */
.guide-concept-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    margin-top: 6px;
}

.guide-ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.guide-ai-item {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.guide-ai-item:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.guide-ai-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.guide-ai-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-free {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-paid {
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-cheap {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.btn-guide-link {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    background: #eff6ff;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-guide-link:hover {
    background: #2563eb;
    color: #ffffff;
}

.guide-mini-steps {
    margin: 0;
    padding-left: 18px;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.6;
}

.guide-steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.guide-step-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    position: relative;
}

.step-card-badge {
    display: inline-block;
    background: #2563eb;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.step-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.step-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   HISTORY PANEL STYLES (LỊCH SỬ HOẠT ĐỘNG 60 NGÀY)
   ========================================================================== */

.history-panel-container {
    padding: 24px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 14px;
}

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

/* 4 Thẻ Chỉ Số Tổng Quan */
.history-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.history-metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
}

.history-metric-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.history-metric-card .metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.metric-icon.bg-blue { background: #eff6ff; }
.metric-icon.bg-green { background: #f0fdf4; }
.metric-icon.bg-purple { background: #faf5ff; }
.metric-icon.bg-amber { background: #fffbeb; }

.history-metric-card .metric-value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.history-metric-card .metric-label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-top: 2px;
}

/* Toolbar Bộ Lọc & Tìm Kiếm */
.history-filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.filter-select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    outline: none;
    cursor: pointer;
}

.filter-search-box {
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}

.filter-search-box .form-input {
    margin: 0;
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* Bảng Danh Sách Lịch Sử */
.history-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.history-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.history-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover td {
    background: #f8fafc;
}

/* Badges Hoạt Động */
.badge-activity {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-activity.post {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-activity.join {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Tiến độ kết quả */
.history-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.history-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 4px;
    transition: width 0.3s;
}

.history-progress-fill.has-error {
    background: #f59e0b;
}

.history-progress-text {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

/* Nút Hành Động */
.history-action-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-history-action {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-history-action.btn-view {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.btn-history-action.btn-view:hover {
    background: #2563eb;
    color: #ffffff;
}

.btn-history-action.btn-reuse {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.btn-history-action.btn-reuse:hover {
    background: #16a34a;
    color: #ffffff;
}

/* Modal Chi Tiết Lịch Sử */
.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.history-detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 10px;
    margin-bottom: 14px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.summary-value {
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
}

.history-detail-content-box,
.history-detail-groups-box {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
}

.content-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

.btn-copy-text {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #475569;
}

.btn-copy-text:hover {
    background: #f8fafc;
    color: #0f172a;
}

.content-box-body {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #1e293b;
    max-height: 160px;
    overflow-y: auto;
    white-space: pre-wrap;
    background: #ffffff;
}

.history-groups-table-wrap {
    max-height: 220px;
    overflow-y: auto;
}

.history-groups-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.history-groups-table th {
    background: #f8fafc;
    padding: 8px 12px;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.history-groups-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.group-status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.group-status-badge.success {
    background: #dcfce7;
    color: #15803d;
}

.group-status-badge.pending {
    background: #fef3c7;
    color: #b45309;
}

.group-status-badge.error {
    background: #fee2e2;
    color: #b91c1c;
}