/* ==========================================================================
   TABLE STYLING - LIGHT & DARK MODE
   ========================================================================== */



/* ---- Main --------------------------------------------------------------- */
#main {
  animation: intro 0.3s both;
  animation-delay: 0.35s;
}

/* Mobile / Tablet: stacked */
@media (max-width: 1023px) {
  #main {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-left: 1em;
    padding-right: 1em;
  }
  
  /* Override .archive constraints on mobile */
  #main .archive {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Desktop: DO NOT use grid on #main - it breaks the sidebar */
@media (min-width: 1024px) {
  #main {
    /* Remove grid completely */
    display: block;
    margin-left: 280px; /* Space for fixed sidebar */
    padding: 2em 2rem;
    max-width: calc(100% - 280px);
  }
  
  /* Override .archive Susy grid constraints */
  #main .archive {
    width: 100% !important;
    max-width: 1200px !important;
    float: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
  }
}

/* Larger screens */
@media (min-width: 1400px) {
  #main {
    margin-left: 280px;
    padding: 2em 3rem;
    max-width: calc(100% - 280px);
  }
  
  #main .archive {
    max-width: 1400px !important;
  }
}

.table-container {
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 1144px;
  margin: 0 auto 30px auto;
  position: relative;
  z-index: 1;
}

.projects-table {
  width: 100%;
  max-width: 1144px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 1rem; /* Matched with course table */
  table-layout: fixed;
  background: white;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin: 2em auto;
  transform: translateX(0) !important;
  left: 0 !important;
  right: 0 !important;
}

/* Column width distribution */
.projects-table th:nth-child(1),
.projects-table td:nth-child(1) {
  width: 19.6%;
}

.projects-table th:nth-child(2),
.projects-table td:nth-child(2) {
  width: 30.4%;
}

.projects-table th:nth-child(3),
.projects-table td:nth-child(3) {
  width: 35%;
}

.projects-table th:nth-child(4),
.projects-table td:nth-child(4) {
  width: 15%;
}

.projects-table thead {
  background: linear-gradient(135deg, #2c5aa0, #1e3a8a);
  color: white;
}

.projects-table th {
  padding: 20px 16px; /* Matched with course table */
  text-align: center;
  font-weight: 600; /* Matched with course table */
  font-size: 14px; /* Matched with course table */
  letter-spacing: 0.5px; /* Matched with course table */
  text-transform: uppercase;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1); /* Matched with course table */
  white-space: nowrap;
  color: white;
}

/* Round top corners for first row headers */
.projects-table th:first-child {
  border-top-left-radius: 16px;
}

.projects-table th:last-child {
  border-top-right-radius: 16px;
}

/* Round bottom corners for last row */
.projects-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 16px;
}

.projects-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 16px;
}

.projects-table td {
  padding: 18px 16px; /* Matched with course table */
  border-bottom: 1px solid #f8f9fa; /* Matched with course table */
  vertical-align: middle;
  text-align: center;
  background: white;
  color: #495057; /* Matched with course table */
  font-size: 1rem; /* Base font size matched */
  font-weight: 400;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  white-space: normal;
  line-height: 1.5;
}

/* Make first column (Acronym) text stand out with links */
.projects-table td:first-child {
  font-weight: 600;
  color: #2c5aa0;
}

.projects-table td:first-child a {
  color: #2c5aa0;
  text-decoration: none;
  transition: color 0.2s ease;
}

.projects-table td:first-child a:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

.projects-table tbody tr {
  transition: background-color 0.2s ease;
}

.projects-table tbody tr:hover {
  background-color: rgba(44, 90, 160, 0.05);
}

/* Dark Mode Styles */
html[data-theme="dark"] .table-container {
  background: transparent;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .projects-table {
  background: #2d3748;
}

html[data-theme="dark"] .projects-table thead {
  background: linear-gradient(135deg, #90cdf4, #4299e1);
  color: #1a202c;
}

html[data-theme="dark"] .projects-table th {
  color: #1a202c;
  border-bottom-color: rgba(26, 32, 44, 0.2);
  font-weight: 600;
}

html[data-theme="dark"] .projects-table td {
  border-bottom-color: #4a5568;
  color: #e2e8f0;
  background: #2d3748;
}

html[data-theme="dark"] .projects-table td:first-child {
  color: #90cdf4;
  font-weight: 600;
}

html[data-theme="dark"] .projects-table td:first-child a {
  color: #90cdf4;
}

html[data-theme="dark"] .projects-table td:first-child a:hover {
  color: #63b3ed;
}

html[data-theme="dark"] .projects-table tbody tr:hover {
  background-color: rgba(144, 205, 244, 0.15);
}

/* Responsive layout */
@media (max-width: 1200px) {
  .table-container {
    max-width: 95%;
    margin: 0 auto 30px auto;
  }
  
  .projects-table {
    max-width: 100%;
  }
}

@media (max-width: 1023px) {
  .table-container {
    max-width: calc(100% - 40px);
    margin: 0 20px 30px 20px;
  }
  
  .projects-table th {
    font-size: 14px; /* Consistent */
    padding: 20px 16px;
  }
  
  .projects-table td {
    font-size: 1rem; /* Consistent */
    padding: 18px 16px;
  }
}

@media (max-width: 768px) {
  .projects-table {
    display: block;
    font-size: 13px; /* Matched with course table mobile size */
    max-width: 100%;
  }
  
  .projects-table thead {
    display: none;
  }
  
  .projects-table,
  .projects-table tbody,
  .projects-table tr,
  .projects-table td {
    display: block;
    width: 100% !important;
  }
  
  .projects-table tbody tr {
    background: white;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 16px;
    border: 1px solid #e9ecef;
  }
  
  .projects-table td {
    border: none;
    padding: 8px 0;
    text-align: left !important;
    border-radius: 0 !important;
    font-size: 13px; /* Matched with course table */
  }
  
  .projects-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    font-size: 11px; /* Matched with course table */
    letter-spacing: 0.5px; /* Matched with course table */
    display: block;
    margin-bottom: 4px; /* Matched with course table */
  }
  
  html[data-theme="dark"] .projects-table tbody tr {
    background: #2d3748;
    border-color: #4a5568;
  }
  
  html[data-theme="dark"] .projects-table td::before {
    color: #90cdf4;
  }
}

@media (max-width: 480px) {
  .table-container {
    margin: 0 10px 20px 10px;
  }
  
  .projects-table tbody tr {
    padding: 12px;
  }
  
  .projects-table td {
    padding: 6px 0;
    font-size: 13px; /* Consistent with 768px breakpoint */
  }
  
  .projects-table td::before {
    font-size: 10px; /* Matched with course table */
  }
}
