/* ======================================================================
   Fitness Calculators Pro — Frontend Styles
   Uses CSS custom properties so the admin can change --fcp-primary.
   Mobile-first, accessible, zero external dependencies.
   ====================================================================== */

:root {
  --fcp-primary:    #16a085;
  --fcp-primary-dk: #0e7d67;
  --fcp-primary-lt: #e8f8f5;
  --fcp-danger:     #e74c3c;
  --fcp-warning:    #f39c12;
  --fcp-success:    #27ae60;
  --fcp-info:       #2980b9;
  --fcp-text:       #2c3e50;
  --fcp-muted:      #7f8c8d;
  --fcp-border:     #dce1e7;
  --fcp-bg:         #ffffff;
  --fcp-bg2:        #f8f9fa;
  --fcp-shadow:     0 2px 16px rgba(0,0,0,.08);
  --fcp-radius:     12px;
  --fcp-radius-sm:  6px;
  --fcp-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fcp-transition: .2s ease;
}

/* ---- Container -------------------------------------------------------- */

.fcp-calculator {
  font-family: var(--fcp-font);
  color: var(--fcp-text);
  max-width: 680px;
  margin: 2rem auto;
}

.fcp-card {
  background: var(--fcp-bg);
  border-radius: var(--fcp-radius);
  box-shadow: var(--fcp-shadow);
  border: 1px solid var(--fcp-border);
  overflow: hidden;
}

/* ---- Header ----------------------------------------------------------- */

.fcp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.25rem 1.5rem;
  background: var(--fcp-primary-lt);
  border-bottom: 1px solid var(--fcp-border);
}

.fcp-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.fcp-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fcp-primary-dk);
}

/* ---- Form ------------------------------------------------------------- */

.fcp-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fcp-row,
.fcp-field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .fcp-row,
  .fcp-field-group { grid-template-columns: 1fr; }
}

.fcp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fcp-field-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fcp-field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--fcp-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.fcp-field input,
.fcp-field select,
.fcp-field textarea {
  padding: .6rem .85rem;
  border: 1.5px solid var(--fcp-border);
  border-radius: var(--fcp-radius-sm);
  font-size: .95rem;
  font-family: var(--fcp-font);
  color: var(--fcp-text);
  background: var(--fcp-bg);
  transition: border-color var(--fcp-transition), box-shadow var(--fcp-transition);
  width: 100%;
  box-sizing: border-box;
}

.fcp-field input:focus,
.fcp-field select:focus {
  outline: none;
  border-color: var(--fcp-primary);
  box-shadow: 0 0 0 3px rgba(22,160,133,.15);
}

.fcp-field input::placeholder { color: #bdc3c7; }

.fcp-hint {
  font-size: .75rem;
  color: var(--fcp-muted);
  font-style: italic;
}

.fcp-description {
  font-size: .88rem;
  color: var(--fcp-muted);
  margin: 0 0 .5rem;
}

/* ---- Unit toggle ------------------------------------------------------ */

.fcp-unit-toggle {
  display: flex;
  gap: 4px;
  padding-bottom: .5rem;
}

.fcp-unit-btn {
  padding: .35rem 1rem;
  border: 1.5px solid var(--fcp-border);
  border-radius: 20px;
  background: none;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--fcp-muted);
  transition: all var(--fcp-transition);
}

.fcp-unit-btn.active {
  background: var(--fcp-primary);
  border-color: var(--fcp-primary);
  color: #fff;
}

/* ---- Primary button --------------------------------------------------- */

.fcp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: .75rem 1.75rem;
  background: var(--fcp-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--fcp-font);
  border: none;
  border-radius: var(--fcp-radius-sm);
  cursor: pointer;
  transition: background var(--fcp-transition), transform var(--fcp-transition);
  align-self: flex-start;
  margin-top: .25rem;
}

.fcp-btn:hover  { background: var(--fcp-primary-dk); }
.fcp-btn:active { transform: scale(.98); }

.fcp-btn.fcp-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fcp-spin .7s linear infinite;
}

@keyframes fcp-spin { to { transform: rotate(360deg); } }

/* ---- Error state ------------------------------------------------------- */

.fcp-field.fcp-error input,
.fcp-field.fcp-error select { border-color: var(--fcp-danger); }

.fcp-error-msg {
  font-size: .78rem;
  color: var(--fcp-danger);
  margin-top: 2px;
}

/* ---- Results ---------------------------------------------------------- */

.fcp-results {
  border-top: 1px solid var(--fcp-border);
  padding: 1.5rem;
  animation: fcp-fadein .35s ease;
}

