/* pt/styles.css
   =====================================================
   Progress Trendline – Scoped Styles (FIXED)
===================================================== */

/* ✅ Re-enable motion inside this module ONLY */
#pt-root,
#pt-root *,
#pt-root *::before,
#pt-root *::after {
  animation: initial !important;
  transition: initial !important;
}

/* Optional: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #pt-root,
  #pt-root *,
  #pt-root *::before,
  #pt-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

#pt-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: #111827;
  box-sizing: border-box;
}

/* ---------- Wrapper ---------- */
#pt-root.pt-wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* MOBILE: go edge-to-edge */
@media (max-width: 520px) {
  #pt-root.pt-wrap {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* Kill WP theme side padding ONLY for this module */
.entry-content .pt-wrap,
.entry-content #pt-root {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ---------- Card container ---------- */
#pt-root .pt-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

/* ✅ Mobile cards KEEP rounded corners (do NOT set radius to 0) */
@media (max-width: 520px) {
  #pt-root .pt-card {
    margin-left: 0;
    margin-right: 0;
    border-radius: 16px;
    padding: 12px;
  }
}

/* ---------- Titles ---------- */
#pt-root .pt-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}

#pt-root .pt-sub {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 16px;
}

#pt-root .pt-h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

#pt-root .pt-h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 12px 0 8px;
}

#pt-root .pt-mini {
  font-size: 13px;
  color: #6b7280;
}

/* ---------- Grid / layout ---------- */
#pt-root .pt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (min-width: 720px) {
  #pt-root.pt-wrap {
    padding: 18px 18px;
    max-width: 860px;
  }

  #pt-root .pt-card {
    padding: 18px 18px;
    border-radius: 18px;
  }

  #pt-root .pt-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

/* ---------- Fields ---------- */
#pt-root .pt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#pt-root .pt-label {
  font-size: 13px;
  color: #374151;
}

#pt-root .pt-req {
  color: #dc2626;
}

/* ---------- Inputs ---------- */
#pt-root .pt-input {
  height: 46px;
  padding: 0 12px;
  font-size: 16px; /* prevent mobile zoom */
  line-height: 46px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  outline: none;
  background: #ffffff;
  box-sizing: border-box;
}

#pt-root .pt-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#pt-root .pt-input[type="date"] {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  color: inherit;
}

/* ---------- Time input group (h:m:s) ---------- */
#pt-root .pt-time {
  display: flex;
  align-items: center;
  gap: 6px;
}

#pt-root .pt-time-input {
  width: 64px;
  text-align: center;
  min-width: 0;
}

#pt-root .pt-time-sep {
  color: #6b7280;
}

@media (max-width: 520px) {
  #pt-root .pt-time {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 8px;
  }

  #pt-root .pt-time-input {
    text-align: center;
  }
}

/* ---------- Pace input groups (m:ss /km) ---------- */
#pt-root .pt-pace,
#pt-root .pt-pace-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

#pt-root .pt-pace-input {
  width: 80px;
  text-align: center;
  min-width: 0;
}

#pt-root .pt-pace-sep {
  color: #6b7280;
  font-weight: 700;
}

#pt-root .pt-pace-unit {
  font-size: 14px;
  color: #6b7280;
  white-space: nowrap;
}

@media (max-width: 520px) {
  #pt-root .pt-pace,
  #pt-root .pt-pace-group {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    gap: 8px;
  }

  #pt-root .pt-pace-unit {
    justify-self: start;
  }
}

@media (max-width: 360px) {
  #pt-root .pt-title {
    font-size: 20px;
  }

  #pt-root .pt-input {
    height: 44px;
    line-height: 44px;
  }

  #pt-root .pt-pace-input {
    width: 72px;
  }
}

/* ---------- Radio group ---------- */
#pt-root .pt-levels {
  display: flex;
  gap: 14px;
  margin: 10px 0 16px;
  flex-wrap: wrap;
}

#pt-root .pt-level-title {
  width: 100%;
  font-size: 13px;
  color: #374151;
}

#pt-root .pt-radio {
  font-size: 14px;
  color: #111827;
}

/* ---------- Buttons ---------- */
#pt-root .pt-btn {
  min-height: 46px;
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;

  transition: transform 120ms ease, box-shadow 160ms ease,
    background-color 160ms ease, opacity 160ms ease !important;
  will-change: transform;
}

