/* ============================================
   Apexfito Tools — Shared Styles v1.1
   ============================================ */

:root {
  --apx-red: #b22f1e;
  --apx-red-hover: #d93d29;
  --apx-dark: #1b1314;
  --apx-dark-80: #2d1f20;
  --apx-bg: #f8fafc;
  --apx-card: #ffffff;
  --apx-border: #e7edf3;
  --apx-text: #111827;
  --apx-text-secondary: #4b5563;
  --apx-text-light: #6b7280;
  --apx-success: #16a34a;
  --apx-radius: 12px;
  --apx-radius-sm: 8px;
  --apx-radius-header: 0;
  --apx-shadow: 0 4px 24px rgba(0,0,0,0.06);
  --apx-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--apx-font);
  background: var(--apx-bg);
  color: var(--apx-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Header (matching main site) --- */
.apx-tools-header {
  background: var(--apx-dark);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.apx-tools-header__inner {
  max-width: 1290px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.apx-tools-header__left {
  display: flex;
  align-items: center;
  gap: 24px;
}
.apx-tools-header__logo {
  font-weight: 700;
  font-size: 22px;
  color: #fff !important;
  text-decoration: none !important;
  letter-spacing: -0.5px;
}
.apx-tools-header__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.apx-tools-header__nav a {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.apx-tools-header__nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff !important;
}
.apx-tools-header__nav a.apx-nav-active {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
  font-weight: 600;
}

/* --- Container --- */
.apx-tools-main {
  flex: 1;
}
.apx-tools-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* --- Hero Section --- */
.apx-tools-hero {
  text-align: center;
  margin-bottom: 32px;
}
.apx-tools-hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--apx-dark);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.apx-tools-hero p {
  font-size: 17px;
  color: var(--apx-text-secondary);
  max-width: 560px;
  margin: 0 auto;
}
.apx-tools-hero__badge {
  display: inline-block;
  background: #fee2e2;
  color: var(--apx-red);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Calculator Card --- */
.apx-tools-card {
  background: var(--apx-card);
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius);
  box-shadow: var(--apx-shadow);
  padding: 32px;
  margin-bottom: 24px;
}
.apx-tools-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--apx-dark);
}

/* --- Form Elements --- */
.apx-form-group {
  margin-bottom: 20px;
}
.apx-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--apx-text);
  margin-bottom: 6px;
}
.apx-form-group .apx-label-note {
  font-weight: 400;
  color: var(--apx-text-light);
  font-size: 13px;
}

/* Slider */
.apx-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.apx-slider-wrap input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
}
.apx-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--apx-red);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.apx-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--apx-red);
  cursor: pointer;
  border: 3px solid #fff;
}
.apx-slider-value {
  min-width: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--apx-dark);
}

/* Radio Toggle */
.apx-radio-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  overflow: hidden;
}
.apx-radio-group label {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--apx-text-secondary);
  cursor: pointer;
  background: #fff;
  margin: 0;
  border-right: 1px solid var(--apx-border);
  transition: all 0.15s;
}
.apx-radio-group label:last-child { border-right: none; }
.apx-radio-group input[type="radio"] { display: none; }
.apx-radio-group input[type="radio"]:checked + label {
  background: var(--apx-red);
  color: #fff;
  font-weight: 600;
}

/* Number Input */
.apx-input-with-unit {
  display: flex;
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  overflow: hidden;
}
.apx-input-with-unit input[type="number"] {
  flex: 1;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  font-family: var(--apx-font);
  -moz-appearance: textfield;
}
.apx-input-with-unit input[type="number"]::-webkit-outer-spin-button,
.apx-input-with-unit input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.apx-input-with-unit .apx-unit-toggle {
  display: flex;
}
.apx-input-with-unit .apx-unit-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apx-text-secondary);
  background: #f9fafb;
  border: none;
  border-left: 1px solid var(--apx-border);
  cursor: pointer;
  transition: all 0.15s;
}
.apx-input-with-unit .apx-unit-btn.active {
  background: var(--apx-dark);
  color: #fff;
  font-weight: 600;
}

/* Height */
.apx-height-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.apx-height-inputs input {
  flex: 1;
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  padding: 10px 14px;
  font-size: 16px;
  outline: none;
  font-family: var(--apx-font);
}
.apx-height-inputs .apx-height-unit {
  font-size: 13px;
  color: var(--apx-text-light);
}
.apx-height-toggle-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apx-text-secondary);
  background: #f9fafb;
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--apx-font);
}
.apx-height-toggle-btn:hover {
  background: #e5e7eb;
}

/* Select */
.apx-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  background: #fff;
  font-family: var(--apx-font);
  color: var(--apx-text);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* CTA Button */
