/**
 * Cost Calculator — page-template stylesheet.
 *
 * Loaded conditionally by App\setup.php only when the
 * 'Cost Calculator' page template is active.
 *
 * All rules are scoped under .cost-calculator-page so they cannot
 * conflict with the theme's own .card, .btn, etc.
 *
 * Colour tokens --navy / --cyan / --text mirror the theme palette
 * (#051944 primary, #0ef5c4 secondary). The other tokens are
 * calculator-specific.
 *
 * Typography inherits from the theme (Effra via Typekit).
 */

.cost-calculator-page {
  --navy: #051944; /* theme primary */
  --cyan: #0ef5c4; /* theme secondary */
  --cyan-dark: #0dd4a8;
  --cyan-pale: #e6fef7;
  --white: #FFFFFF;
  --off-white: #F7F8FA;
  --text: #051944; /* theme primary */
  --text-muted: #5A6178;
  --border: #DDE1E9;
  --shadow-sm: 0 1px 3px rgba(5,18,54,0.05);
  --shadow-md: 0 4px 24px rgba(5,18,54,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Layout ── */
.cost-calculator-page .calculator-wrapper {
  max-width: 1100px;
  margin: 80px auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

.cost-calculator-page .calculator-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 880px) {
  .cost-calculator-page .calculator-grid { grid-template-columns: 1fr; }
}

/* ── Cards ── */
.cost-calculator-page .card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: fadeInUp 0.45s ease both;
}

.cost-calculator-page .card-header { padding: 22px 26px 0; }

.cost-calculator-page .card-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
}

.cost-calculator-page .card-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.cost-calculator-page .card-body { padding: 18px 26px 26px; }

/* ── Form ── */
.cost-calculator-page .field { margin-bottom: 18px; }
.cost-calculator-page .field:last-child { margin-bottom: 0; }

.cost-calculator-page .field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.cost-calculator-page .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.cost-calculator-page .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cost-calculator-page .input-prefix, .cost-calculator-page .input-suffix {
  position: absolute;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.cost-calculator-page .input-prefix { left: 13px; }
.cost-calculator-page .input-suffix { right: 13px; }

.cost-calculator-page input[type="number"], .cost-calculator-page input[type="text"], .cost-calculator-page input[type="email"], .cost-calculator-page select {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.cost-calculator-page input[type="number"]::-webkit-inner-spin-button, .cost-calculator-page input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cost-calculator-page input[type="number"]:focus, .cost-calculator-page input[type="text"]:focus, .cost-calculator-page input[type="email"]:focus, .cost-calculator-page select:focus {
  border-color: var(--cyan-dark);
  box-shadow: 0 0 0 3px rgba(15,245,196,0.15);
}

.cost-calculator-page .input-has-prefix input { padding-left: 30px; }
.cost-calculator-page .input-has-suffix input { padding-right: 34px; }

.cost-calculator-page select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235A6178' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* ── Toggles ── */
.cost-calculator-page .toggle-group {
  display: flex;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1.5px solid var(--border);
}

.cost-calculator-page .toggle-option {
  flex: 1;
  text-align: center;
  padding: 9px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition);
  user-select: none;
}

.cost-calculator-page .toggle-option.active {
  color: var(--navy);
  background: var(--cyan);
  box-shadow: var(--shadow-sm);
}

.cost-calculator-page .toggle-option:not(.active):hover { color: var(--text); }

.cost-calculator-page .margin-toggle {
  display: flex;
  gap: 3px;
  background: var(--off-white);
  border-radius: 5px;
  padding: 2px;
  border: 1.5px solid var(--border);
  margin-bottom: 8px;
}

.cost-calculator-page .margin-toggle-btn {
  flex: 1;
  text-align: center;
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  transition: all var(--transition);
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cost-calculator-page .margin-toggle-btn.active {
  color: var(--navy);
  background: var(--cyan-pale);
}

/* ── IR35 Fields ── */
.cost-calculator-page .ir35-inside-fields {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 0;
  opacity: 0;
}

.cost-calculator-page .ir35-inside-fields.visible {
  max-height: 300px;
  opacity: 1;
}

.cost-calculator-page .ir35-inside-fields .field { padding-top: 14px; }

.cost-calculator-page .ir35-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 7px;
}

.cost-calculator-page .ir35-badge.inside { background: #FFF3E0; color: #E65100; }
.cost-calculator-page .ir35-badge.outside { background: #E8F5E9; color: #2E7D32; }
.cost-calculator-page .ir35-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.cost-calculator-page .divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── Results ── */
.cost-calculator-page .results-card {
  animation-delay: 0.12s;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.cost-calculator-page .results-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cost-calculator-page .inputs-card {
  position: sticky;
  top: 24px;
}

.cost-calculator-page .results-header {
  background: var(--navy);
  color: var(--white);
  padding: 20px 26px;
}

.cost-calculator-page .results-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
}

.cost-calculator-page .results-body { padding: 20px 26px; }

.cost-calculator-page .result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.cost-calculator-page .result-row:last-child { border-bottom: none; }

.cost-calculator-page .result-label { font-size: 0.8rem; color: var(--text-muted); }
.cost-calculator-page .result-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Breakdown ── */
.cost-calculator-page .breakdown-section { margin-top: 14px; }

.cost-calculator-page .breakdown-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cost-calculator-page .breakdown-bar-container {
  height: 7px;
  background: var(--off-white);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  margin-bottom: 10px;
}

.cost-calculator-page .breakdown-bar-segment { height: 100%; transition: width 0.5s ease; }
.cost-calculator-page .breakdown-legend { display: flex; flex-wrap: wrap; gap: 10px; }

.cost-calculator-page .legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cost-calculator-page .legend-dot { width: 7px; height: 7px; border-radius: 2px; }

/* ── Total ── */
.cost-calculator-page .result-total {
  background: var(--navy);
  margin: 18px -26px -20px;
  padding: 22px 26px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.cost-calculator-page .result-total .total-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cost-calculator-page .result-total .result-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
}

.cost-calculator-page .result-total .result-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1.1;
}

.cost-calculator-page .result-total .result-sub {
  font-size: 0.98rem;
  color: #fff;
  margin-top: 3px;
}

/* ── Contact Card ── */
.cost-calculator-page .contact-card {
  animation-delay: 0.2s;
}

.cost-calculator-page .contact-inner {
  margin-top: 24px;
  padding: 28px 26px;
  text-align: center;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.cost-calculator-page .contact-photo {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: var(--navy);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--cyan);
}

.cost-calculator-page .contact-photo svg {
  width: 44px;
  height: 44px;
  fill: var(--cyan);
  opacity: 0.7;
}

.cost-calculator-page .contact-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cost-calculator-page .contact-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.3;
}

.cost-calculator-page .contact-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.cost-calculator-page .contact-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-bottom: 20px;
}

