* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #00c300 0%, #008400 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 22px;
    font-weight: 700;
}

button {
    border: none;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
}

/* ================= FILTER ================= */

.date-filter {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Select chung */
select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

/* Select header */
.date-filter select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    padding: 10px 40px 10px 15px;
    border-radius: 8px;
    border: none;

    background-color: rgba(255,255,255,0.2);
    color: #fff;

    background-image: url("data:image/svg+xml,%3Csvg fill='white' height='16' viewBox='0 0 20 20' width='10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,7 10,12 15,7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

/* Select trong section */
.analysis-section select,
.data-section select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    padding: 10px 40px 10px 15px;
    border-radius: 8px;
    color: #000;

    background-image: url("data:image/svg+xml,%3Csvg fill='black' height='16' viewBox='0 0 20 20' width='10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,7 10,12 15,7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

.analysis-section select:hover,
.data-section select:hover {
    border: 2px solid #00c300;
}

/* Option dropdown */
.date-filter select option {
    background-color: #fff;
    color: #000;
    font-size: 14px;
    padding: 8px 10px;
}

.date-filter select option:hover,
.date-filter select option:checked {
    background-color: #00c300;
    color: #ffffff;
}

/* ================= NAV ================= */

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
	border: none;
}

.nav-tabs a {
    padding: 10px 20px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tabs a.active {
    background: #00c300;
    color: white;
}

.nav-tabs a:hover {
    background: #00c300;
	color: white;
}

/* ================= SECTION ================= */

.analysis-section,
.data-section,
.chart-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.analysis-section h3,
.data-section h3,
.chart-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #1a1a2e;
}

/* ================= BUTTON ================= */

.period-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.period-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.period-btn:hover {
    border-color: #00c300;
}

.period-btn.active {
    background: #00c300;
    border-color: #00c300;
    color: white;
}

.analysis-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.analysis-btn {
    padding: 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    text-align: left;
}

.analysis-btn:hover {
    border-color: #00c300;
    transform: translateY(-2px);
}

.analysis-btn.active {
    background: #00c300;
    border-color: #00c300;
    color: white;
}

/* ================= STATS ================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-card .label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.stat-card .value {
    font-size: 20px;
    font-weight: 700;
}

/* ================= TABLE (Lấy mặc định từ Azia) ================= */

.campaign-name-cell {
    max-width: 150px;      /* hoặc 50%, tuỳ layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================= STATUS ================= */

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #d1fae5;
    color: #059669;
}

.status-badge.paused {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #dc2626;
}

/* ================= MISC ================= */

.metric-positive {
    color: #10b981;
    font-weight: 600;
}

.metric-negative {
    color: #ef4444;
    font-weight: 600;
}

.metric-highlight {
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.ai-response {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
    border: 2px solid #00c300;
}

.ai-content {
    line-height: 1.8;
}

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00c300;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #00c300;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 8px 10px;
    }
}

.floating-fetch {
    position: fixed;
    right: 20px;
    bottom: 20px;

    width: 60px;
    height: 60px;

    border-radius: 50%;
    border: none;

    background: #00c300;
    color: #fff;

    font-size: 24px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 9999;

    transition: all .25s ease;
}

.floating-fetch:hover {
    transform: scale(1.08);
}

.floating-fetch.loading {
    background: #1877f2;
    cursor: not-allowed;
}

.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* card filter phía trên */
.crm-filter-bar {
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.crm-filter-bar .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 6px;
}

.crm-filter-bar .form-control,
.crm-filter-bar .form-select {
    min-height: 40px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: none;
}

.crm-filter-bar .form-control:focus,
.crm-filter-bar .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.18rem rgba(13,110,253,.12);
}

/* wrapper bảng */
.crm-table-wrap {
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
}

/* datatable mặc định */
#tableLeads_wrapper .dataTables_filter,
#tableLeads_wrapper .dataTables_length {
    display: none;
}

#tableLeads {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    font-size: 14px;
}

/* header */
#tableLeads thead th {
    background: linear-gradient(to bottom, #fcfcfd, #f8fafc);
}