.apx-btn-primary {
  width: 100%;
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--apx-red);
  border: none;
  border-radius: var(--apx-radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--apx-font);
}
.apx-btn-primary:hover { background: var(--apx-red-hover); }
.apx-btn-primary:active { transform: translateY(1px); }

/* --- Results --- */
.apx-results {
  display: none;
  margin-bottom: 24px;
}
.apx-results.active { display: block; }

.apx-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.apx-result-card {
  text-align: center;
  padding: 20px 12px;
  border-radius: var(--apx-radius);
  border: 1px solid var(--apx-border);
  background: var(--apx-card);
}
.apx-result-card--bmr { border-top: 4px solid var(--apx-text-light); }
.apx-result-card--tdee { border-top: 4px solid var(--apx-red); }
.apx-result-card--goal { border-top: 4px solid var(--apx-success); }
.apx-result-card__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--apx-text-light);
  margin-bottom: 4px;
}
.apx-result-card__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--apx-dark);
}
.apx-result-card__unit {
  font-size: 13px;
  color: var(--apx-text-secondary);
}

/* Macro breakdown */
.apx-macro-section {
  background: var(--apx-card);
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius);
  padding: 24px;
  margin-bottom: 24px;
}
.apx-macro-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--apx-dark);
}
.apx-macro-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}
.apx-macro-bar__protein { background: var(--apx-red); }
.apx-macro-bar__fat { background: #f59e0b; }
.apx-macro-bar__carbs { background: #3b82f6; }
.apx-macro-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.apx-macro-item {
  text-align: center;
  padding: 10px;
  background: var(--apx-bg);
  border-radius: 6px;
}
.apx-macro-item__value {
  font-size: 18px;
  font-weight: 700;
  color: var(--apx-dark);
}
.apx-macro-item__label {
  font-size: 12px;
  color: var(--apx-text-secondary);
  margin-top: 2px;
}

/* Related content */
.apx-related {
  background: var(--apx-card);
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius);
  padding: 24px;
  margin-bottom: 24px;
}
.apx-related h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--apx-dark);
}
.apx-related ul {
  list-style: none;
  padding: 0;
}
.apx-related li {
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}
.apx-related li:last-child { border-bottom: none; }
.apx-related a {
  color: var(--apx-red);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.apx-related a:hover { text-decoration: underline; }
.apx-related .apx-product-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #059669;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
}

/* --- SEO Content --- */
.apx-tools-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--apx-dark);
  margin: 32px 0 12px;
}
.apx-tools-content h2:first-child { margin-top: 0; }
.apx-tools-content p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--apx-text-secondary);
  margin-bottom: 16px;
}
.apx-tools-content a {
  color: var(--apx-red);
  text-decoration: underline;
  font-weight: 500;
}

/* --- FAQ --- */
.apx-faq { margin: 32px 0; }
.apx-faq h2 { margin-bottom: 20px; }
.apx-faq-item {
  border: 1px solid var(--apx-border);
  border-radius: var(--apx-radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}
.apx-faq-question {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--apx-dark);
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--apx-font);
}
.apx-faq-question::after {
  content: '+';
  font-size: 20px;
  color: var(--apx-text-light);
  transition: transform 0.2s;
}
.apx-faq-item.active .apx-faq-question::after {
  transform: rotate(45deg);
}
.apx-faq-answer {
  padding: 0 16px 14px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--apx-text-secondary);
  display: none;
}
.apx-faq-item.active .apx-faq-answer { display: block; }

/* --- Footer (matching main site) --- */
.apx-tools-footer {
  background: var(--apx-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 32px 20px;
  font-size: 13px;
  margin-top: 48px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.apx-tools-footer__inner {
  max-width: 1290px;
  margin: 0 auto;
}
.apx-tools-footer a {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  transition: color 0.2s;
}
.apx-tools-footer a:hover { color: #fff; }
.apx-tools-footer__links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.apx-tools-footer__links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.apx-tools-footer p {
  font-size: 13px;
  margin: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .apx-tools-header__inner {
    padding: 0 16px;
    height: 52px;
  }
  .apx-tools-header__logo { font-size: 18px; }
  .apx-tools-header__nav a {
    font-size: 13px;
    padding: 6px 10px;
  }
  .apx-tools-container { padding: 24px 16px; }
  .apx-tools-hero h1 { font-size: 28px; }
  .apx-tools-hero p { font-size: 15px; }
  .apx-tools-card { padding: 20px; }
  .apx-results-grid { grid-template-columns: 1fr; gap: 8px; }
  .apx-macro-items { grid-template-columns: 1fr; }
  .apx-result-card__value { font-size: 24px; }
  .apx-tools-content h2 { font-size: 20px; }
  .apx-slider-wrap { gap: 8px; }
}

@media (max-width: 480px) {
  .apx-tools-header__nav a.nav-hide-mobile { display: none; }
}