#pt-root .pt-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

#pt-root .pt-btn:active {
  transform: scale(0.98);
}

#pt-root .pt-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

#pt-root .pt-btn-ghost {
  background: #f3f4f6;
  color: #111827;
}

#pt-root .pt-btn-ghost:hover {
  background: #e5e7eb;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
}

#pt-root .pt-btn-danger {
  background: #dc2626;
}

#pt-root .pt-btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.18);
}

/* ---------- Button rows ---------- */
#pt-root .pt-actions,
#pt-root .pt-footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  #pt-root .pt-actions {
    gap: 10px;
  }
}

/* ---------- Divider ---------- */
#pt-root .pt-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 16px 0;
}

/* ---------- Chart ---------- */
#pt-root .pt-chart-wrap {
  width: 100%;
  margin: 14px 0 8px;

  /* ✅ clipping is done here (stable) */
  border-radius: 12px;
  overflow: hidden;
}

/* canvas should fill and let wrapper handle rounding */
#pt-root .pt-canvas {
  width: 100%;
  height: 280px;
  display: block;
  border-radius: 0; /* important: avoid double rounding artifacts */
  background: #ffffff;
}

@media (min-width: 720px) {
  #pt-root .pt-canvas {
    height: 340px;
  }
}

@media (max-width: 360px) {
  #pt-root .pt-canvas {
    height: 260px;
  }
}

/* ✅ Mobile chart: full width INSIDE card (remove extra chart margin only) */
@media (max-width: 520px) {
  #pt-root #pt-chart-card .pt-chart-wrap {
    margin: 0 !important;
    border-radius: 12px;
    overflow: hidden;
  }
}

/* ---------- List / history ---------- */
#pt-root .pt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#pt-root .pt-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 10px;
  font-size: 14px;
}

#pt-root .pt-date {
  color: #374151;
  font-weight: 500;
}

#pt-root .pt-row .pt-pace {
  color: #111827;
}

#pt-root .pt-proj {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #6b7280;
}

#pt-root .pt-date,
#pt-root .pt-row .pt-pace,
#pt-root .pt-proj {
  overflow-wrap: anywhere;
}

#pt-root .pt-del {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 13px;
  cursor: pointer;
  justify-self: start;
  min-height: 40px;
  padding: 0;
}

@media (min-width: 720px) {
  #pt-root .pt-row {
    grid-template-columns: 110px 120px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
  }

  #pt-root .pt-del {
    justify-self: end;
  }
}

/* ---------- Empty state ---------- */
#pt-root .pt-empty {
  font-size: 14px;
  color: #6b7280;
  padding: 12px 4px;
}

/* ---------- Error ---------- */
#pt-root .pt-error {
  background: #fee2e2;
  color: #7f1d1d;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---------- Warn ---------- */
#pt-root .pt-warn {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  font-size: 14px;
  line-height: 1.6;
  grid-column: 1 / 3;
}

/* ---------- Notes ---------- */
#pt-root .pt-note {
  font-size: 13px;
  color: #6b7280;
  margin-top: 14px;
  line-height: 1.6;
}

/* ---------- Explain box ---------- */
#pt-root .pt-explain {
  margin: 10px 0 12px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 12px;
}

#pt-root .pt-explain-summary {
  cursor: pointer;
  font-weight: 600;
}

#pt-root .pt-explain-body p {
  margin: 10px 0 0;
  color: #374151;
  line-height: 1.6;
}

/* =========================
   Dropdown sections (details/summary)
========================= */
#pt-root .pt-details {
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  margin: 12px 0;
}

#pt-root .pt-summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: #111827;
  transition: background-color 180ms ease !important;
}

#pt-root .pt-summary::-webkit-details-marker {
  display: none;
}

#pt-root .pt-details[open] .pt-summary {
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}

#pt-root .pt-details-body {
  padding: 14px;
}

@media (max-width: 520px) {
  #pt-root .pt-details {
    margin: 10px 0;
  }

  #pt-root .pt-details-body {
    padding: 12px;
  }
}

/* =========================
   Center + widen action buttons
========================= */
#pt-root .pt-actions-center {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

#pt-root .pt-btn-wide {
  min-width: 240px;
  width: min(420px, 100%);
}

