/* =====================================================================
   CEYBOOK MODERN TABLE STYLES  cb-tables.css
   Matches the site blue-navy theme (#314D7C / #3560c0 / #ADD7FF).
   Include AFTER bootstrap.min.css, jquery.dataTables.min.css, style.css.
===================================================================== */

/* ─── CSS Variables ─────────────────────────────────────────────── */
:root {
  --cb-brand: #4371C6;
  /* matches site --main-title-blue */
  --cb-brand-dark: #2f52a0;
  --cb-brand-light: #b8cef5;
  --cb-header-bg: linear-gradient(135deg, #3b60b3 0%, #4371C6 75% 100%);
  --cb-row-odd: #f5f8ff;
  --cb-row-even: #ffffff;
  --cb-row-hover: #ebf0fc;
  --cb-border: #dce4f5;
  --cb-text: #2d3748;
  --cb-muted: #718096;
  --cb-pos: #1a7f4e;
  --cb-pos-bg: #d4f5e3;
  --cb-neg: #c0392b;
  --cb-neg-bg: #fde8e8;
  --cb-neu-bg: #f0f2f8;
  --cb-neu: #4a5568;
  --cb-shadow: 0 4px 24px rgba(67, 113, 198, .12);
  --cb-shadow-h: 0 8px 32px rgba(67, 113, 198, .20);
}

/* ─── Table-responsive scroll ───────────────────────────────────── */
.cb-table-wrapper.table-responsive {
  border-radius: 12px !important;
  overflow-x: auto !important;
  box-shadow: var(--cb-shadow) !important;
  border: 1px solid var(--cb-border) !important;
  padding: 10px !important;
  /* must be 0 — padding inside overflow:hidden breaks scroll */
  margin-bottom: 1rem !important;
  /* breathing room below each table block */
}

.cb-table-wrapper.table-responsive::-webkit-scrollbar {
  height: 5px;
}

.cb-table-wrapper.table-responsive::-webkit-scrollbar-track {
  background: #f0f4ff;
}

.cb-table-wrapper.table-responsive::-webkit-scrollbar-thumb {
  background: var(--cb-brand-light);
  border-radius: 10px;
}

/* ─── Core bootstrap table overrides ───────────────────────────── */
.cb-table-wrapper .table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 12.5px !important;
  color: var(--cb-text) !important;
  margin-bottom: 0 !important;
  width: 100% !important;
}

/* thead */
.cb-table-wrapper .table thead th,
.cb-table-wrapper .table thead td,
.cb-table-wrapper table.dataTable thead th {
  background: var(--cb-header-bg) !important;
  color: #fff !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  padding: 11px 13px !important;
  border: none !important;
  white-space: nowrap;
  vertical-align: middle !important;
}

/* tbody striped rows */
.cb-table-wrapper .table-striped>tbody>tr:nth-of-type(odd)>* {
  background-color: var(--cb-row-odd) !important;
  box-shadow: none !important;
}

.cb-table-wrapper .table-striped>tbody>tr:nth-of-type(even)>* {
  background-color: var(--cb-row-even) !important;
  box-shadow: none !important;
}

.cb-table-wrapper .table tbody tr:hover>td {
  background-color: var(--cb-row-hover) !important;
}

/* tbody cells */
.cb-table-wrapper .table tbody td {
  padding: 8px 13px !important;
  font-size: 12px !important;
  background: transparent !important;
  vertical-align: middle !important;
  border-top: 1px solid var(--cb-border) !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
}

.cb-table-wrapper .table tbody tr:first-child td {
  border-top: none !important;
}

/* ─── DataTables wrapper ────────────────────────────────────────── */
.cb-table-wrapper .dataTables_wrapper {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  color: var(--cb-text);
}

.cb-table-wrapper .dataTables_wrapper .dataTables_length,
.cb-table-wrapper .dataTables_wrapper .dataTables_filter {
  margin-bottom: 10px;
}

.cb-table-wrapper .dataTables_wrapper label {
  font-size: 12px !important;
  color: var(--cb-muted) !important;
  font-family: 'Poppins', sans-serif !important;
  font-weight: 400 !important;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_length select,
.cb-table-wrapper .dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--cb-border) !important;
  border-radius: 8px !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  font-family: 'Poppins', sans-serif !important;
  background: #fafbff !important;
  color: var(--cb-text) !important;
  outline: none !important;
  transition: border-color .18s, box-shadow .18s;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_filter input:focus,
.cb-table-wrapper .dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--cb-brand) !important;
  box-shadow: 0 0 0 3px rgba(53, 96, 192, .12) !important;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_info {
  font-size: 12px !important;
  color: var(--cb-muted) !important;
  padding-top: .55em;
}

