/* Tax Cottage — Resources page tools (Tax & GST calculator, PAYG estimator,
   calculation worksheets). Extracted from Resources_page.html reference design.
   Scoped: variables live on .tc-tools so nothing leaks into site styles. */

.tc-tools {
    --teal-primary: #0f6b6b;
    --teal-dark: #094f4f;
    --teal-light: #e6f0f0;
    --teal-accent: #1a8585;
    --text-dark: #1f2d2d;
    --text-body: #3a4a4a;
    --text-muted: #8a9696;
    --bg-page: #ffffff;
    --bg-card: #ffffff;
    --bg-section: #fafafa;
    --bg-disclaimer: #f0f7f7;
    --border-light: #e2e7e7;
    --border-input: #d4dbdb;
    --shadow-card: 0 1px 3px rgba(15, 107, 107, 0.06), 0 1px 2px rgba(15, 107, 107, 0.04);
    --shadow-card-hover: 0 4px 12px rgba(15, 107, 107, 0.1);
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

  /* .tc-tools prefix outweighs the site's generic .section h2 sizing */
  .tc-tools .section-heading {
    font-size: 20px;
    font-weight: 700;
    /* Same teal as the link-category headings further down the page */
    color: var(--brand, #0f6f6b);
    margin-bottom: 8px;
    margin-top: 16px;
  }

  .section-wrapper {
    margin-bottom: 56px;
  }

  /* ============ PAYG WITHHOLDING ESTIMATOR ============ */
  .payg-estimator {
    background: #fafafa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
  }
  .payg-inputs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 20px;
    margin-bottom: 22px;
  }
  .payg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .payg-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.2px;
  }
  .payg-field select,
  .payg-field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-size: 15px;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: #fff;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .payg-field select:focus,
  .payg-field input:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px rgba(15, 107, 107, 0.1);
  }
  .payg-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 4px;
  }
  .payg-metric {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 18px;
  }
  .payg-metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
  }
  .payg-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--teal-primary);
    line-height: 1.1;
  }
  .payg-metric.highlight { border-color: var(--teal-primary); background: var(--bg-disclaimer); }
  .payg-metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
  }
  .payg-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 18px;
  }
  @media (max-width: 640px) {
    .payg-estimator { padding: 20px 18px; }
    .payg-inputs { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 420px) {
    .payg-inputs { grid-template-columns: 1fr; }
  }

  /* ============ CALCULATOR EMBED SECTION ============ */
  .calculator-section {
    margin-bottom: 64px;
  }

  .calculator-description {
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 20px;
    max-width: 864px;
  }

  .section-description {
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 20px;
    max-width: 1150px;
  }

  .calculator-embed {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
    flex-wrap: wrap;
  }

  /* ============ TAX BRACKETS REFERENCE PANEL ============ */
  .brackets-column {
    flex: 1;
    min-width: 300px;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    align-self: stretch;
  }

  .tax-brackets-panel {
    background: #fafafa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    min-width: 300px;
    max-width: 460px;
    box-shadow: var(--shadow-card);
  }

  .brackets-title {
    color: var(--teal-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
  }

  .brackets-year {
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--teal-primary);
    margin-left: 4px;
    font-size: 14px;
  }

  .brackets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  .brackets-table th {
    text-align: left;
    font-weight: 700;
    color: var(--teal-primary);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    letter-spacing: 0.3px;
  }

  .brackets-table th.rate-col {
    text-align: right;
  }

  .brackets-table td {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
    font-variant-numeric: tabular-nums;
  }

  .brackets-table tr:last-child td {
    border-bottom: none;
  }

  .brackets-table .rate-cell {
    text-align: right;
    font-weight: 700;
    color: var(--teal-primary);
    white-space: nowrap;
  }

  .brackets-note {
    font-size: 12px;
    color: var(--teal-primary);
    font-style: italic;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 14px;
  }

  /* ============ HELP & CONTACT PANEL ============ */
  .help-contact-panel {
    background: #fafafa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    box-shadow: var(--shadow-card);
  }

  .help-contact-text {
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
  }

  .help-contact-text a {
    color: var(--teal-primary);
    text-decoration: none;
    font-weight: 700;
  }

  .help-contact-text a:hover {
    text-decoration: underline;
  }

  .consultation-text {
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 18px 0;
  }

  .consultation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--teal-primary);
    color: #fff;
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
    box-shadow: var(--shadow-card);
    margin-top: 8px;
  }

  .consultation-btn:hover {
    background: var(--teal-dark);
  }

  .consultation-btn .arrow {
    font-size: 16px;
    line-height: 1;
  }

  /* Calculator styles */
  .calculator {
    background: #fafafa;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    width: 380px;
    max-width: 100%;
    align-self: flex-start;
  }

  .calc-header {
    background: var(--teal-primary);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .calc-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .calc-title-icon {
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
  }

  .calc-history-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
  }

  .calc-history-btn:hover {
    background: rgba(255,255,255,0.2);
  }

  .calc-history-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ============ YEAR SELECTOR (in calc header) ============ */
  .year-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .year-selector-label {
    font-size: 12px;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
  }
  .year-selector {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #0f6b6b;
    background: #ffffff;
    border: 1.5px solid #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
  }
  .year-selector:hover {
    background: #f0f8f8;
  }
  .year-selector:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
  }

  .calc-display {
    background: #ffffff;
    padding: 20px 24px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
  }

  .calc-display-history {
    font-size: 14px;
    color: var(--text-muted);
    min-height: 22px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .calc-display-current {
    font-size: 48px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 56px;
  }

  .calc-memory-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 10px 12px;
    background: #fafafa;
  }

  .calc-memory-btn {
    background: transparent;
    border: none;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    font-family: inherit;
  }

  .calc-memory-btn:hover:not(:disabled) {
    background: #f0f5f5;
    color: var(--teal-primary);
  }

  .calc-memory-btn:disabled {
    color: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
  }

  .calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 12px;
    background: #fafafa;
  }

  .calc-btn {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0;
    height: 48px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(15, 107, 107, 0.04);
  }

  .calc-btn:hover {
    background: #f0f5f5;
    border-color: var(--teal-primary);
    color: var(--teal-primary);
  }

  .calc-btn:active {
    transform: scale(0.97);
    background: var(--teal-light);
  }

  .calc-btn.number {
    font-weight: 600;
    font-size: 19px;
  }

  .calc-btn.function {
    background: #f5f5f5;
    font-size: 16px;
  }

  .calc-btn.function:hover {
    background: #f0f5f5;
  }

  .calc-btn.operator {
    background: #f5f5f5;
    font-size: 20px;
    color: var(--text-dark);
  }

  .calc-btn.operator:hover {
    background: var(--teal-light);
    color: var(--teal-primary);
  }

  .calc-btn.equals {
    background: var(--teal-primary);
    color: #fff;
    border-color: var(--teal-primary);
    font-size: 22px;
    font-weight: 700;
  }

  .calc-btn.equals:hover {
    background: var(--teal-dark);
    color: #fff;
    border-color: var(--teal-dark);
  }

  .calc-btn.gst {
    background: var(--teal-light);
    color: var(--teal-primary);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
  }

  .calc-btn.gst:hover {
    background: var(--teal-primary);
    color: #fff;
    border-color: var(--teal-primary);
  }

  .calc-btn svg {
    width: 18px;
    height: 18px;
  }

  /* ============ CALCULATION WORKSHEETS ============ */
  .worksheet-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .worksheet-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    min-height: 60px;
  }

  .worksheet-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
    border-color: var(--teal-primary);
  }

  .worksheet-card-arrow {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: color 0.2s;
  }

  .worksheet-card:hover .worksheet-card-arrow {
    color: var(--teal-primary);
  }

  .worksheet-card-arrow svg {
    width: 100%;
    height: 100%;
  }

  .worksheet-card-title {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.3;
    flex: 1;
    padding-right: 20px;
  }


  /* ============ WORKSHEET MODAL ============ */
  .ws-modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 47, 47, 0.55);
    display: none; align-items: flex-start; justify-content: center;
    z-index: 10000; padding: 24px; overflow-y: auto; /* above the sticky site header (9999) */
  }
  .ws-modal-overlay.open { display: flex; }
  .ws-modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 1080px;
    margin: 24px auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    max-height: calc(100vh - 48px);
  }
  .ws-modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 20px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
    background: var(--teal-light);
  }
  .ws-modal-title {
    font-size: 16px; font-weight: 700; color: var(--teal-dark);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .ws-modal-close {
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
    background: var(--teal-primary); border: 0; border-radius: 999px;
    padding: 9px 18px; cursor: pointer;
    color: #fff; font-size: 14px; font-weight: 600; line-height: 1;
    transition: background 0.2s;
  }
  .ws-modal-close:hover { background: var(--teal-dark); }
  .ws-modal-body { flex: 1; overflow: hidden; min-height: 0; }
  .ws-modal-iframe { width: 100%; height: 78vh; border: none; display: block; }
  @media (max-width: 768px) {
    .ws-modal-overlay { padding: 0; }
    .ws-modal { max-width: 100%; margin: 0; border-radius: 0; max-height: 100vh; }
    .ws-modal-iframe { height: calc(100vh - 65px); }
  }

  /* Responsive (tool rules only) */
  @media (max-width: 1024px) {
    .worksheet-card-grid { grid-template-columns: repeat(2, 1fr); }
  }

  @media (max-width: 768px) {
    .tc-tools .section-heading { font-size: 20px; }
    .worksheet-card-grid { grid-template-columns: 1fr; gap: 12px; }
    .calc-btn { height: 52px; font-size: 17px; }
    .calc-display-current { font-size: 40px; }
  }

  @media (max-width: 400px) {
    .calc-btn { height: 48px; font-size: 16px; }
    .calc-display-current { font-size: 36px; }
    .calc-memory-btn { font-size: 11px; padding: 6px 2px; }
  }


/* Tool sections span the same width as the link-category grids: the
   brackets/help column stretches to fill the row beside the calculator */
.calculator-embed .brackets-column,
.calculator-embed .tax-brackets-panel {
  max-width: none;
}
.calculator-embed .brackets-column {
  flex: 1 1 auto;
}
