/* Add-on styles for legal-aid-eligibility.html (inherits site + fees styles) */

/* =========================
   Title, match Fees page
   ========================= */

#legal-aid-eligibility h1,
.eligibility.section h1,
.eligibility-title {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 18px;
}

@media (max-width: 900px) {
  #legal-aid-eligibility h1,
  .eligibility.section h1,
  .eligibility-title {
    font-size: 2rem;
  }
}

/* =========================
   Apple-style info card
   ========================= */

.he-callout {
  background: #f7f7f7;
  border-left: 4px solid #b10f1e;
  border-radius: 16px;
  padding: 18px 20px;
  margin: 20px 0 26px;

  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}

.he-callout__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(177,15,30,0.10);
  color: #b10f1e;
  font-size: 18px;
  margin-top: 2px;
}

.he-callout__content {
  display: block;
  min-width: 0;
}

/* Primary message */
.he-callout__summary {
  margin: 0 0 6px;
  line-height: 1.5;
  max-width: 72ch;
}

/* Compact branded helper line */
.he-callout__firm-note {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #b10f1e;
  opacity: 0.85;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .he-callout__firm-note {
    white-space: normal;
  }
}

/* Source line */
.he-callout__source {
  margin: 0 0 12px;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* =========================
   iOS-style collapsible row
   (real height animation via JS)
   ========================= */

.he-details {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.he-details summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  user-select: none;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.06);
}

.he-details summary::-webkit-details-marker { display: none; }

/* Chevron */
.he-details summary::after {
  content: "›";
  opacity: 0.55;
  font-size: 1.2rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 280ms cubic-bezier(.2,.8,.2,1), opacity 280ms;
}

.he-details[open] summary::after {
  transform: rotate(90deg);
  opacity: 0.7;
}

/* Animated height wrapper */
.he-details__anim {
  height: 0;
  overflow: hidden;
  transition: height 280ms cubic-bezier(.2,.8,.2,1);
  will-change: height;
}

.he-details__body {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(0,0,0,0.06);
}

.he-details__body ul {
  margin: 0;
  padding-left: 18px;
}

.he-details__body li {
  margin: 8px 0;
}

/* =========================
   Back to Fees link (Apple style)
   ========================= */

.eligibility-back {
  display: inline-block;
  margin-bottom: 10px;          /* space before title */
  font-size: 0.95rem;
  font-weight: 500;
  color: #b10f1e;
  text-decoration: none;
  opacity: 0.85;

  transition: opacity 140ms ease, transform 140ms ease;
}

.eligibility-back:hover {
  opacity: 1;
  transform: translateX(-2px);
}

.eligibility-back:active {
  transform: translateX(-1px);
}



/* =========================
   Controls
   ========================= */

.eligibility-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 10px 0 24px;
}

.filter { display: grid; gap: 8px; min-width: 260px; flex: 1; }
.filter__label { font-size: 0.95rem; font-weight: 600; }

#eligibilityFilter {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  outline: none;
}

#eligibilityFilter:focus {
  border-color: #b10f1e;
  box-shadow: 0 0 0 4px rgba(177, 15, 30, 0.14);
}

/* =========================
   Back to Fees link (Apple style)
   ========================= */


/* =========================
   Cards + tables
   ========================= */

.eligibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 12px;
}

.eligibility-card {
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  padding: 18px;
}

.table-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  margin-top: 10px;
}

.eligibility-table { width: 100%; border-collapse: collapse; }

.eligibility-table thead th {
  background: #f6f6f6;
  text-align: left;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
}

.eligibility-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.eligibility-table tbody tr:last-child td { border-bottom: none; }
.eligibility-table tbody tr:hover td { background: rgba(0,0,0,0.02); }

.eligibility-table .amount {
  text-align: right;
  white-space: nowrap;
}

.eligibility-table th:first-child,
.eligibility-table td:first-child {
  width: 60%;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .eligibility-grid { grid-template-columns: 1fr; }
  .eligibility-table .amount { text-align: left; }

  .eligibility-table th:first-child,
  .eligibility-table td:first-child {
    white-space: normal;
    width: auto;
  }
}

/* === Mobile: fit tables within viewport (no horizontal scroll) === */
@media (max-width: 600px) {
  .eligibility-card { padding: 14px; }

  .eligibility-table {
    width: 100% !important;
    table-layout: fixed;
  }

  .eligibility-table thead th,
  .eligibility-table tbody td {
    padding: 10px 10px;
    font-size: 0.92rem;
    line-height: 1.25;
  }

  .eligibility-table th:first-child,
  .eligibility-table td:first-child {
    width: 52%;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .eligibility-table th.amount,
  .eligibility-table td.amount {
    width: 48%;
    white-space: nowrap;
  }

  .eligibility-table thead th {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}

.he-details__body p { margin: 0; }

/* =========================
   Tablet + landscape fix
   Prevent cards/tables from forcing overflow
   ========================= */

/* Let grid children actually shrink (critical for CSS grid) */
.eligibility-grid,
.eligibility-card,
.table-wrap,
.eligibility-table {
  min-width: 0;
}

/* On tablet and phone landscape, keep 2 columns but tighten + allow wrapping */
@media (max-width: 1100px) {
  .eligibility-card { padding: 14px; }

  /* Force the table to fit the card width */
  .eligibility-table {
    width: 100%;
    table-layout: fixed;   /* key: columns must fit available width */
  }

  /* Allow header + cells to wrap instead of creating a minimum width */
  .eligibility-table thead th,
  .eligibility-table tbody td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Amount column should stay tidy, but not force overflow */
  .eligibility-table .amount {
    white-space: nowrap;   /* keep $ values neat */
  }

  /* Make the long header less likely to blow out */
  .eligibility-table thead th {
    font-size: 0.92rem;
    line-height: 1.2;
  }
}

@media (max-width: 980px) {
  .eligibility-grid { grid-template-columns: 1fr; }
}

/* =========================
   Truncate right header with …
   ========================= */

@media (max-width: 1100px) {

  /* Only target the amount/header column */
  .eligibility-table thead th.amount {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* keep the column constrained so ellipsis can happen */
  .eligibility-table th.amount,
  .eligibility-table td.amount {
    max-width: 40%;
  }
}
