
/* Base table styles - keep existing desktop appearance */
.wi-schools-data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 16px;
  font-family: "Area Normal", sans-serif;
}

.wi-schools-data-table th,
.wi-schools-data-table td {
  padding: 12px;
  border: 1px solid #ddd;
  text-align: left;
}

.wi-schools-data-table thead tr {
  background-color: #f1f1f1;
}

/* Mobile table layout - proper table structure */
@media screen and (max-width: 768px) {
  /* Keep proper table display */
  .wi-schools-data-table {
    display: table !important;
    width: auto !important;
    min-width: 100%;
    font-size: 11px;
  }
  
  .wi-schools-data-table thead {
    display: table-header-group !important;
    background: white !important;
    z-index: 20 !important;
  }
  
  .wi-schools-data-table thead tr {
    display: table-row !important;
  }
  
  .wi-schools-data-table tbody {
    display: table-row-group !important;
  }
  
  .wi-schools-data-table tbody tr {
  }
  
  .wi-schools-data-table th,
  .wi-schools-data-table td {
    display: table-cell !important;
    padding: 8px 6px !important;
    border: 1px solid #ddd !important;
    vertical-align: middle !important;
  }
  
  /* Remove any pseudo-element labels */
  .wi-schools-data-table td:before,
  .wi-schools-data-table td:after {
    content: none !important;
    display: none !important;
  }
  
  /* Column 1: School Name - sticky, 30% max width, word wrap */
  .wi-schools-data-table th:nth-child(1),
  .wi-schools-data-table td:nth-child(1) {
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    max-width: 30vw;
    min-width: 120px;
    width: 30vw;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .wi-schools-data-table th:nth-child(1) {
    z-index: 25;
    background: linear-gradient(135deg, #318FAF 0%, #1E7C9C 100%) !important;
    color: white;
  }
  
  /* All other columns - allow normal width */
  .wi-schools-data-table th:nth-child(2),
  .wi-schools-data-table td:nth-child(2),
  .wi-schools-data-table th:nth-child(3),
  .wi-schools-data-table td:nth-child(3),
  .wi-schools-data-table th:nth-child(4),
  .wi-schools-data-table td:nth-child(4),
  .wi-schools-data-table th:nth-child(5),
  .wi-schools-data-table td:nth-child(5),
  .wi-schools-data-table th:nth-child(6),
  .wi-schools-data-table td:nth-child(6),
  .wi-schools-data-table th:nth-child(7),
  .wi-schools-data-table td:nth-child(7) {
    white-space: nowrap;
    min-width: 80px;
  }
  
  /* Maintain alternating row colors for sticky column */
  .wi-schools-data-table tbody tr:nth-child(even):not(.pinned-school) td:nth-child(1) {
    background-color: #fafafa;
  }
  
  .wi-schools-data-table tbody tr:hover td:nth-child(1) {
    background-color: #f8f9ff;
  }
  
  .wi-schools-data-table tbody tr.pinned-school td:nth-child(1) {
    background-color: #fff3cd !important;
  }
  
  .wi-schools-data-table tbody tr.pinned-school:hover td:nth-child(1) {
    background-color: #fff3cd !important;
  }
}

/* Tablet view - slightly larger screens */
@media screen and (max-width: 1024px) and (min-width: 769px) {
  .wi-schools-data-table {
    font-size: 14px;
  }
  
  .wi-schools-data-table th,
  .wi-schools-data-table td {
    padding: 8px;
  }
}

/* Additional mobile enhancements */
@media screen and (max-width: 480px) {
  .wi-schools-data-table {
    font-size: 10px;
  }
  
  .wi-schools-data-table th,
  .wi-schools-data-table td {
    padding: 6px 4px !important;
  }
  
  .wi-schools-data-table th:nth-child(1),
  .wi-schools-data-table td:nth-child(1) {
    max-width: 35vw;
    width: 35vw;
    min-width: 100px;
  }
}

/* Sticky Statistics Section */
.wi-table-stats {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 25px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

/* Add shadow when sticky (optional enhancement) */
.wi-table-stats.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 2px solid #dee2e6;
}

/* Statistics grid - force 3 columns */
.wi-table-stats .stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* Individual stat items */
.wi-table-stats .stat-item {
  background: white;
  padding: 15px;
  border-radius: 4px;
  text-align: center;
  transition: transform 0.2s ease;
}

/* Add subtle hover effect */
.wi-table-stats .stat-item:hover {
  transform: translateY(-2px);
}

/* Stat labels */
.wi-table-stats .stat-label {
  font-family: "Area Normal", Sans-Serif;
  font-size: 13px;
  color: #6c757d;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 5px;
}

/* Stat values */
.wi-table-stats .stat-value {
  font-family: "Filson Pro", Sans-Serif;
  font-size: 24px;
  font-weight: bold;
}

/* Header */
.wi-table-stats h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #034366;
  font-size: 16px;
}

/* Border colors for each stat */
.wi-table-stats .stat-item:nth-child(1) {
  border-left: 4px solid #077A30!important;
}

.wi-table-stats .stat-item:nth-child(2) {
  border-left: 4px solid #318FAF!important;
}

.wi-table-stats .stat-item:nth-child(3) {
  border-left: 4px solid #E2A62D!important;
}

/* Tablet styles */
@media screen and (max-width: 1024px) {
  .wi-table-stats {
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .wi-table-stats .stats-grid {
    gap: 12px;
  }
  
  .wi-table-stats .stat-item {
    padding: 12px 8px;
  }
  
  .wi-table-stats .stat-label {
    font-size: 11px;
    margin-bottom: 4px;
  }
  
  .wi-table-stats .stat-value {
    font-size: 20px;
  }
  
  .wi-table-stats h4 {
    font-size: 15px;
    margin-bottom: 12px;
  }
}

/* Mobile styles - ultra compact */
@media screen and (max-width: 768px) {
  .wi-table-stats {
    padding: 4px;
    margin-bottom: 5px;
    border-radius: 2px;
    border: none;
    background: rgba(248, 249, 250, 0.95);
  }
  
  .wi-table-stats .stats-grid {
    gap: 2px;
    grid-template-columns: 1fr 1fr 1fr;
  }
  
  .wi-table-stats .stat-item {
    padding: 3px 1px;
    border-radius: 2px;
    border-left-width: 2px;
    background: rgba(255, 255, 255, 0.8);
  }
  
  .wi-table-stats .stat-label {
    font-size: 7px;
    margin-bottom: 1px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.3px;
  }
  
  .wi-table-stats .stat-value {
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
  }
}

/* Extra small mobile - micro size */
@media screen and (max-width: 480px) {
  .wi-table-stats {
    padding: 3px!important;
    margin-bottom: 0px;
  }
  
  .wi-table-stats .stats-grid {
    gap: 1px;
    grid-template-columns: 1fr 1fr 1fr;
  }
  
  .wi-table-stats .stat-item {
    padding:3px 0 !important;
    border-left-width: 1px;
  }
  
  .wi-table-stats .stat-label {
    font-size: 6px;
    margin-bottom: 0;
    letter-spacing: 0.2px;
  }
  
  .wi-table-stats .stat-value {
    font-size: 18px!important;
    font-weight: 800;
  }
}

/* Ensure text doesn't wrap and optimize for tiny space */
@media screen and (max-width: 768px) {
  .wi-table-stats .stat-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }
  
  .wi-table-stats .stat-value {
    white-space: nowrap;
    text-align: center;
  }
  
  .wi-table-stats .stat-item:nth-child(1) .stat-label::before {
    content: "";
  }
  .wi-table-stats .stat-item:nth-child(1) .stat-label {
    text-indent: -9999px;
  }
  .wi-table-stats .stat-item:nth-child(1) .stat-label::before {
    text-indent: 0;
    display: block;
  }
  
  .wi-table-stats .stat-item:nth-child(2) .stat-label::before {
    content: "";
  }
  .wi-table-stats .stat-item:nth-child(2) .stat-label {
    text-indent: -9999px;
  }
  .wi-table-stats .stat-item:nth-child(2) .stat-label::before {
    text-indent: 0;
    display: block;
  }
  
  .wi-table-stats .stat-item:nth-child(3) .stat-label::before {
    content: "";
  }
  .wi-table-stats .stat-item:nth-child(3) .stat-label {
    text-indent: -9999px;
  }
  .wi-table-stats .stat-item:nth-child(3) .stat-label::before {
    text-indent: 0;
    display: block;
  }
}

/* Optional: Add a subtle animation when values change */
.wi-table-stats .stat-value {
  transition: all 0.3s ease;
}

/* Optional: Add a small indicator when sticky */
.wi-table-stats.sticky-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #28a745, #007bff, #ffc107);
  border-radius: 6px 6px 0 0;
}