@media (max-width: 520px) {
  #pt-root .pt-actions-center {
    flex-direction: column;
    align-items: center;
  }

  #pt-root .pt-btn-wide {
    width: 100%;
    min-width: unset;
  }
}

/* =====================================================
   DETAILS / EXPLAIN — CSS-only open/close animation
   (works with .pt-collapse wrappers)
===================================================== */

#pt-root details.pt-details,
#pt-root details.pt-explain {
  overflow: hidden;
}

#pt-root .pt-summary::-webkit-details-marker,
#pt-root .pt-explain-summary::-webkit-details-marker {
  display: none;
}

#pt-root details.pt-details:not([open]) > .pt-details-body,
#pt-root details.pt-explain:not([open]) > .pt-explain-body {
  display: block;
}

#pt-root .pt-details-body,
#pt-root .pt-explain-body {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

#pt-root .pt-details-body > .pt-collapse,
#pt-root .pt-explain-body > .pt-collapse {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    grid-template-rows 260ms cubic-bezier(.4,0,.2,1),
    opacity 180ms ease,
    transform 220ms ease;
}

#pt-root .pt-collapse > .pt-collapse-inner {
  overflow: hidden;
}

#pt-root details[open].pt-details > .pt-details-body > .pt-collapse,
#pt-root details[open].pt-explain > .pt-explain-body > .pt-collapse {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  transition:
    grid-template-rows 220ms cubic-bezier(.2,.8,.2,1),
    opacity 140ms ease-out,
    transform 160ms ease-out;
}

#pt-root details[open].pt-details > .pt-details-body,
#pt-root details[open].pt-explain > .pt-explain-body {
  padding-top: 14px !important;
  padding-bottom: 14px !important;
}

#pt-root .pt-summary:hover {
  background: rgba(243, 244, 246, 0.6);
}

#pt-root .pt-summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(17, 24, 39, 0.55);
  border-bottom: 2px solid rgba(17, 24, 39, 0.55);
  transform: rotate(45deg);
  transition: transform 220ms ease;
  opacity: 0.9;
  margin-left: 8px;
}

#pt-root .pt-details[open] .pt-summary::after {
  transform: rotate(-135deg);
}

#pt-root .pt-explain-summary {
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: background-color 180ms ease;
  padding-right: 26px;
}

#pt-root .pt-explain-summary:hover {
  background: rgba(243, 244, 246, 0.6);
  border-radius: 10px;
}

#pt-root .pt-explain-summary::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(17, 24, 39, 0.55);
  border-bottom: 2px solid rgba(17, 24, 39, 0.55);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 220ms ease;
  opacity: 0.9;
}

#pt-root .pt-explain[open] .pt-explain-summary::after {
  transform: translateY(-50%) rotate(-135deg);
}

/* =====================================================
   SECTION SEPARATION / CONTRAST (ADD-ON)
===================================================== */

#pt-root.pt-wrap {
  background: #f3f4f6;
  border-radius: 18px;
  padding: 14px;
}

@media (max-width: 520px) {
  #pt-root.pt-wrap {
    border-radius: 0;
    padding: 0 !important;
    background: transparent;
  }
}

#pt-root .pt-card {
  border: 1px solid rgba(17, 24, 39, 0.10);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

#pt-root .pt-header-row {
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.03));
  border: 1px solid rgba(37, 99, 235, 0.12);
  margin-bottom: 12px;
}

#pt-root .pt-divider {
  background: rgba(17, 24, 39, 0.10);
  height: 1px;
  margin: 18px 0;
}

#pt-root .pt-details {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: rgba(249, 250, 251, 0.9);
}

#pt-root .pt-summary {
  background: rgba(255, 255, 255, 0.85);
}

#pt-root .pt-details[open] .pt-summary {
  background: rgba(37, 99, 235, 0.08);
  border-bottom: 1px solid rgba(17, 24, 39, 0.10);
}

#pt-root .pt-explain {
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(243, 244, 246, 0.8);
}

#pt-root .pt-input {
  border-color: rgba(17, 24, 39, 0.18);
}

#pt-root .pt-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

#pt-root .pt-row {
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
}

#pt-root .pt-footer-actions {
  padding-top: 10px;
  border-top: 1px dashed rgba(220, 38, 38, 0.25);
}