.cost-calculator-page .contact-details a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.cost-calculator-page .contact-details a:hover { color: var(--cyan-dark); }

.cost-calculator-page .contact-details a svg {
  width: 15px;
  height: 15px;
  fill: var(--cyan-dark);
  flex-shrink: 0;
}

.cost-calculator-page .contact-divider { height: 1px; background: var(--border); margin: 18px 0; }

.cost-calculator-page .contact-form-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.cost-calculator-page .contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cost-calculator-page .contact-form input { height: 42px; font-size: 0.85rem; }

.cost-calculator-page label { width: 100%; }

.cost-calculator-page .contact-submit {
  width: 100%;
  height: 44px;
  background: var(--cyan);
  color: var(--navy);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.cost-calculator-page .contact-submit:hover {
  background: var(--cyan-dark);
  box-shadow: 0 4px 12px rgba(15,245,196,0.3);
}

.cost-calculator-page .info-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
  font-style: italic;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.cost-calculator-page .footer {
  text-align: center;
  padding: 36px 24px;
}

.cost-calculator-page .footer * {
  color: var(--text-muted);
  font-size: 0.75rem;
}


@media (max-width: 991px) {
    .cost-calculator-page .calculator-wrapper {
        padding: 40px 0;
    }
}

@media (max-width: 880px) {
  .cost-calculator-page .calculator-wrapper { padding: 0 16px; }
  .cost-calculator-page .card-header, .cost-calculator-page .card-body, .cost-calculator-page .results-body, .cost-calculator-page .results-header, .cost-calculator-page .contact-inner {
    padding-left: 20px;
    padding-right: 20px;
  }
  .cost-calculator-page .result-total { margin-left: -20px; margin-right: -20px; padding: 20px; }
  .cost-calculator-page .field-row { grid-template-columns: 1fr; gap: 10px; }
  .cost-calculator-page .inputs-card { position: static; }
}
