/* Additions for the Astro version of the site (loaded after style.css). */

[hidden] {
  display: none !important;
}

/* Headings that moved up a level for a correct outline keep their old look */
.footer-heading {
  margin-bottom: 1rem;
  color: white;
  font-size: 1.17rem;
}
.contact-details h3,
.faq-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}
.faq-item h3 {
  margin-bottom: 0.5rem;
}
.error-actions h2 {
  font-size: 1.17rem;
}
.related-calculators h3 {
  font-size: 1.17rem;
}

/* Calculator form */
.radio-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.input-with-unit .form-input {
  flex: 1;
}
.input-with-unit .unit {
  color: var(--text-gray);
  white-space: nowrap;
}

/* Calculator results */
.results-container .results-title {
  margin-top: 0;
}
.result-group h4,
.recommendation h4 {
  margin: 1rem 0 0.5rem;
  color: var(--text-dark);
}
.results-container .error-message {
  margin: 0;
}
.calculator-info {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}
.calculator-info .info-section {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
}
.calculator-info .info-section h2 {
  font-size: 1.2rem;
  margin-top: 0;
}
.calculator-info .info-section p {
  margin: 0;
  color: var(--text-gray);
}

/* Contact form: spinner while sending, inline result message */
.form-spinner {
  display: none;
  width: 1.1em;
  height: 1.1em;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: calcil-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-inline-end: 0.5rem;
}
#submit-btn.is-sending .form-spinner {
  display: inline-block;
}
#submit-btn:disabled {
  opacity: 0.8;
  cursor: progress;
  transform: none;
}
@keyframes calcil-spin {
  to {
    transform: rotate(360deg);
  }
}
.form-status {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
}
.form-status.is-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #047857;
}
.form-status.is-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #b91c1c;
}
[data-theme="dark"] .form-status.is-success {
  color: #6ee7b7;
}
[data-theme="dark"] .form-status.is-error {
  color: #fca5a5;
}

/* Skip link: fully off-screen until focused (the old -40px left a strip visible) */
.skip-link {
  top: 0;
  transform: translateY(-110%);
}
.skip-link:focus {
  transform: none;
}

/* Ads: no box, label or space until Google actually fills the slot */
.ad-container {
  min-height: 0 !important;
  padding: 0 1rem;
  margin: 0 auto !important;
  border: 0 !important;
}
.ad-container .adsbygoogle {
  min-height: 0 !important;
  background: transparent !important;
}
.ad-container .ad-label {
  display: none;
}
ins.adsbygoogle[data-ad-status='unfilled'] {
  display: none !important;
}
.ad-container:has(ins[data-ad-status='filled']) {
  margin: 1.5rem auto !important;
}
.ad-container:has(ins[data-ad-status='filled']) .ad-label {
  display: block;
}

/* No empty band between the header and the first section of each page */
.main-content {
  padding: 0;
}

/* Calculator page: less empty space above the breadcrumb */
.calculator-section {
  padding-top: 1.5rem;
}
.breadcrumb {
  margin-bottom: 1rem;
}

/* Inline form errors */
.field-error {
  margin-top: 0.35rem;
  color: #b91c1c;
  font-size: var(--font-size-sm);
}
[data-theme='dark'] .field-error {
  color: #fca5a5;
}
.form-input[aria-invalid='true'],
.form-select[aria-invalid='true'] {
  border-color: #dc2626;
}

/* Results column before the first calculation */
.results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  text-align: center;
  color: var(--text-gray);
}
.results-placeholder-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}
.results-placeholder-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
  /* On phones the result goes below the form, so no empty box before calculating */
  .calculator-results-section:has(.results-placeholder) {
    display: none;
  }

  /* Header on one row: the language menu opens on tap instead of always showing,
     and the theme/language controls sit next to the menu button. */
  .navbar {
    gap: 0.5rem;
  }
  .theme-controls {
    margin-top: 0;
    margin-inline-start: auto;
    gap: 0.5rem;
  }
  .lang-selector .lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: auto;
    right: auto;
    inset-inline-end: 0;
    margin-top: 0;
    background: var(--bg-white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
  }
  .lang-selector.show .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

/* Amounts like "-591 ₪" keep their minus sign on the left in Hebrew and Arabic */
.result-value {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Number fields are LTR (digits, separators, minus) but stay right-aligned in RTL pages */
[dir='rtl'] .form-input[data-number] {
  text-align: right;
}

/* Line icons */
svg {
  flex-shrink: 0;
}
.dropdown-category strong {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.results-placeholder-icon {
  font-size: inherit;
  color: var(--primary-light);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary-light) 14%, transparent);
  color: var(--primary-color);
  font-size: inherit;
}