/* body cells */
#tableLeads tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-top: 1px solid #edf1f5 !important;
    border-right: 1px solid #edf1f5;
    background: #fff;
    color: #1d2939;
}

/* zebra nhẹ */
#tableLeads tbody tr:nth-child(even) td {
    background: #fcfcfd;
}

/* hover */
#tableLeads tbody tr:hover td {
    background: #f5f9ff;
}

#tableLeads tbody tr:last-child td {
    border-bottom: none !important;
}

/* cột nowrap */
#tableLeads td:nth-child(1),
#tableLeads td:nth-child(2),
#tableLeads td:nth-child(4),
#tableLeads td:nth-child(9),
#tableLeads td:nth-child(10),
#tableLeads td:nth-child(11) {
    white-space: nowrap;
}

/* ghi chú cắt ngắn */
#tableLeads td:nth-child(8) {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* link phone */
#tableLeads td a {
    color: #1570ef;
    text-decoration: underline;
}

/* badge trạng thái */
#tableLeads .badge {
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 6px 10px;
}

/* nút action */
#tableLeads .btn {
    border-radius: 6px;
    font-size: 13px;
    padding: 6px 12px;
}

/* footer info + paginate */
#tableLeads_wrapper .dataTables_info {
    padding: 14px 0 0;
    color: #475467;
    font-size: 14px;
}

#tableLeads_wrapper .dataTables_paginate {
    padding: 10px 0 0;
}

#tableLeads_wrapper .pagination {
    gap: 4px;
    margin: 0;
}

#tableLeads_wrapper .pagination .page-link {
    min-width: 36px;
    height: 36px;
    border-radius: 6px !important;
    border: 1px solid #d0d5dd;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

#tableLeads_wrapper .pagination .page-item.active .page-link {
    background: #1570ef;
    border-color: #1570ef;
    color: #fff;
}

/* responsive ngang nếu nhiều cột */
.table-responsive {
    overflow-x: auto;
}

/* footer datatable */
.crm-table-footer {
    margin: 0 !important;
    padding: 14px 16px 0;
    border-top: 1px solid #edf1f5;
    background: #fff;
}

/* info text */
#tableLeads_wrapper .dataTables_info {
    padding: 0 !important;
    margin: 0;
    font-size: 14px;
    line-height: 38px;
    color: #667085;
    font-weight: 500;
}

/* paginate wrapper */
#tableLeads_wrapper .dataTables_paginate {
    padding: 0 !important;
    margin: 0;
}

#tableLeads_wrapper .pagination {
    gap: 6px;
    margin: 0;
    align-items: center;
}

/* nút phân trang */
#tableLeads_wrapper .page-item .page-link {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px !important;
    border: 1px solid #d0d5dd;
    background: #ffffff;
    color: #344054;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: all .18s ease;
}

#tableLeads_wrapper .page-item .page-link:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1d2939;
}

#tableLeads_wrapper .page-item.active .page-link {
    background: #1570ef;
    border-color: #1570ef;
    color: #fff;
    box-shadow: 0 4px 10px rgba(21, 112, 239, 0.22);
}

#tableLeads_wrapper .page-item.disabled .page-link {
    background: #f9fafb;
    border-color: #e4e7ec;
    color: #98a2b3;
    box-shadow: none;
}

/* responsive footer */
@media (max-width: 768px) {
    .crm-table-footer {
        padding: 12px 12px 0;
    }

    #tableLeads_wrapper .dataTables_info {
        text-align: center;
        line-height: 1.5;
        margin-bottom: 10px;
    }

    #tableLeads_wrapper .dataTables_paginate {
        display: flex;
        justify-content: center;
    }
}

/* ================= AI CONTENT TABLES ================= */
.ai-content table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.ai-content table th,
.ai-content table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    border: 1px solid #dee2e6;
}

.ai-content table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 600;
}

.ai-content table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

.ai-content table tbody tr:hover {
    color: #212529;
    background-color: rgba(0, 0, 0, 0.075);
}