/* ─── Pagination ────────────────────────────────────────────────── */
.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button {
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 9px !important;
  margin: 0 2px !important;
  font-size: 12px !important;
  font-family: 'Poppins', sans-serif !important;
  border-radius: 8px !important;
  border: 1.5px solid var(--cb-border) !important;
  background: #fff !important;
  color: var(--cb-text) !important;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none !important;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--cb-brand-light) !important;
  border-color: var(--cb-brand) !important;
  color: var(--cb-brand-dark) !important;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--cb-header-bg) !important;
  border-color: var(--cb-brand) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(53, 96, 192, .28) !important;
}

.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: #f5f7ff !important;
  border-color: #e8ecf8 !important;
  color: #b0bcd0 !important;
  cursor: default;
  box-shadow: none !important;
}

/* ─── DataTable sorting arrows white on gradient header ─────────── */
.cb-table-wrapper table.dataTable thead th.sorting::before,
.cb-table-wrapper table.dataTable thead th.sorting::after,
.cb-table-wrapper table.dataTable thead th.sorting_asc::before,
.cb-table-wrapper table.dataTable thead th.sorting_asc::after,
.cb-table-wrapper table.dataTable thead th.sorting_desc::before,
.cb-table-wrapper table.dataTable thead th.sorting_desc::after {
  color: rgba(255, 255, 255, .55) !important;
}

.cb-table-wrapper table.dataTable thead th.sorting_asc::before,
.cb-table-wrapper table.dataTable thead th.sorting_desc::after {
  color: rgba(255, 255, 255, .95) !important;
}

/* ─── DataTable row hover & stripe ─────────────────────────────── */
.cb-table-wrapper table.dataTable.hover>tbody>tr:hover>*,
.cb-table-wrapper table.dataTable.display>tbody>tr:hover>* {
  box-shadow: inset 0 0 0 9999px var(--cb-row-hover) !important;
}

.cb-table-wrapper table.dataTable.stripe>tbody>tr.odd>*,
.cb-table-wrapper table.dataTable.display>tbody>tr.odd>* {
  box-shadow: inset 0 0 0 9999px rgba(173, 215, 255, .12) !important;
}

/* ─── Override broad th/td background rule from page CSS ────────── */
.cb-table-wrapper table.dataTable th,
.cb-table-wrapper table.dataTable td {
  background: transparent !important;
  border: none !important;
  font-size: 12px !important;
}

.cb-table-wrapper .cb-table-wrapper table.dataTable thead th {
  background: var(--cb-header-bg) !important;
  color: #fff !important;
}

.cb-table-wrapper table.dataTable tbody th,
.cb-table-wrapper table.dataTable tbody td {
  padding: 8px 13px !important;
  font-size: 12px !important;
}



/* ─── Total growth column highlight ─────────────────────────────── */
.cb-table-wrapper .table td.t_growth,
.cb-table-wrapper table.dataTable tbody td.t_growth {
  font-weight: 700 !important;
  background: #eef2ff !important;
  border-left: 2px solid var(--cb-brand-light) !important;
  color: var(--cb-brand-dark) !important;
}

.cb-table-wrapper .table th.t_growth {
  border-left: 2px solid rgba(255, 255, 255, .3) !important;
}

/* ─── Growth color classes ───────────────────────────────────────── */
.cb-pos {
  color: var(--cb-pos) !important;
  font-weight: 700;
}

.cb-neg {
  color: var(--cb-neg) !important;
  font-weight: 700;
}

.cb-neu {
  color: var(--cb-neu) !important;
  font-weight: 600;
}

.cb-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.cb-pill-pos {
  background: var(--cb-pos-bg);
  color: var(--cb-pos);
}

.cb-pill-neg {
  background: var(--cb-neg-bg);
  color: var(--cb-neg);
}

.cb-pill-neu {
  background: var(--cb-neu-bg);
  color: var(--cb-neu);
}