/* Homepage: short hero with a search box, then compact calculator tiles */
.hero {
  padding: 2.5rem 0 2rem;
}
.hero h1 {
  margin-bottom: 0.5rem;
}
.hero-subtitle {
  margin-bottom: 1.5rem;
}
.calc-search {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}
.calc-search-icon {
  position: absolute;
  inset-inline-start: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--text-gray);
  pointer-events: none;
}
.calc-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  padding-inline-start: 2.85rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  background: var(--bg-white);
  color: var(--text-dark);
  box-shadow: var(--shadow-lg);
}
.calc-directory {
  padding: 2rem 0 1rem;
  background: var(--bg-light);
}
.calc-directory .category-section + .category-section {
  margin-top: 2rem;
}
.calc-directory .category-title {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  color: var(--text-dark);
}
.category-icon {
  display: inline-flex;
  color: var(--primary-color);
}
.calc-search-empty {
  text-align: center;
  color: var(--text-gray);
  padding: 2rem 0;
}
.calc-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.75rem;
}
.calc-tile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  height: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-white);
  color: var(--text-dark);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.calc-tile:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.calc-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--primary-light) 14%, transparent);
  color: var(--primary-color);
  flex-shrink: 0;
}
.calc-tile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.calc-tile-title {
  font-weight: 600;
  line-height: 1.3;
}
.calc-tile-desc {
  font-size: var(--font-size-sm);
  color: var(--text-gray);
  line-height: 1.4;
}
.calc-tile .popular-badge {
  position: static;
  display: inline-block;
  margin-inline-start: 0.4rem;
  padding: 0.05rem 0.5rem;
  vertical-align: 0.1em;
  font-size: 0.7rem;
}
.calc-tile.popular {
  border-color: color-mix(in srgb, var(--accent-color) 55%, var(--border-color));
}
.related-calculators {
  padding: 2.5rem 0;
}
.related-calculators h2 {
  margin-bottom: 1.25rem;
}
[data-theme='dark'] .calc-tile-icon,
[data-theme='dark'] .feature-icon,
[data-theme='dark'] .category-icon {
  color: var(--primary-light);
}

@media (max-width: 768px) {
  .hero {
    padding: 1.75rem 0 1.5rem;
  }
  .hero-subtitle {
    margin-bottom: 1.25rem;
  }
  .calc-tiles {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .calc-tile {
    padding: 0.7rem 0.85rem;
  }
}

/* Share / print under a result */
.results-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.results-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: var(--font-size-sm);
}
.results-actions-status {
  font-size: var(--font-size-sm);
  color: var(--secondary-color);
}
.related-calculators .calc-tiles {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media print {
  .header,
  .footer,
  .skip-link,
  .breadcrumb,
  .ad-container,
  .related-calculators,
  .calculator-info,
  .cookie-notice,
  .back-to-top,
  .calculate-btn,
  .results-actions,
  .result-ad,
  .form-help {
    display: none !important;
  }
  body,
  .main-content,
  .calculator-section {
    background: #fff !important;
    color: #000 !important;
  }
  .calculator-container {
    display: block !important;
  }
  .calculator-form-section,
  .calculator-results-section {
    box-shadow: none !important;
    border: 1px solid #ccc;
    break-inside: avoid;
    margin-bottom: 1rem;
  }
}

/* Guides page */
.guide-toc ul {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.guide-toc a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-white);
  color: var(--text-dark);
  text-decoration: none;
  font-size: var(--font-size-sm);
}
.guide-toc a:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
}
.guides-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2rem;
}
.guide-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.75rem;
  scroll-margin-top: 1rem;
}
.guide-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.guide-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--primary-light) 14%, transparent);
  color: var(--primary-color);
  flex-shrink: 0;
  font-size: inherit;
}
.guide-title-section h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--text-dark);
}
.guide-description {
  margin: 0.15rem 0 0;
  color: var(--text-gray);
}
.guide-content {
  color: var(--text-dark);
  line-height: 1.7;
}
.guide-content h3,
.guide-calculators h3 {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text-dark);
}
.guide-content ul,
.guide-content ol {
  margin: 0 0 0.75rem;
  padding-inline-start: 1.4rem;
}
.guide-content li {
  margin-bottom: 0.3rem;
}
.guide-calculators {
  margin-top: 1.5rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-color);
}
[data-theme='dark'] .guide-icon {
  color: var(--primary-light);
}
@media (max-width: 768px) {
  .guide-card {
    padding: 1.25rem;
  }
  .guide-title-section h2 {
    font-size: 1.2rem;
  }
}

