/* ==========================================================================
   UNIFIED TABLE STYLES — MKCE Website
   Single source of truth for ALL table styling across every page.
   Include AFTER page-specific CSS to enforce consistency.
   ========================================================================== */

/* ---- Unified Table Variables ---- */
:root {
  --tbl-primary: #000066;
  --tbl-accent: #000066;
  --tbl-accent-light: #000d80;
  --tbl-surface: #ffffff;
  --tbl-surface-alt: #f8fafc;
  --tbl-border: #e2e8f0;
  --tbl-text: #334155;
  --tbl-text-light: #64748b;
  --tbl-radius: 12px;
  --tbl-radius-lg: 16px;
  --tbl-shadow: 0 2px 10px rgba(0,0,0,0.04);
  --tbl-font: 'Inter', system-ui, -apple-system, sans-serif;
}


/* ==========================================================================
   1. TABLE WRAPPER — All variants unified
   ========================================================================== */
.r-table-wrap,
.ac-tbl-wrap,
.card-table,
.modern-table-wrapper,
.iedc-table-box {
  background: var(--tbl-surface) !important;
  border: 1px solid var(--tbl-border) !important;
  border-radius: var(--tbl-radius-lg) !important;
  box-shadow: var(--tbl-shadow) !important;
  overflow: hidden !important;
  padding: 0 !important;
}

/* Extra padding for Research page wrapper */
.r-table-wrap {
  padding: 24px !important;
}


/* ==========================================================================
   2. TABLE HEADER BARS (above-table toolbars)
   ========================================================================== */
.ac-tbl-wrap .tbl-head,
.card-table__bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  padding: 14px 20px !important;
  border-bottom: 1px solid var(--tbl-border) !important;
  background: var(--tbl-surface) !important;
}