.cb-pct {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.cb-pct-pos {
  background: var(--cb-pos-bg);
  color: var(--cb-pos);
}

.cb-pct-neg {
  background: var(--cb-neg-bg);
  color: var(--cb-neg);
}

.cb-pct-neu {
  background: var(--cb-neu-bg);
  color: var(--cb-neu);
}

/* ─── Platform badges ───────────────────────────────────────────── */
.cb-plat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

.cb-plat-facebook {
  background: #e7f0ff;
  color: #1877f2;
  border-color: #bee1ff;
}

.cb-plat-instagram {
  background: #fce8f3;
  color: #c13584;
  border-color: #f5b8df;
}

.cb-plat-tiktok {
  background: #f0f0f0;
  color: #111;
  border-color: #ccc;
}

.cb-plat-pinterest {
  background: #ffe8e8;
  color: #e60023;
  border-color: #fbbcbc;
}

.cb-plat-vk {
  background: #e5f0fa;
  color: #2787f5;
  border-color: #b3d4f5;
}

/* ─── Loading spinner ───────────────────────────────────────────── */
.cb-table-wrapper div.dataTables_processing>div:last-child>div {
  background: var(--cb-brand) !important;
}

/* ─── Mobile (tablet + phone) ──────────────────────────────────── */
@media screen and (max-width: 768px) {

  /* DataTables controls — stack vertically */
  .cb-table-wrapper .dataTables_wrapper .dataTables_length,
  .cb-table-wrapper .dataTables_wrapper .dataTables_filter {
    float: none !important;
    text-align: left !important;
    margin-bottom: 6px !important;
  }

  .cb-table-wrapper .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .cb-table-wrapper .dataTables_wrapper .dataTables_info,
  .cb-table-wrapper .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: center !important;
  }

  .cb-table-wrapper .dataTables_wrapper .dataTables_paginate {
    margin-top: .5em;
  }

  /* Smaller cell padding on mobile */
  .cb-table-wrapper .table thead th,
  .cb-table-wrapper .table thead td,
  .cb-table-wrapper table.dataTable thead th {
    padding: 8px 10px !important;
    font-size: 9.5px !important;
  }

  .cb-table-wrapper .table tbody td,
  .cb-table-wrapper table.dataTable tbody td {
    padding: 7px 10px !important;
    font-size: 11.5px !important;
  }

  /* Prevent names from wrapping too early */
  .cb-table-wrapper .table tbody td:first-child {
    min-width: 90px;
    white-space: normal;
    word-break: break-word;
  }

  /* Scroll-hint — right-side fade to signal more columns */
  .cb-table-wrapper.table-responsive {
    padding: 10px !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    border-radius: 10px !important;
  }

  /* Pagination buttons smaller on phone */
  .cb-table-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 28px !important;
    height: 28px !important;
    padding: 0 7px !important;
    font-size: 11px !important;
    margin: 5px 3px !important;
  }
}

