/* ==========================================================================
   EMAIL PRO - THEME GIAO DIỆN CHUẨN ZALO PRO (SAAS MARKETING AUTOMATION)
   ========================================================================== */

:root {
    --primary-blue: #0068ff;
    --primary-blue-hover: #0056d6;
    --primary-blue-subtle: #e0f2fe;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 64px;
    --bg-main: #f4f6fb;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --card-border: #edf2f7;
    --card-radius: 16px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 2px 6px rgba(0, 0, 0, 0.02);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    overflow-x: hidden;
}

/* 1. KHUNG BỐ CỤC CHÍNH (APP WRAPPER) */
.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* 2. MENU DỌC BÊN TRÁI (LEFT SIDEBAR) */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: all 0.25s ease-in-out;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    width: 100%;
    transition: all 0.2s ease;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #0068ff;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.sidebar-logo {
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

/* Nhóm Menu */
.menu-group-header {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 12px 6px 12px;
    margin-top: 6px;
}

.menu-group-header:first-child {
    margin-top: 0;
}

/* Liên kết Menu (Link) */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    color: #475569;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    margin-bottom: 3px;
}

.sidebar-link i {
    font-size: 17px;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.15s ease-in-out;
}

.sidebar-link:hover {
    background-color: #f1f5f9;
    color: #0284c7;
}

.sidebar-link:hover i {
    color: #0284c7;
}

.sidebar-link.active {
    background-color: #e0f2fe;
    color: #0284c7;
    font-weight: 600;
}

.sidebar-link.active i {
    color: #0284c7;
}

/* 3. KHU VỰC CHÍNH (MAIN AREA) */
.app-main {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    transition: all 0.25s ease-in-out;
}

