/* Programs Cascade Page Styles */

.programs-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Programs-specific filter overrides */
.expand-collapse-btn {
  margin-left: auto;
}

/* Table Wrapper */
.programs-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 3rem;
}

/* Table */
.programs-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.95rem;
}

.programs-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
}

.programs-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #374151;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Location Parent Row */
.location-row {
  background: #f0f4f8;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-bottom: 2px solid #e2e8f0;
}

.location-row:hover {
  background: #e2e8f0;
}

.location-row td {
  padding: 1rem 1rem;
}

.toggle-chevron {
  display: inline-block;
  width: 1.2rem;
  font-size: 0.85rem;
  color: #6b7280;
  transition: transform 0.2s;
  vertical-align: middle;
}

.location-row.expanded .toggle-chevron {
  transform: rotate(0deg);
}

.location-row.collapsed .toggle-chevron {
  transform: rotate(-90deg);
}

.location-name {
  font-size: 1.05rem;
  color: #111827;
  vertical-align: middle;
}

.location-address {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-left: 0.75rem;
  vertical-align: middle;
}

/* Session Child Rows */
.session-row {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}

.session-row:hover {
  background: #f0f7ff;
}

.session-row td {
  padding: 0.75rem 1rem;
  color: #1f2937;
  vertical-align: middle;
}

.session-row td:first-child {
  padding-left: 2.5rem;
}

.session-module {
  font-weight: 600;
  color: #111827;
}

.session-dates,
.session-time {
  white-space: nowrap;
}

/* Collapsed: hide session rows */
.location-group .location-row.collapsed ~ .session-row {
  display: none;
}

/* Programs-specific badge/button overrides (base styles in main.css) */

/* Detail View Modal */
.detail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.detail-modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.detail-content {
  background: white;
  border-radius: 16px;
  max-width: 920px;
  width: 100%;
  position: relative;
  margin: 2rem auto;
}

.detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f3f4f6;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.detail-close:hover {
  background: #e5e7eb;
}

.detail-header {
  position: relative;
  height: 300px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}

.detail-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-body {
  padding: 2rem;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: .75rem;
}

.detail-title-left {
  flex: 1;
}

.detail-register-box {
  min-width: 200px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 5;
}

.detail-register-box .btn {
  white-space: nowrap;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  pointer-events: auto;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.module-info-box {
  background: #eff6ff;
  border-left: 4px solid var(--color-lego-blue);
  padding: 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.module-info-box h4 {
  color: var(--color-lego-blue);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.module-info-box p {
  color: #1f2937;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.module-info-box p:last-child {
  margin-bottom: 0;
}

.registration-note {
  background: #fef3c7;
  border-left: 4px solid var(--color-lego-yellow);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.registration-note p {
  color: #92400e;
  font-weight: 600;
  margin: 0;
  font-size: 0.95rem;
}

.program-link-btn {
  display: inline-block;
  background: #f3f4f6;
  color: var(--color-lego-blue);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
  margin-top: 1rem;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.program-link-btn:hover {
  background: #e5e7eb;
  transform: translateY(-2px);
}

.info-section {
  margin-bottom: 1.5rem;
}

.info-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

.info-list {
  list-style: none;
  padding: 0;
}

.info-list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: #4b5563;
}

.info-list li:before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--color-lego-blue);
  font-weight: 700;
}

.sidebar-box {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: 2px solid #e5e7eb;
}

.sidebar-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1f2937;
}

.sidebar-info {
  margin-bottom: 0.75rem;
}

.sidebar-info strong {
  display: block;
  color: #6b7280;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.sidebar-info p {
  color: #1f2937;
  font-weight: 600;
  margin: 0;
}

/* Responsive: stacked layout on mobile */
@media (max-width: 768px) {
  .programs-table thead {
    display: none;
  }

  .programs-table,
  .programs-table tbody,
  .programs-table tr,
  .programs-table td {
    display: block;
    width: 100%;
  }

  /* Location row stays full-width */
  .location-row td {
    padding: 0.875rem 1rem;
  }

  /* Session rows become stacked cards */
  .session-row {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin: 0.5rem 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }

  .session-row td {
    padding: 0.3rem 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .session-row td:first-child {
    padding-left: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 0.25rem;
  }

  .session-row td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #6b7280;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 70px;
    margin-right: 1rem;
  }

  .session-row td[data-label="Action"] {
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
    margin-top: 0.25rem;
    justify-content: flex-end;
  }

  .session-row td[data-label="Action"]::before {
    display: none;
  }

  .location-address {
    display: block;
    margin-left: 1.2rem;
    margin-top: 0.25rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-title-row {
    flex-direction: column;
    gap: 1rem;
  }

  .detail-register-box {
    min-width: 100%;
  }

  .detail-register-box .btn {
    width: 100%;
  }

  .detail-header {
    height: 200px;
  }
}