.ac-tbl-wrap .tbl-label,
.card-table__count {
  font-weight: 700 !important;
  font-size: 0.84rem !important;
  color: var(--tbl-accent) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.card-table__search {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: var(--tbl-surface-alt) !important;
  border-radius: 8px !important;
  padding: 7px 14px !important;
}
.card-table__search i {
  color: var(--tbl-accent-light) !important;
  font-size: 0.95rem !important;
}
.card-table__search input {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-family: var(--tbl-font) !important;
  font-size: 0.84rem !important;
  color: var(--tbl-text) !important;
}

/* Scroll wrappers */
.ac-tbl-wrap .tbl-body,
.card-table__scroll,
.iedc-table-scroll {
  overflow-x: auto !important;
}


/* ==========================================================================
   3. BASE TABLE — Common rules for ALL tables
   ========================================================================== */
.r-table-wrap .table,
.ac-tbl-wrap table,
.ac-tbl-wrap table.dataTable,
.card-table table,
.modern-table-wrapper table,
.modern-table-wrapper table.dataTable,
.iedc-tbl,
table.display {
  width: 100% !important;
  border-collapse: collapse !important;
  font-family: var(--tbl-font) !important;
  font-size: 0.88rem !important;
  margin: 0 !important;
}


/* ==========================================================================
   4. TABLE HEAD — Unified dark header with white text
   ========================================================================== */
.r-table-wrap .table thead th,
.ac-tbl-wrap table thead th,
.ac-tbl-wrap table.dataTable thead th,
.card-table table thead th,
.modern-table-wrapper table thead th,
.modern-table-wrapper table.dataTable thead th,
.iedc-tbl thead th,
.iedc-tbl th,
table.display thead th {
  background: linear-gradient(135deg, #000060, #000070) !important;
  color: #fff !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.4px !important;
  text-transform: uppercase !important;
  padding: 13px 16px !important;
  border: none !important;
  border-bottom: 2px solid rgba(255,255,255,0.12) !important;
  white-space: nowrap !important;
  text-align: left !important;
  line-height: 1.3 !important;
}

/* IEDC thead background override (was gradient) */
.iedc-tbl thead {
  background: linear-gradient(135deg, #000060, #000070) !important;
}

/* Committees page thead override (was light bg) */
.card-table table thead {
  background: linear-gradient(135deg, #000060, #000070) !important;
}
.card-table table thead th {
  color: #fff !important;
}


/* ==========================================================================
   5. TABLE BODY — Consistent cells, zebra striping, hover
   ========================================================================== */
.r-table-wrap .table tbody td,
.ac-tbl-wrap table tbody td,
.ac-tbl-wrap table.dataTable tbody td,
.card-table table tbody td,
.modern-table-wrapper table tbody td,
.modern-table-wrapper table.dataTable tbody td,
.iedc-tbl tbody td,
.iedc-tbl td,
table.display tbody td {
  padding: 12px 16px !important;
  font-size: 0.88rem !important;
  color: var(--tbl-text) !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-left: none !important;
  border-right: none !important;
  vertical-align: middle !important;
  white-space: normal !important;
  word-break: break-word !important;
  background: transparent !important;
}

/* S.No first column — subtle emphasis */
.r-table-wrap .table tbody td:first-child,
.modern-table-wrapper table.dataTable tbody td:first-child {
  font-weight: 600 !important;
  color: var(--tbl-text-light) !important;
  text-align: center !important;
  width: 60px !important;
}

/* Zebra striping — odd rows white, even rows light */
.r-table-wrap .table tbody tr:nth-of-type(odd),
.ac-tbl-wrap table tbody tr:nth-of-type(odd),
.card-table table tbody tr:nth-of-type(odd),
.modern-table-wrapper table tbody tr:nth-of-type(odd),
.iedc-tbl tbody tr:nth-child(odd),
table.display tbody tr:nth-of-type(odd) {
  background-color: #fff !important;
}

.r-table-wrap .table tbody tr:nth-of-type(even),
.r-table-wrap .table tbody tr:nth-of-type(even) td,
.ac-tbl-wrap table tbody tr:nth-of-type(even),
.card-table table tbody tr:nth-of-type(even),
.modern-table-wrapper table tbody tr:nth-of-type(even),
.iedc-tbl tbody tr:nth-child(even),
table.display tbody tr:nth-of-type(even) {
  background-color: var(--tbl-surface-alt) !important;
}

/* Hover */
.r-table-wrap .table tbody tr:hover,
.r-table-wrap .table tbody tr:hover td,
.ac-tbl-wrap table tbody tr:hover,
.ac-tbl-wrap table.dataTable tbody tr:hover,
.card-table table tbody tr:hover,
.modern-table-wrapper table tbody tr:hover,
.modern-table-wrapper table.dataTable tbody tr:hover,
.iedc-tbl tbody tr:hover,
table.display tbody tr:hover {
  background-color: #f1f5f9 !important;
  transition: background 0.2s ease !important;
}

/* No-footer border cleanup */
table.dataTable.no-footer {
  border-bottom: none !important;
}


/* ==========================================================================
   6. DATATABLES PLUGIN OVERRIDES (v1.x and v2.x)
   ========================================================================== */

/* Container */
.dataTables_wrapper,
div.dt-container {
  width: 100% !important;
  padding: 0 !important;
}
div.dt-container div.dt-layout-row {
  align-items: center !important;
}

/* Search — v1.x */
.dataTables_wrapper .dataTables_filter {
  padding: 16px 20px 10px !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  color: var(--tbl-text) !important;
}
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--tbl-border) !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  font-size: 0.88rem !important;
  font-family: var(--tbl-font) !important;
  margin-left: 10px !important;
  outline: none !important;
  background: var(--tbl-surface) !important;
  transition: all 0.2s ease !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--tbl-accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 102, 0.12) !important;
  background: #fff !important;
}

/* Search — v2.x */
.dt-search {
  padding: 16px 20px 10px !important;
}
.dt-search input {
  border-radius: 8px !important;
  border: 1px solid var(--tbl-border) !important;
  padding: 8px 14px !important;
  font-size: 0.88rem !important;
  font-family: var(--tbl-font) !important;
  width: 240px !important;
  transition: all 0.2s ease !important;
  background: var(--tbl-surface-alt) !important;
  margin-left: 10px !important;
}
.dt-search input:focus {
  border-color: var(--tbl-accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 102, 0.1) !important;
  background: #fff !important;
}

/* Length select — v1.x */
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--tbl-border) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-family: var(--tbl-font) !important;
  background: var(--tbl-surface-alt) !important;
}
/* Length select — v2.x */
.dt-length select {
  border-radius: 8px !important;
  border: 1px solid var(--tbl-border) !important;
  padding: 6px 10px !important;
  background: var(--tbl-surface-alt) !important;
  margin-right: 10px !important;
}