/* ─── Print ─────────────────────────────────────────────────────── */
@media print {
  .cb-table-wrapper .table thead th {
    background: #314D7C !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ─── Modern Card View for mobile tables ────────────────────────── */
@media only screen and (max-width: 991px) {

   #no-more-tables .dataTables_empty,
   #no-more-tables1 .dataTables_empty,
   #no-more-tables2 .dataTables_empty,
   #no-more-tables3 .dataTables_empty,
   #no-more-tables4 .dataTables_empty {
        padding: 0 !important;
    }

  /* Hide standard header */
  #no-more-tables thead,
  #no-more-tables1 thead,
  #no-more-tables2 thead,
  #no-more-tables3 thead,
  #no-more-tables4 thead {
    display: none !important;
  }

  /* Make the row a card container */
  #no-more-tables tbody tr,
  #no-more-tables1 tbody tr,
  #no-more-tables2 tbody tr,
  #no-more-tables3 tbody tr,
  #no-more-tables4 tbody tr {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-bottom: 16px !important;
    background-color: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
    border: 1px solid #f0f0f0 !important;
    overflow: hidden !important;
    padding: 0 !important;
  }

  /* Base styles for all cells */
  #no-more-tables tbody td,
  #no-more-tables1 tbody td,
  #no-more-tables2 tbody td,
  #no-more-tables3 tbody td,
  #no-more-tables4 tbody td {
    width: 100% !important;
    order: 1;
    display: block !important;
    text-align: left !important;
    padding: 12px 16px 12px 140px !important;
    border: none !important;
    border-bottom: 1px solid #ebebeb !important;
    position: relative !important;
    min-height: 30px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    word-break: break-word;
    margin-bottom: 0px;
  }

  /* Remove border from last visible cell in the card */
  #no-more-tables tbody td:nth-last-child(2),
  #no-more-tables1 tbody td:nth-last-child(2),
  #no-more-tables2 tbody td:nth-last-child(2),
  #no-more-tables3 tbody td:nth-last-child(2),
  #no-more-tables4 tbody td:nth-last-child(2) {
    border-bottom: none !important;
  }

  /* Style the label */
  #no-more-tables tbody td:before,
  #no-more-tables1 tbody td:before,
  #no-more-tables2 tbody td:before,
  #no-more-tables3 tbody td:before,
  #no-more-tables4 tbody td:before {
    position: absolute !important;
    left: 16px !important;
    top: 12px !important;
    width: 120px !important;
    content: attr(data-title) !important;
    font-weight: 500 !important;
    color: #6b7280 !important;
    text-align: left !important;
    padding-right: 15px !important;
    font-size: 12px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
  }

  /* --- CARD HEADER (First and Last Column) --- */

  /* First Column (e.g. ID, Checkbox) */
  #no-more-tables tbody td:first-child[data-title="id" i],
  #no-more-tables tbody td:first-child[data-title="#" i],
  #no-more-tables tbody td:first-child[data-title="checkbox" i],
  #no-more-tables tbody td:first-child[data-title=""],
  #no-more-tables1 tbody td:first-child[data-title="id" i],
  #no-more-tables1 tbody td:first-child[data-title="#" i],
  #no-more-tables1 tbody td:first-child[data-title="checkbox" i],
  #no-more-tables1 tbody td:first-child[data-title=""],
  #no-more-tables2 tbody td:first-child[data-title="id" i],
  #no-more-tables2 tbody td:first-child[data-title="#" i],
  #no-more-tables2 tbody td:first-child[data-title="checkbox" i],
  #no-more-tables2 tbody td:first-child[data-title=""],
  #no-more-tables3 tbody td:first-child[data-title="id" i],
  #no-more-tables3 tbody td:first-child[data-title="#" i],
  #no-more-tables3 tbody td:first-child[data-title="checkbox" i],
  #no-more-tables3 tbody td:first-child[data-title=""],
  #no-more-tables4 tbody td:first-child[data-title="id" i],
  #no-more-tables4 tbody td:first-child[data-title="#" i],
  #no-more-tables4 tbody td:first-child[data-title="checkbox" i],
  #no-more-tables4 tbody td:first-child[data-title=""] {
    width: 0 !important;
    flex: 1 1 0% !important;
    order: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background-color: #fafafa !important;
    border-bottom: 1px solid #eaeaea !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    padding: 14px 16px !important;
  }

  /* Remove label from first column */
  #no-more-tables tbody td:first-child[data-title="id" i]:before,
  #no-more-tables tbody td:first-child[data-title="#" i]:before,
  #no-more-tables tbody td:first-child[data-title="checkbox" i]:before,
  #no-more-tables tbody td:first-child[data-title=""]:before,
  #no-more-tables1 tbody td:first-child[data-title="id" i]:before,
  #no-more-tables1 tbody td:first-child[data-title="#" i]:before,
  #no-more-tables1 tbody td:first-child[data-title="checkbox" i]:before,
  #no-more-tables1 tbody td:first-child[data-title=""]:before,
  #no-more-tables2 tbody td:first-child[data-title="id" i]:before,
  #no-more-tables2 tbody td:first-child[data-title="#" i]:before,
  #no-more-tables2 tbody td:first-child[data-title="checkbox" i]:before,
  #no-more-tables2 tbody td:first-child[data-title=""]:before,
  #no-more-tables3 tbody td:first-child[data-title="id" i]:before,
  #no-more-tables3 tbody td:first-child[data-title="#" i]:before,
  #no-more-tables3 tbody td:first-child[data-title="checkbox" i]:before,
  #no-more-tables3 tbody td:first-child[data-title=""]:before,
  #no-more-tables4 tbody td:first-child[data-title="id" i]:before,
  #no-more-tables4 tbody td:first-child[data-title="#" i]:before,
  #no-more-tables4 tbody td:first-child[data-title="checkbox" i]:before,
  #no-more-tables4 tbody td:first-child[data-title=""]:before {
    display: none !important;
  }

  /* Last Column (e.g. Actions) */
  #no-more-tables tbody td:last-child[data-title="Action" i],
  #no-more-tables1 tbody td:last-child[data-title="Action" i],
  #no-more-tables2 tbody td:last-child[data-title="Action" i],
  #no-more-tables3 tbody td:last-child[data-title="Action" i],
  #no-more-tables4 tbody td:last-child[data-title="Action" i] {
    width: auto !important;
    flex: 1 1 auto !important;
    order: 1 !important;
    display: flex !important;
    gap: 4px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background-color: #fafafa !important;
    border-bottom: 1px solid #eaeaea !important;
    padding: 14px 16px !important;
    flex-wrap: wrap;
  }

  /* Remove label from last column */
  #no-more-tables tbody td:last-child[data-title="Action" i]:before,
  #no-more-tables1 tbody td:last-child[data-title="Action" i]:before,
  #no-more-tables2 tbody td:last-child[data-title="Action" i]:before,
  #no-more-tables3 tbody td:last-child[data-title="Action" i]:before,
  #no-more-tables4 tbody td:last-child[data-title="Action" i]:before {
    display: none !important;
  }
}