/* ============================================================
   Athlete Profile Plugin — athlete-profile.css
   All selectors are namespaced with .ap- to avoid conflicts
   with the active WordPress theme.
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
.ap-app *,
.ap-app *::before,
.ap-app *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ap-app {
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  margin: 1.5rem 0;
}

/* ── Page Header ──────────────────────────────────────────── */
.ap-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 58px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.ap-brand {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.02em;
}

/* ── Nav Tabs ─────────────────────────────────────────────── */
.ap-nav {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ap-nav::-webkit-scrollbar { display: none; }

.ap-nav-tab {
  font-family: inherit;
  font-size: 13px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ap-nav-tab:hover { color: #374151; }
.ap-nav-tab.ap-active {
  color: #1a56db;
  border-bottom-color: #1a56db;
  font-weight: 500;
}

/* ── Notice Banner ────────────────────────────────────────── */
.ap-notice {
  padding: 10px 1.5rem;
  font-size: 13px;
  font-weight: 500;
}
.ap-notice.ap-success { background: #ecfdf5; color: #065f46; border-bottom: 1px solid #a7f3d0; }
.ap-notice.ap-error   { background: #fef2f2; color: #991b1b; border-bottom: 1px solid #fecaca; }

/* ── Main area ────────────────────────────────────────────── */
.ap-tab-content {
  display: none;
  padding: 1.5rem;
}
.ap-tab-content.ap-visible { display: block; }

/* ── Card ─────────────────────────────────────────────────── */
.ap-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.ap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
}

.ap-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.ap-card-body {
  padding: 1.25rem;
}

/* ── Form Grid ────────────────────────────────────────────── */
.ap-form-grid { display: grid; gap: 1rem; }
.ap-two-col   { grid-template-columns: 1fr 1fr; }

.ap-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ap-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
  display: block;
}

.ap-control {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.ap-control:focus {
  outline: none;
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.ap-select {
  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 fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* Computed / read-only display */
.ap-computed {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  min-height: 38px;
}
.ap-tilde { color: #9ca3af; font-size: 13px; }

/* Inline row (ID + Generate button) */
.ap-inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ap-inline-row .ap-control { flex: 1; }

/* ── Two-pane layout ──────────────────────────────────────── */
.ap-two-pane {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 1.5rem;
}
.ap-pane-divider { background: #e5e7eb; }
.ap-pane { min-width: 0; }

/* ── BMR Radio Group ──────────────────────────────────────── */
.ap-radio-group { display: flex; flex-direction: column; gap: 8px; }
.ap-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}
.ap-radio-option input[type="radio"] {
  accent-color: #1a56db;
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── TDEE display ─────────────────────────────────────────── */
.ap-tdee-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1rem;
  padding: 10px 14px;
  background: #e8effd;
  border-radius: 8px;
}
.ap-tdee-label { font-size: 13px; color: #1040b0; font-weight: 500; }
.ap-tdee-value { font-size: 20px; font-weight: 700; color: #1040b0; }
.ap-tdee-unit  { font-size: 13px; color: #1a56db; }

/* ── Buttons ──────────────────────────────────────────────── */
.ap-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  line-height: 1;
}
.ap-btn:active { transform: scale(0.97); }

.ap-btn-primary { background: #1a56db; color: #fff; }
.ap-btn-primary:hover { background: #1040b0; }

.ap-btn-reset { background: #e07a1a; color: #fff; }
.ap-btn-reset:hover { background: #c56b10; }

.ap-btn-save { background: #1040b0; color: #fff; }
.ap-btn-save:hover { background: #0c2e8a; }

.ap-btn-outline {
  background: #fff;
  color: #4b5563;
  border: 1px solid #d1d5db;
}
.ap-btn-outline:hover { background: #f9fafb; border-color: #9ca3af; }

.ap-btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ap-btn.ap-sm { padding: 7px 12px; }
.ap-mt { margin-top: 1rem; }

/* ── EA Bar ───────────────────────────────────────────────── */
.ap-ea-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #22c55e 0%, #22c55e 45%, #f59e0b 45%, #f59e0b 60%, #ef4444 60%, #ef4444 100%);
  margin: 8px 0 4px;
}

.ap-ea-zones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  font-size: 11px;
  margin-top: 6px;
}
.ap-ea-zone {}
.ap-zone-label { font-weight: 600; font-size: 11px; }
.ap-green { color: #16a34a; }
.ap-amber { color: #d97706; }
.ap-red   { color: #dc2626; }

/* ── Metabolic stats grid ─────────────────────────────────── */
.ap-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 1rem;
}
.ap-meta-stat {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}
.ap-meta-label { font-size: 11px; color: #9ca3af; margin-bottom: 2px; }
.ap-meta-val   { font-size: 20px; font-weight: 600; color: #111827; }
.ap-meta-unit  { font-size: 12px; color: #9ca3af; }

/* ── Badges ───────────────────────────────────────────────── */
.ap-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  margin-left: 4px;
}
.ap-badge-green { background: #dcfce7; color: #16a34a; }
.ap-badge-amber { background: #fef3c7; color: #d97706; }
.ap-badge-red   { background: #fee2e2; color: #dc2626; }

/* ── Alert ────────────────────────────────────────────────── */
.ap-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
}
.ap-alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
.ap-alert-icon { font-size: 15px; flex-shrink: 0; }

/* ── Muted text ───────────────────────────────────────────── */
.ap-muted { font-size: 12px; color: #9ca3af; }

/* ── Placeholder pages ────────────────────────────────────── */
.ap-placeholder {
  text-align: center;
  padding: 4rem 2rem;
  color: #9ca3af;
}
.ap-placeholder h2 {
  font-size: 17px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}
.ap-placeholder p { font-size: 14px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 680px) {
  .ap-two-col     { grid-template-columns: 1fr; }
  .ap-two-pane    { grid-template-columns: 1fr; }
  .ap-pane-divider { display: none; }
  .ap-ea-zones    { grid-template-columns: 1fr 1fr; }
  .ap-meta-grid   { grid-template-columns: 1fr 1fr; }
  .ap-nav-tab     { padding: 12px 10px; font-size: 12px; }
  .ap-tab-content { padding: 1rem; }
}

@media (max-width: 400px) {
  .ap-meta-grid { grid-template-columns: 1fr; }
}