/* 4. THANH HEADER TRÊN CÙNG (TOPBAR) */
.app-topbar {
    height: var(--topbar-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.btn-sidebar-toggle {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    transition: all 0.15s;
}

.btn-sidebar-toggle:hover {
    background-color: #f8fafc;
    color: #0f172a;
}

/* Badge Gói cước (👑 Gói Pro) */
.topbar-plan-badge {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    border-radius: 50px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-plan-info {
    font-size: 12.5px;
    color: #64748b;
    margin-left: 8px;
}

/* Khối User Profile */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0068ff 0%, #0099ff 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(0, 104, 255, 0.2);
}

.user-details {
    line-height: 1.25;
}

.user-name {
    font-weight: 600;
    font-size: 13.5px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-email {
    font-size: 11.5px;
    color: #64748b;
}

.btn-logout-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-logout-icon:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* 5. VÙNG NỘI DUNG TRANG (CONTENT AREA) */
.app-content {
    padding: 24px 28px;
    flex-grow: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

/* 6. CARDS THEO PHONG CÁCH MỚI */
.card-zp {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 24px;
    min-width: 0;
    max-width: 100%;
}

/* 7. HÀNG 4 THẺ KPI (STATISTIC CARDS) */
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.kpi-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-icon-blue {
    background-color: #e0f2fe;
    color: #0284c7;
}

.kpi-icon-orange {
    background-color: #ffedd5;
    color: #ea580c;
}

.kpi-icon-purple {
    background-color: #ede9fe;
    color: #7c3aed;
}

.kpi-icon-green {
    background-color: #d1fae5;
    color: #059669;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
}

.kpi-label {
    font-size: 12.5px;
    color: #64748b;
    margin-top: 4px;
}

/* 8. HUY HIỆU TRẠNG THÁI (PILL STATUS BADGES) */
.badge-status {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-status-running {
    background-color: #e0f2fe;
    color: #0284c7;
}

.badge-status-paused {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-status-completed {
    background-color: #dcfce7;
    color: #16a34a;
}

.badge-status-pending {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Mini Progress Bar */
.mini-progress {
    height: 6px;
    border-radius: 10px;
    background-color: #f1f5f9;
    overflow: hidden;
    width: 60px;
}

.mini-progress-bar {
    height: 100%;
    background-color: #10b981;
    border-radius: 10px;
}

/* 9. THU GỌN SIDEBAR (COLLAPSED STATE) */
.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

.sidebar-collapsed .sidebar-brand-wrapper {
    justify-content: center;
    gap: 0;
    padding: 0;
}

.sidebar-collapsed .brand-icon {
    width: 38px;
    height: 38px;
    margin: 0 auto;
}

.sidebar-collapsed .brand-text-group {
    display: none !important;
}

.sidebar-collapsed .sidebar-logo {
    max-width: 40px;
}

.sidebar-collapsed .menu-group-header,
.sidebar-collapsed .sidebar-link span {
    display: none;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

/* 10. RESPONSIVE MOBILE */
@media (max-width: 991.98px) {
    .app-sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .app-content {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .card-zp {
        padding: 14px !important;
        border-radius: 12px !important;
        margin-bottom: 16px !important;
    }

    .table-responsive-zp {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .sidebar-mobile-open .app-sidebar {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1035;
    }

    .sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    .topbar-plan-info {
        display: none;
    }
}

/* 11. CẢI TIẾN NÚT BẤM (BUTTONS) - NỔI BẬT & TRÁNH BỊ CHỮ TRẮNG NỀN TRẮNG */
.btn-outline-primary {
    color: #0068ff !important;
    border-color: #0068ff !important;
    background-color: #ffffff !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary:focus-visible {
    color: #ffffff !important;
    background-color: #0056d6 !important;
    border-color: #0056d6 !important;
    box-shadow: 0 4px 12px rgba(0, 104, 255, 0.25) !important;
}

/* 12. HỆ THỐNG BẢNG DỮ LIỆU CHUẨN ZALO PRO (TABLE SYSTEM) */
.table-responsive-zp {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--card-radius);
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

/* Thanh cuộn ngang mảnh, rõ nét trên Mobile & Desktop */
.table-responsive-zp::-webkit-scrollbar {
    height: 8px;
    width: 8px;
    -webkit-appearance: none;
}
.table-responsive-zp::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.table-responsive-zp::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}
.table-responsive-zp::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.table-zp {
    width: 100%;
    margin-bottom: 0;
    vertical-align: middle;
    border-collapse: separate;
    border-spacing: 0;
}

.table-zp thead {
    background-color: #f8fafc;
    border-bottom: 1px solid #edf2f7;
}

.table-zp thead th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: none;
    border-bottom: 1px solid #edf2f7;
}

.table-zp tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease-in-out;
}

.table-zp tbody tr:hover {
    background-color: #f8fafc;
}

.table-zp tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid #f8fafc;
    font-size: 13px;
    color: #334155;
}

/* Category Pill (Loại chiến dịch, thẻ tròn) */
.badge-pill-outline {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 50px;
    white-space: nowrap;
}

/* Zalo Pro Progress Bar */
.progress-zp {
    height: 6px;
    border-radius: 10px;
    background-color: #f1f5f9;
    overflow: hidden;
    width: 100%;
}

.progress-bar-zp-green {
    height: 100%;
    border-radius: 10px;
    background-color: #10b981;
}

.progress-bar-zp-blue {
    height: 100%;
    border-radius: 10px;
    background-color: #0068ff;
}

/* Zalo Pro Action Buttons (34x34px) */
.btn-action-zp {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-action-zp:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn-action-zp.btn-pause {
    border-color: #fde68a;
    color: #d97706;
    background-color: #fffbeb;
}

.btn-action-zp.btn-pause:hover {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
}

.btn-action-zp.btn-play {
    border-color: #bbf7d0;
    color: #16a34a;
    background-color: #f0fdf4;
}

.btn-action-zp.btn-play:hover {
    background-color: #dcfce7;
    border-color: #22c55e;
    color: #15803d;
}

.btn-action-zp.btn-more {
    border-color: #e2e8f0;
    color: #64748b;
}

.btn-action-zp.btn-more:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.dropdown-menu-zp {
    border-radius: 12px;
    border: 1px solid #edf2f7;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    padding: 6px;
    font-size: 13px;
    z-index: 1060 !important;
    min-width: 220px;
}

.dropdown-menu-zp .dropdown-item {
    border-radius: 8px;
    padding: 7px 12px;
    font-weight: 500;
    color: #334155;
    transition: all 0.15s ease;
}

.dropdown-menu-zp .dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0068ff;
}

.dropdown-menu-zp .dropdown-item.text-danger:hover {
    background-color: #fee2e2;
    color: #dc2626;
}