@keyframes fcp-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fcp-results-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--fcp-muted);
  margin: 0 0 1rem;
}

/* Metric cards grid */
.fcp-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 1rem;
}

.fcp-metric {
  background: var(--fcp-bg2);
  border: 1px solid var(--fcp-border);
  border-radius: var(--fcp-radius-sm);
  padding: .85rem 1rem;
}

.fcp-metric-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  color: var(--fcp-muted);
  margin: 0 0 2px;
}

.fcp-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fcp-text);
  margin: 0;
  line-height: 1.1;
}

.fcp-metric-unit {
  font-size: .78rem;
  color: var(--fcp-muted);
  font-weight: 400;
}

/* Category badge */
.fcp-badge {
  display: inline-block;
  padding: .3rem 1rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: .75rem;
}

.fcp-badge-green   { background: #d5f5e3; color: #1d6a39; }
.fcp-badge-amber   { background: #fef9e7; color: #7d6608; }
.fcp-badge-red     { background: #fde8e7; color: #922b21; }
.fcp-badge-blue    { background: #d6eaf8; color: #1a5276; }
.fcp-badge-purple  { background: #e8daef; color: #512e5f; }

/* Gauge bar */
.fcp-gauge-wrap {
  margin: .75rem 0;
}

.fcp-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--fcp-muted);
  margin-bottom: 4px;
}

.fcp-gauge-track {
  height: 10px;
  border-radius: 5px;
  background: var(--fcp-border);
  overflow: hidden;
}

.fcp-gauge-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .5s ease;
}

/* Interpretation text */
.fcp-interp {
  font-size: .88rem;
  color: var(--fcp-muted);
  line-height: 1.6;
  margin: .75rem 0 0;
  padding: .75rem 1rem;
  background: var(--fcp-bg2);
  border-left: 3px solid var(--fcp-primary);
  border-radius: 0 var(--fcp-radius-sm) var(--fcp-radius-sm) 0;
}

/* Table results (1RM table, macro table) */
.fcp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
  margin-top: .75rem;
}

.fcp-table th {
  text-align: left;
  padding: 6px 10px;
  background: var(--fcp-bg2);
  border-bottom: 2px solid var(--fcp-border);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fcp-muted);
}

.fcp-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--fcp-border);
  color: var(--fcp-text);
}

.fcp-table tr:last-child td { border-bottom: none; }
.fcp-table tr:hover td { background: var(--fcp-bg2); }
.fcp-table .fcp-highlight { font-weight: 700; color: var(--fcp-primary-dk); }

/* Sleep options */
.fcp-sleep-options { display: flex; flex-direction: column; gap: 8px; }

.fcp-sleep-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1rem;
  border: 1px solid var(--fcp-border);
  border-radius: var(--fcp-radius-sm);
  background: var(--fcp-bg2);
}

.fcp-sleep-option strong { font-size: 1rem; color: var(--fcp-text); }
.fcp-sleep-option span   { font-size: .82rem; color: var(--fcp-muted); }
.fcp-sleep-opt-cycles    { font-size: .72rem; background: var(--fcp-primary-lt); color: var(--fcp-primary-dk); padding: 2px 8px; border-radius: 20px; font-weight: 700; }

/* Heart rate zones */
.fcp-zones { display: flex; flex-direction: column; gap: 6px; }

.fcp-zone {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: .55rem .85rem;
  border-radius: var(--fcp-radius-sm);
  font-size: .85rem;
}

.fcp-zone-name { font-weight: 600; }
.fcp-zone-bar  { height: 8px; border-radius: 4px; }
.fcp-zone-bpm  { font-size: .82rem; color: var(--fcp-muted); white-space: nowrap; }