/* Ad under the result: the card stops being sticky once it has a result, so the ad
   is never in a floating box */
.calculator-results-section:has(.results-container) {
  position: static;
}
.result-ad.ad-container {
  padding: 0;
  max-width: none;
}

/* Text contrast (WCAG AA): darker amber for the logo, dark text on amber buttons and badges */
.logo-highlight {
  color: #d97706;
}
[data-theme="dark"] .logo-highlight {
  color: var(--accent-color);
}
.popular-badge,
.btn-accept {
  color: #1f2937;
}
.footer-bottom .disclaimer {
  color: #4b5563;
}
[data-theme="dark"] .footer-bottom .disclaimer {
  color: var(--text-gray);
}

/* Worked example, FAQ and guide link under a calculator */
.calculator-example .results-breakdown {
  margin: 1rem 0;
}
.calculator-example .result-item {
  margin-bottom: 0.5rem;
}
.example-open {
  display: inline-block;
  font-weight: 600;
}
.calc-faq-item {
  border-top: 1px solid var(--border-color);
}
.calc-faq-item summary {
  cursor: pointer;
  padding: 0.85rem 0;
  list-style-position: inside;
}
.calc-faq-item summary h3 {
  display: inline;
  font-size: 1.05rem;
  margin: 0;
}
.calculator-info .calc-faq-item p {
  padding-bottom: 1rem;
}
.calculator-guide-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
  color: var(--primary-color);
}

/* Guide pages and the guides hub */
.guide-page .breadcrumb {
  margin: 0 0 1rem;
}
.guide-title-section h1 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--text-dark);
}
.guide-content h2,
.guide-calculators h2,
.guide-others h2 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-dark);
}
.guide-updated {
  margin: 1.25rem 0 0;
  font-size: var(--font-size-sm);
  color: var(--text-gray);
}
.guide-others {
  padding-bottom: 2rem;
}
.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.guide-hub {
  padding-bottom: 2rem;
}
.guide-link {
  display: flex;
  gap: 1rem;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: var(--bg-white);
  color: var(--text-dark);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.guide-link:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}
.guide-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--primary-light) 14%, transparent);
  color: var(--primary-color);
  flex-shrink: 0;
}
[data-theme='dark'] .guide-link-icon {
  color: var(--primary-light);
}
.guide-link-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.guide-link-title {
  font-weight: 700;
}
.guide-link-desc {
  font-size: var(--font-size-sm);
  color: var(--text-gray);
}
.guide-link-more {
  margin-top: 0.25rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--primary-color);
}
@media (max-width: 768px) {
  .guide-title-section h1 {
    font-size: 1.3rem;
  }
  .guide-list {
    grid-template-columns: 1fr;
  }
}

/* Footer stats: every label on one line; the month/year is longer than the counts, so it is smaller,
   and every number sits in the same height so the labels line up. */
.stats { gap: 0.5rem; }
.stats .stat-number { height: 2.5rem; display: flex; align-items: center; justify-content: center; }
.stats .stat-number.stat-date { font-size: var(--font-size-xl); }
.stats .stat-label { font-size: var(--font-size-xs, 0.75rem); white-space: nowrap; }

/* Salary amount pages and the gross-to-net table (/calculators/financial/salary/15000) */
.salary-amount h1 {
  margin: 0 0 0.75rem;
  font-size: 1.6rem;
  color: var(--text-dark);
}
.salary-answer {
  font-size: 1.1rem;
}
.table-scroll {
  overflow-x: auto;
}
.breakdown-table tbody th {
  background: none;
  font-weight: 500;
}
.breakdown-table .salary-net th,
.breakdown-table .salary-net td {
  font-weight: 700;
  color: var(--text-dark);
}
.example-open-wrap {
  margin: 1.25rem 0;
}
.salary-amount .note {
  font-size: var(--font-size-sm);
  color: var(--text-gray);
}

/* Ready-made table under a calculator (water by weight, reserve duty pay) */
.calculator-table td {
  white-space: nowrap;
}
.calculator-table .note {
  margin-top: 0.75rem;
  font-size: var(--font-size-sm);
  color: var(--text-gray);
}
