/* Inet Calc XML - frontend styles */

.icx-calculator {
}

/* Collapsible sections */
.icx-collapsible summary,
.icx-table-alt summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 6px 0 10px;
  border-bottom: 1px solid #ccd0d4;
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.icx-collapsible summary::-webkit-details-marker,
.icx-table-alt summary::-webkit-details-marker {
  display: none;
}
.icx-collapsible summary::after,
.icx-table-alt summary::after {
  content: "▾";
  margin-left: 10px;
  transform-origin: center;
  transition: transform 0.2s ease;
  color: #555;
  font-size: 28px;
}
.icx-collapsible[open] summary::after,
.icx-table-alt[open] summary::after {
  transform: rotate(180deg);
}

/* Fields layout */
.icx-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
/* Add top spacing only to collapsibles that contain form fields */
.icx-collapsible:has(.icx-fields) {
  margin-top: 20px;
}
.icx-collapsible summary {
  /* keep size but allow scaling on small screens */
  font-size: 28px;
}
@media (max-width: 640px) {
  .icx-fields {
    grid-template-columns: 1fr;
  }
  .icx-collapsible summary {
    font-size: 22px;
  }
}
.icx-fields label > span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}
 .icx-label-with-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.icx-label-with-help > span {
  flex: 1;
}
.icx-calculator input[type="number"],
.icx-calculator input[type="text"],
.icx-calculator input[type="email"],
.icx-calculator select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccd0d4;
  border-radius: 6px;
}

/* Buttons area */
.icx-actions {
  margin-top: 15px;
  display: flex;
  gap: 8px;
}
@media (max-width: 480px) {
  .icx-actions {
    flex-direction: column;
  }
  .icx-actions .button {
    width: 100%;
  }
}

/* Results containers */
.icx-rendered {
  margin-top: 12px;
}
.icx-result {
  display: none;
  background: #f6f7f7;
  padding: 12px;
  border: 1px solid #ddd;
  overflow: auto;
}

/* Alt block and analysis to match other calculators */
.icx-table-alt {
  margin: 12px 0;
  padding: 12px;
  background: #fff;
}
.icx-alt-box {
  margin-top: 12px;
  border: 2px solid #444;
  padding: 12px;
  font-weight: 700;
  background: #fff;
}
.icx-analysis {
  margin-top: 20px;
}
.icx-analysis h2 {
  margin: 0 0 8px;
}
.icx-table {
  margin: 12px 0;
  padding: 12px;
  background: #fff;
  overflow: auto; /* allow horizontal scroll instead of stacking when needed */
}

/* Visible focus per WCAG 2.2 */
.icx-calculator .button:focus-visible,
.icx-calculator summary:focus-visible,
.icx-calculator select:focus-visible,
.icx-calculator input:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}

/* Responsive table (opt-in via .icx-stack) */
@media (max-width: 640px) {
  .icx-table .icx-responsive-table.icx-stack thead {
    display: none;
  }
  .icx-table .icx-responsive-table.icx-stack,
  .icx-table .icx-responsive-table.icx-stack tbody,
  .icx-table .icx-responsive-table.icx-stack tr,
  .icx-table .icx-responsive-table.icx-stack td {
    display: block;
    width: 100%;
  }
  .icx-table .icx-responsive-table.icx-stack tr {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
  }
  .icx-table .icx-responsive-table.icx-stack td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
  }
  .icx-table .icx-responsive-table.icx-stack td:last-child {
    border-bottom: 0;
  }
  .icx-table .icx-responsive-table.icx-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #1d2327;
    flex: 0 0 56%;
  }
}

/* Table defaults */
.icx-table .icx-responsive-table {
  min-width: 0;
  border-collapse: collapse;
}
.icx-table .icx-responsive-table thead th,
.icx-table .icx-responsive-table td {
  font-size: 16px;
}
@media (max-width: 520px) {
  .icx-table .icx-responsive-table td {
    padding: 6px 8px;
  }
  .icx-table .icx-responsive-table.icx-stack td::before {
    flex: 0 0 48%;
  }
}
.icx-table .icx-responsive-table thead th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #ddd;
  background: #f6f7f7;
  color: #1d2327;
}
.icx-table .icx-responsive-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
}
/* Email form grid responsiveness */
.icx-email-form .icx-email-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 640px) {
  .icx-email-form .icx-email-grid {
    grid-template-columns: 1fr !important;
  }
  .icx-email-form .icx-email-grid .button {
    width: 100%;
  }
}

/* Help buttons */
.icx-help-button {
  margin-left: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Help modals */
.icx-help-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.icx-help-modal.is-open {
  display: flex;
}
.icx-help-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.icx-help-modal__dialog {
  position: relative;
  max-width: 960px;
  width: 95%;
  max-height: 90vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 16px 18px 18px;
  overflow: auto;
  z-index: 1;
}
.icx-help-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.icx-help-modal__title {
  margin: 0;
  font-size: 20px;
}
.icx-help-close {
  border-radius: 50%;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icx-help-modal__body {
  font-size: 14px;
}
.icx-help-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.icx-help-table th,
.icx-help-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
}
.icx-help-table th {
  background: #f6f7f7;
  font-weight: 600;
}
.icx-help-note {
  font-size: 12px;
  font-style: italic;
  color: #555;
}
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* bud03 summary + month progress tables */
.icx-bud03-summary h2 {
  margin: 0 0 10px;
}
.icx-bud03-section h3 {
  margin: 14px 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.icx-bud03-table th,
.icx-bud03-table td {
  font-size: 16px;
}
.icx-bud03-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}
.icx-bud03-table th,
.icx-bud03-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.icx-bud03-table thead th {
  background: #bfbfbf;
  color: #000;
  border-bottom: 1px solid #999;
}
.icx-bud03-value {
  text-align: right;
  white-space: nowrap;
}
.icx-bud03-highlight-row td {
  background: #d9d9d9 !important;
  font-weight: 700;
}
.icx-bud03-month-table thead th {
  background: #bfbfbf;
  color: #000;
}
.icx-bud03-month-table tbody tr:nth-child(even) td {
  background: #f6f7f7;
}