.fcp-zone-1 { background: #eaf5fb; } .fcp-zone-1 .fcp-zone-bar { background: #85c1e9; }
.fcp-zone-2 { background: #e9f7ef; } .fcp-zone-2 .fcp-zone-bar { background: #52be80; }
.fcp-zone-3 { background: #fefde7; } .fcp-zone-3 .fcp-zone-bar { background: #f4d03f; }
.fcp-zone-4 { background: #fdf2e9; } .fcp-zone-4 .fcp-zone-bar { background: #eb984e; }
.fcp-zone-5 { background: #fde8e7; } .fcp-zone-5 .fcp-zone-bar { background: #ec7063; }

/* ---- Affiliate CTA ---------------------------------------------------- */

.fcp-affiliate {
  margin: 0 1.5rem 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--fcp-primary-lt);
  border: 1px solid var(--fcp-primary);
  border-radius: var(--fcp-radius-sm);
  animation: fcp-fadein .4s ease .1s both;
}

.fcp-affiliate a {
  color: var(--fcp-primary-dk);
  font-weight: 600;
  text-decoration: none;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fcp-affiliate a::after { content: '→'; }
.fcp-affiliate a:hover  { text-decoration: underline; }

/* ---- Email capture ---------------------------------------------------- */

.fcp-email-capture {
  margin: 0 1.5rem 1.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--fcp-bg2);
  border: 1px solid var(--fcp-border);
  border-radius: var(--fcp-radius-sm);
  animation: fcp-fadein .4s ease .2s both;
}

.fcp-email-capture p { font-size: .88rem; margin: 0 0 .75rem; color: var(--fcp-muted); }

.fcp-email-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0;
}

.fcp-email-form input {
  flex: 1;
  min-width: 180px;
  padding: .6rem .85rem;
  border: 1.5px solid var(--fcp-border);
  border-radius: var(--fcp-radius-sm);
  font-size: .9rem;
  font-family: var(--fcp-font);
}

.fcp-email-form input:focus { outline: none; border-color: var(--fcp-primary); }

.fcp-email-form button {
  padding: .6rem 1.25rem;
  background: var(--fcp-primary);
  color: #fff;
  border: none;
  border-radius: var(--fcp-radius-sm);
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  font-family: var(--fcp-font);
}

.fcp-email-form button:hover { background: var(--fcp-primary-dk); }

.fcp-email-success {
  font-size: .88rem;
  color: var(--fcp-success);
  font-weight: 600;
  margin: .5rem 0 0;
}

/* ---- Disclaimer ------------------------------------------------------- */

.fcp-disclaimer {
  margin: 0;
  padding: .75rem 1.25rem;
  font-size: .75rem;
  color: var(--fcp-muted);
  line-height: 1.6;
  border-top: 1px solid var(--fcp-border);
}

/* ---- Hub -------------------------------------------------------------- */

.fcp-hub {
  font-family: var(--fcp-font);
  color: var(--fcp-text);
  max-width: 860px;
  margin: 0 auto 2rem;
}

.fcp-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--fcp-border);
  padding-bottom: 0;
  margin-bottom: 1.5rem;
}

.fcp-tab-btn {
  padding: .55rem 1.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--fcp-font);
  cursor: pointer;
  color: var(--fcp-muted);
  margin-bottom: -2px;
  transition: all var(--fcp-transition);
}

.fcp-tab-btn.active {
  color: var(--fcp-primary);
  border-bottom-color: var(--fcp-primary);
}

.fcp-tab-panel { display: none; }
.fcp-tab-panel.active { display: block; }

.fcp-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.fcp-hub-card {
  background: var(--fcp-bg);
  border: 1px solid var(--fcp-border);
  border-radius: var(--fcp-radius);
  padding: 1.25rem 1.1rem;
  cursor: pointer;
  transition: all var(--fcp-transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fcp-hub-card:hover {
  border-color: var(--fcp-primary);
  box-shadow: 0 4px 20px rgba(22,160,133,.15);
  transform: translateY(-2px);
}

.fcp-hub-icon { font-size: 2rem; line-height: 1; }
.fcp-hub-card strong { font-size: .95rem; color: var(--fcp-text); }
.fcp-hub-card p { font-size: .8rem; color: var(--fcp-muted); margin: 0; line-height: 1.5; }
.fcp-hub-cta { font-size: .8rem; font-weight: 700; color: var(--fcp-primary); margin-top: auto; }

/* ---- Modal ------------------------------------------------------------ */

.fcp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fcp-fadein .2s ease;
}

.fcp-modal-inner {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--fcp-radius);
}

.fcp-modal-inner .fcp-calculator { margin: 0; max-width: none; }

.fcp-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 1;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--fcp-border);
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fcp-modal-close:hover { background: var(--fcp-danger); color: #fff; border-color: var(--fcp-danger); }

/* ---- Responsive adjustments ------------------------------------------ */

@media (max-width: 520px) {
  .fcp-form         { padding: 1rem; }
  .fcp-results      { padding: 1rem; }
  .fcp-metric-grid  { grid-template-columns: 1fr 1fr; }
  .fcp-hub-grid     { grid-template-columns: 1fr 1fr; }
  .fcp-btn          { width: 100%; justify-content: center; }
  .fcp-zone         { grid-template-columns: 100px 1fr auto; }
}

@media (max-width: 360px) {
  .fcp-hub-grid { grid-template-columns: 1fr; }
}
