/* ==============================================
   FitPocket — responsive.css
   Mobile-first tweaks that complement fitpocket.css and fitpocket-extra.css
   Safe: no structural changes, only responsive refinements.
   ============================================== */

/* Base: small touch targets on all screens */
button, .fp-btn, a.fp-btn { min-height: 40px; }

/* Wrap long content gracefully */
.fp-container, .fp-card { overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
.table-wrap { width: 100%; overflow-x: auto; }

/* Images scale inside cards/sections */
img, video { max-width: 100%; height: auto; }

/* Breakpoint: ≤ 960px (tablet) */
@media (max-width: 960px) {
  .fp-container { padding-left: 16px; padding-right: 16px; }
  .fp-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

  /* Navbar: soften spacing */
  .fp-nav { padding: 8px 12px; }
  .fp-nav .fp-nav-links { gap: 10px; flex-wrap: wrap; }
  .fp-nav .fp-brand img { max-height: 28px; }
}

/* Breakpoint: ≤ 640px (phones) */
@media (max-width: 640px) {
  .fp-hero { padding: 20px 0; }
  .fp-hero-title { font-size: clamp(22px, 7vw, 28px); }
  .fp-hero-sub { font-size: 0.95rem; }

  /* Cards fill width with comfortable margins */
  .fp-card { border-radius: 12px; padding: 16px !important; }
  .fp-card [class*="grid"], .fp-grid { grid-template-columns: 1fr !important; gap: 12px; }

  /* Buttons stack when needed */
  .fp-actions, .fp-btn-row, .fp-card .fp-actions {
    display: flex; flex-wrap: wrap; gap: 10px;
  }
  .fp-actions .fp-btn, .fp-btn-row .fp-btn { flex: 1 1 auto; }

  /* Forms */
  .fp-input { margin-bottom: 12px; }
  input, select, textarea { width: 100%; }

  /* Footer */
  .fp-footer { text-align: center; }
  .fp-footer .fp-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
  .fp-footer img { max-width: 150px; height: auto; }

  /* Recap/Share tiles */
  .recap-grid, .share-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .recap-card, .share-card { padding: 14px; }

  /* Progress cards/photos */
  .progress-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .progress-photo { border-radius: 12px; overflow: hidden; }

  /* Tables */
  .table-wrap { margin: 0 -8px; padding: 0 8px; }
  table th, table td { padding: 10px; }
}

/* Breakpoint: ≤ 420px (small phones) */
@media (max-width: 420px) {
  .fp-hero-title { font-size: clamp(20px, 8vw, 24px); }
  .fp-nav .fp-brand img { max-height: 24px; }

  /* Tighter gutters */
  .fp-container { padding-left: 12px; padding-right: 12px; }

  /* Buttons */
  .fp-btn { width: 100%; justify-content: center; }
}

/* Utility: hide on mobile / desktop */
@media (max-width: 640px) { .hide-on-mobile { display: none !important; } }
@media (min-width: 641px) { .hide-on-desktop { display: none !important; } }

/* === FitPocket mobile nav collapse === */
@media (max-width: 768px) {
  .fp-header .fp-container { position: relative; }
  .fp-nav {
    display: none;
    position: absolute;
    top: 56px; right: 12px; left: 12px;
    background: var(--fp-surface, #fff);
    border: 1px solid var(--fp-border, rgba(0,0,0,.08));
    border-radius: 12px;
    padding: 10px 12px;
  }
  .fp-nav.is-open { display: block; }
  .fp-nav a, .fp-nav form { display:block; padding:10px 6px; }
}

/* === Earlier Responsive: responsive.css snapshot === */
@media (max-width: 767px) {
    .fp-container {
        padding: 0 16px;
        max-width: 100%;
    }

    .fp-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .fp-nav {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .fp-nav a {
        font-size: 16px;
        padding: 8px 0;
    }

    .fp-btn.fp-btn--ghost {
        width: 100%;
        text-align: center;
    }

    .fp-footer .fp-container {
        padding: 16px;
    }

    .logo {
        height: 50px !important;
    }

    .fp-footer-brand img {
        height: 100px !important;
        width: auto;
    }

    .fp-footer-brand {
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
        text-align: center;
    }

    .fp-footer-brand small {
        flex: none !important;
        text-align: center !important;
    }

    .fp-footer-brand > div:last-child {
        flex-direction: column;
        gap: 8px;
    }

    [aria-label="Chat on WhatsApp"] {
        bottom: 16px !important;
        right: 16px !important;
        width: 48px !important;
        height: 48px !important;
    }

    [aria-label="Chat on WhatsApp"] svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* === FitPocket mobile refinements (2025-10-25) === */

/* Referral row base */
.fp-referral-row {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:stretch;
}

.fp-referral-row-input {
  flex:1 1 240px;
  min-width:200px;
  height:44px;
  display:flex;
  align-items:center;
}

.fp-referral-row-actions {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:stretch;
}

/* Desktop enhancements */
@media (min-width:601px){
  .fp-referral-row{flex-wrap:nowrap;}
  .fp-referral-row-actions{flex-wrap:nowrap;}
}

/* Dashboard helpers and other layout fixes */
@media (max-width:600px){
  /* dashboard quick action buttons become vertical full-width */
  .fp-quick-actions{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  .fp-quick-actions .fp-btn{
    width:100%;
    justify-content:center;
  }

  /* dashboard 2-col cards stack */
  .fp-dash-2col{
    grid-template-columns:1fr !important;
  }

  /* tracking filters row (if present) stacks */
  #filters-form .fp-row{
    flex-direction:column !important;
    align-items:stretch !important;
    gap:10px !important;
  }
  #filters-form .fp-toggles{width:100%;}
  #filters-form .fp-input{width:100%;min-width:0;}

  /* referral row stacks vertically and buttons go full width */
  .fp-referral-row{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  .fp-referral-row-input{
    flex:1 1 auto;
    width:100% !important;
    min-width:0 !important;
    border-radius:12px !important;
    margin-bottom:10px;
  }
  .fp-referral-row-actions{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  .fp-referral-row-actions .fp-btn,
  .fp-referral-row-actions a.fp-btn{
    width:100%;
    justify-content:center;
  }
}