/* Base table controls styling */
.wi-table-controls {
  padding: 10px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
}

.wi-schools-data-table th {
  background: linear-gradient(135deg, #318FAF 0%, #1E7C9C 100%)!important;
  color: white !important;
}

/* Search box container */
.wi-search-box {
  display: flex;
  flex-direction: column;
  gap: 0px;
  margin: 0!important;
}

.wi-search-box label {
  font-weight: 600;
  font-size: 14px;
  color: #495057;
}

.wi-search-box input {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  width: 100%!important;
  background: white;
}

.wi-search-box input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Filters container */
.wi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

/* Select dropdown styling */
.wi-filters select {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  color: #495057;
  min-width: 150px;
  cursor: pointer;
}

.wi-filters select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Tablet responsive - stack controls but keep some horizontal layout */
@media screen and (max-width: 1024px) {
  .wi-table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .wi-search-box {
    align-self: stretch;
  }
  
  .wi-search-box input {
    width: 100%;
    max-width: 400px;
  }
  
  .wi-filters {
    justify-content: flex-start;
    gap: 8px;
  }
  
  .wi-filters select {
    min-width: 140px;
    flex: 1;
    max-width: 200px;
  }
}

/* Mobile responsive - HIDE controls (using modal instead) */
@media screen and (max-width: 768px) {
  .wi-table-controls {
    display: none !important;
  }
}

/* Hover states for desktop */
@media (hover: hover) {
  .wi-search-box input:hover,
  .wi-filters select:hover {
    border-color: #adb5bd;
  }
}

/* Table wrapper for horizontal scrolling on mobile */
.wi-table-wrapper {
  position: relative;
}

/* Ensure sticky works properly */
@media screen and (max-width: 768px) {
  .wi-table-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: 100vw;
    -webkit-overflow-scrolling: touch;
  }
}
/* add this with your other styles */
.wi-table-wrapper,
.wi-schools-data-table td {
  touch-action: pan-x pan-y; /* allow both directions */
}