/* Pagination — v1.x */
.dataTables_wrapper .dataTables_paginate {
  padding: 14px 20px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
  border: 1px solid transparent !important;
  padding: 7px 14px !important;
  background: transparent !important;
  color: var(--tbl-text-light) !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  font-family: var(--tbl-font) !important;
  margin: 0 2px !important;
  transition: all 0.2s ease !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--tbl-surface-alt) !important;
  color: var(--tbl-accent) !important;
  border-color: var(--tbl-border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--tbl-accent) !important;
  color: #fff !important;
  border-color: var(--tbl-accent) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 102, 0.25) !important;
}

/* Pagination — v2.x (Bootstrap 5 style) */
.page-item.active .page-link {
  background-color: var(--tbl-accent) !important;
  border-color: var(--tbl-accent) !important;
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(0, 0, 102, 0.2) !important;
}
.page-link {
  color: var(--tbl-text) !important;
  border: 1px solid var(--tbl-border) !important;
  margin: 0 2px !important;
  border-radius: 6px !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  padding: 6px 12px !important;
  font-family: var(--tbl-font) !important;
}
.page-link:hover {
  background-color: var(--tbl-surface-alt) !important;
  color: var(--tbl-accent) !important;
}

/* Info text — v1.x */
.dataTables_wrapper .dataTables_info {
  padding: 14px 20px !important;
  font-size: 0.85rem !important;
  color: var(--tbl-text-light) !important;
  font-family: var(--tbl-font) !important;
}
/* Info text — v2.x */
div.dt-container div.dt-info {
  font-size: 0.85rem !important;
  color: var(--tbl-text-light) !important;
}

/* Sorting arrows — space for them */
.r-table-wrap .table thead th.dt-orderable-asc,
.r-table-wrap .table thead th.dt-orderable-desc {
  padding-right: 36px !important;
}

/* Name/sub helper classes (academic council) */
.m-name {
  font-weight: 700;
  color: var(--tbl-primary);
  display: block;
  margin-bottom: 1px;
}
.m-sub {
  font-size: 0.78rem;
  color: var(--tbl-text-light);
  line-height: 1.45;
}

/* Role badges (committees) */
.badge {
  display: inline-block !important;
  padding: 3px 12px !important;
  border-radius: 50px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
}
.badge--chair {
  background: linear-gradient(135deg, #000060, #000070) !important;
  color: #fff !important;
}
.badge--member {
  background: #dde2f0 !important;
  color: var(--tbl-accent) !important;
}
.badge--ext {
  background: #fef3c7 !important;
  color: #92400e !important;
}
.badge--student {
  background: #d1fae5 !important;
  color: #065f46 !important;
}


/* ==========================================================================
   7. RESPONSIVE TABLE STYLES
   ========================================================================== */
@media (max-width: 991px) {
  .r-table-wrap,
  .ac-tbl-wrap,
  .card-table,
  .modern-table-wrapper,
  .iedc-table-box,
  .iedc-table-scroll,
  .ac-tbl-wrap .tbl-body,
  .card-table__scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

@media (max-width: 767px) {
  /* Smaller padding on mobile */
  .r-table-wrap .table thead th,
  .ac-tbl-wrap table thead th,
  .ac-tbl-wrap table.dataTable thead th,
  .card-table table thead th,
  .modern-table-wrapper table thead th,
  .modern-table-wrapper table.dataTable thead th,
  .iedc-tbl thead th,
  .iedc-tbl th,
  table.display thead th {
    font-size: 0.7rem !important;
    padding: 10px 12px !important;
  }

  .r-table-wrap .table tbody td,
  .ac-tbl-wrap table tbody td,
  .ac-tbl-wrap table.dataTable tbody td,
  .card-table table tbody td,
  .modern-table-wrapper table tbody td,
  .modern-table-wrapper table.dataTable tbody td,
  .iedc-tbl tbody td,
  .iedc-tbl td,
  table.display tbody td {
    font-size: 0.82rem !important;
    padding: 10px 12px !important;
  }

  /* Stack DataTables controls */
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    float: none !important;
    text-align: left !important;
    padding: 10px 14px !important;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 6px !important;
  }
  .dt-search input {
    width: 100% !important;
    margin-left: 0 !important;
  }

  /* Table header bar stacks */
  .ac-tbl-wrap .tbl-head,
  .card-table__bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 12px 16px !important;
  }
}

@media (max-width: 575px) {
  .r-table-wrap {
    padding: 12px !important;
  }
  .card-table__search input {
    width: 120px !important;
  }
}
