/* ============================================
   JamiiFlow — Design System
   Primary:   #1E3A8A (Deep Blue)
   Secondary: #10B981 (Emerald Green)
   Accent:    #F59E0B (Amber)
   BG:        #F8FAFC (Soft Gray)
   ============================================ */

:root {
  --jf-primary:   #1E3A8A;
  --jf-secondary: #10B981;
  --jf-accent:    #F59E0B;
  --jf-bg:        #F8FAFC;
  --jf-dark:      #0F172A;
  --jf-text:      #1E293B;
  --jf-muted:     #64748B;
  --jf-border:    #E2E8F0;
}

/* Base */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--jf-bg);
  color: var(--jf-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Push footer to bottom */
body > main,
body > .main-content {
  flex: 1 0 auto;
}

body > footer,
body > .footer-jf,
body > .group-footer {
  flex-shrink: 0;
}

/* ── Navbar ── */
.navbar-jf {
  background-color: var(--jf-primary) !important;
  border-bottom: 3px solid var(--jf-secondary);
}

.navbar-jf .navbar-brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff !important;
}

.navbar-jf .navbar-brand span {
  color: var(--jf-secondary);
}

.navbar-jf .nav-link {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.navbar-jf .nav-link:hover,
.navbar-jf .nav-link.active {
  color: #fff !important;
  background-color: rgba(255,255,255,0.12);
}

.btn-jf-register {
  background-color: var(--jf-secondary);
  color: #fff !important;
  border: none;
  font-weight: 600;
  padding: 0.4rem 1.1rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.btn-jf-register:hover {
  background-color: #0ea271;
  color: #fff !important;
}

/* ── Hero ── */
.hero-section {
  background: linear-gradient(135deg, var(--jf-primary) 0%, #1e40af 60%, #1d4ed8 100%);
  color: #fff;
  padding: 80px 0 70px;
  position: relative;
  overflow: hidden;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--jf-secondary), var(--jf-accent));
}

.hero-section h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.hero-section .lead {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 520px;
}

/* ── Hero fade-in animations ── */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-animate-title {
  animation: fadeInDown 0.7s ease both;
}

.hero-animate-lead {
  animation: fadeInUp 0.7s ease 0.2s both;
}

.hero-animate-btns {
  animation: fadeInUp 0.7s ease 0.4s both;
}

.hero-animate-icon {
  animation: fadeIn 1s ease 0.5s both;
}

/* ── Multi-step form ── */
.msf-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.msf-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.5rem;
  gap: 0;
}

.msf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
}

.msf-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--jf-border);
  z-index: 0;
  transition: background 0.4s;
}

.msf-step.completed:not(:last-child)::after {
  background: var(--jf-secondary);
}

.msf-step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--jf-border);
  background: #fff;
  color: var(--jf-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.msf-step.active .msf-step-circle {
  border-color: var(--jf-primary);
  background: var(--jf-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(30,58,138,0.15);
}

.msf-step.completed .msf-step-circle {
  border-color: var(--jf-secondary);
  background: var(--jf-secondary);
  color: #fff;
}

.msf-step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--jf-muted);
  margin-top: 0.4rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.msf-step.active .msf-step-label  { color: var(--jf-primary); }
.msf-step.completed .msf-step-label { color: var(--jf-secondary); }

/* Panels */
.msf-panel {
  display: none;
  animation: fadeInUp 0.35s ease both;
}

.msf-panel.active {
  display: block;
}

/* Nav buttons */
.msf-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--jf-border);
}

.btn-hero-primary {
  background-color: var(--jf-secondary);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  transition: background 0.2s, transform 0.15s;
}

.btn-hero-primary:hover {
  background-color: #0ea271;
  color: #fff;
  transform: translateY(-1px);
}

.btn-hero-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-hero-outline:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ── How it works ── */
.how-it-works {
  background: #fff;
  padding: 70px 0;
}

.step-card {
  background: var(--jf-bg);
  border: 1px solid var(--jf-border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
  height: 100%;
}

.step-card:hover {
  box-shadow: 0 8px 24px rgba(30,58,138,0.1);
  transform: translateY(-3px);
}

.step-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.6rem;
}

.step-icon.blue   { background: rgba(30,58,138,0.1);  color: var(--jf-primary); }
.step-icon.green  { background: rgba(16,185,129,0.1); color: var(--jf-secondary); }
.step-icon.amber  { background: rgba(245,158,11,0.1); color: var(--jf-accent); }
.step-icon.indigo { background: rgba(99,102,241,0.1); color: #6366f1; }

/* ── Features ── */
.features-section {
  background: var(--jf-bg);
  padding: 70px 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-radius: 10px;
  transition: background 0.15s;
}

.feature-item:hover {
  background: #fff;
}

.feature-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(16,185,129,0.12);
  color: var(--jf-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ── Packages ── */
.packages-section {
  background: #fff;
  padding: 70px 0;
}

.package-card {
  border: 1px solid var(--jf-border);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  height: 100%;
}

.package-card:hover {
  box-shadow: 0 12px 32px rgba(30,58,138,0.12);
  transform: translateY(-4px);
}

.package-card .card-header {
  background: var(--jf-primary);
  color: #fff;
  padding: 1.25rem;
  text-align: center;
  border: none;
}

.package-card.featured .card-header {
  background: linear-gradient(135deg, var(--jf-secondary), #059669);
}

.package-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--jf-primary);
}

.package-card .btn-get-started {
  background: var(--jf-primary);
  color: #fff;
  border: none;
  width: 100%;
  padding: 0.65rem;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}

.package-card .btn-get-started:hover {
  background: #1e40af;
}

/* ── CTA Banner ── */
.cta-section {
  background: linear-gradient(135deg, var(--jf-secondary) 0%, #059669 100%);
  color: #fff;
  padding: 70px 0;
  text-align: center;
}

.cta-section h2 {
  font-size: 2rem;
  font-weight: 800;
}

.btn-cta {
  background: #fff;
  color: var(--jf-secondary);
  font-weight: 700;
  padding: 0.8rem 2.5rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  color: var(--jf-secondary);
}

/* ── Footer ── */
.footer-jf {
  background: var(--jf-dark);
  color: rgba(255,255,255,0.7);
  padding: 2.5rem 0;
}

.footer-jf a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-jf a:hover {
  color: var(--jf-secondary);
}

/* ── Section headings ── */
.section-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--jf-primary);
  letter-spacing: -0.3px;
}

.section-subtitle {
  color: var(--jf-muted);
  font-size: 1.05rem;
}

/* ── Accent bar ── */
.accent-bar {
  width: 48px;
  height: 4px;
  background: var(--jf-secondary);
  border-radius: 2px;
  margin: 0.75rem auto 1.5rem;
}

/* ── Cards general ── */
.card {
  border: 1px solid var(--jf-border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(30,58,138,0.08);
}

/* ── Tables ── */
.table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--jf-muted);
}

/* ── Sidebar nav ── */
.sidebar-nav .nav-link:hover {
  background-color: rgba(255,255,255,0.15);
  border-radius: 6px;
}

/* ── Badges ── */
.badge-pending  { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-suspended{ background: #FEE2E2; color: #991B1B; }

/* ── Flash / Toast Messages ── */
.flash-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 380px;
  width: calc(100vw - 2.5rem);
}

.flash-msg {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 0.9rem;
  font-weight: 500;
  animation: flashSlideIn 0.35s ease both;
  border-left: 4px solid transparent;
}

@keyframes flashSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.flash-icon { font-size: 1.1rem; flex-shrink: 0; }
.flash-text { flex: 1; line-height: 1.4; }

.flash-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.flash-close:hover { opacity: 1; }

/* Variants */
.flash-success {
  background: #f0fdf4;
  border-left-color: #22c55e;
  color: #15803d;
}
.flash-success .flash-icon { color: #22c55e; }

.flash-error,
.flash-danger {
  background: #fef2f2;
  border-left-color: #ef4444;
  color: #b91c1c;
}
.flash-error .flash-icon,
.flash-danger .flash-icon { color: #ef4444; }

.flash-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
}
.flash-warning .flash-icon { color: #f59e0b; }

.flash-info {
  background: #eff6ff;
  border-left-color: #3b82f6;
  color: #1d4ed8;
}
.flash-info .flash-icon { color: #3b82f6; }

/* ── Mobile Responsiveness ── */

/* Hero section */
@media (max-width: 768px) {
  .hero-section {
    padding: 52px 0 48px;
  }
  .hero-section h1 {
    font-size: 1.9rem;
  }
  .hero-section .lead {
    font-size: 1rem;
  }
}

/* Group homepage hero */
@media (max-width: 768px) {
  .group-hero {
    padding: 52px 0 64px !important;
  }
  .group-hero h1 {
    font-size: 1.7rem !important;
  }
  .group-hero .tagline {
    font-size: 0.92rem !important;
  }
  .group-hero-logo,
  .group-hero-avatar {
    width: 72px !important;
    height: 72px !important;
  }
  .stats-bar .stat-number {
    font-size: 1.35rem;
  }
  .stat-item {
    padding: 0.4rem 0.75rem;
  }
}

/* Group nav — collapse nicely on mobile */
@media (max-width: 991px) {
  .group-nav .navbar-collapse {
    background: rgba(0,0,0,0.18);
    border-radius: 10px;
    padding: 0.75rem;
    margin-top: 0.5rem;
  }
  .group-nav .navbar-nav.mx-auto {
    flex-direction: column;
    gap: 2px;
  }
  .group-nav .navbar-nav.ms-auto {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
  .group-nav .btn-join {
    flex: 1;
    text-align: center;
  }
}

/* Action cards grid on mobile */
@media (max-width: 576px) {
  .action-card {
    padding: 1rem 0.75rem;
  }
  .action-icon {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
}

/* About section */
@media (max-width: 768px) {
  .group-about {
    padding: 40px 0 !important;
  }
  .about-card {
    padding: 1.25rem !important;
  }
  .group-cta {
    padding: 40px 0 !important;
  }
  .group-cta h2 {
    font-size: 1.45rem !important;
  }
}

/* Tables — horizontal scroll on mobile */
@media (max-width: 768px) {
  .table-responsive-stack thead {
    display: none;
  }
  .table-responsive-stack tr {
    display: block;
    border: 1px solid var(--jf-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #fff;
  }
  .table-responsive-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border: none;
    font-size: 0.88rem;
  }
  .table-responsive-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--jf-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }
}

/* Flash messages on mobile */
@media (max-width: 576px) {
  .flash-container {
    top: auto;
    bottom: 1rem;
    right: 0.75rem;
    left: 0.75rem;
    max-width: 100%;
    width: auto;
  }
}

/* Packages page */
@media (max-width: 768px) {
  .package-card {
    margin-bottom: 1rem;
  }
  .package-price {
    font-size: 1.75rem;
  }
}

/* Section titles */
@media (max-width: 768px) {
  .section-title {
    font-size: 1.5rem;
  }
}

/* Group footer — always at bottom, good spacing on mobile */
.group-footer {
  margin-top: auto;
}

@media (max-width: 576px) {
  .group-footer .d-flex {
    gap: 0.75rem !important;
  }
}

/* Public base.html main — flex grow so footer sticks to bottom */
body > main {
  flex: 1 0 auto;
}

/* ── Mobile UX improvements ── */
/* Larger tap targets on mobile */
@media (max-width: 768px) {
  .btn, .nav-link, .dropdown-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .navbar-toggler {
    min-height: 44px;
    min-width: 44px;
  }
  /* Prevent text overflow on small screens */
  .sa-card, .about-card {
    word-break: break-word;
  }
  /* Better form inputs on mobile */
  input[type="text"], input[type="email"], input[type="tel"],
  input[type="number"], input[type="password"], select, textarea {
    font-size: 16px !important; /* prevents iOS zoom on focus */
  }
}

/* PDF embed responsive */
.pdf-preview-embed {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 8px;
}
@media (max-width: 768px) {
  .pdf-preview-embed {
    height: 320px;
  }
}

/* ── Main site professional mobile enhancements ── */

/* Navbar: sticky with backdrop blur on scroll */
.navbar-jf {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Hero trust badges — wrap cleanly on mobile */
@media (max-width: 576px) {
  .hero-section .d-flex.flex-wrap.gap-3.mt-4 {
    gap: 0.5rem !important;
    justify-content: center;
  }
  .hero-section .d-flex.flex-wrap.gap-3.mt-4 span {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.75rem;
  }
}

/* How it works — 2-col grid on small mobile */
@media (max-width: 576px) {
  .how-it-works .row.g-4 > .col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .step-card {
    padding: 1rem 0.75rem !important;
  }
  .step-icon {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
  }
}

/* Features — single column on mobile, better spacing */
@media (max-width: 576px) {
  .feature-item {
    padding: 0.85rem 0.75rem !important;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--jf-border);
    margin-bottom: 0.5rem;
  }
  .feature-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    flex-shrink: 0;
  }
  .feature-item h6 { font-size: 0.88rem; }
  .feature-item p  { font-size: 0.8rem; }
}

/* Insurance section — stack on mobile */
@media (max-width: 768px) {
  .insurance-grid .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .insurance-grid [style*="font-size:1.6rem"] {
    font-size: 1.2rem !important;
  }
}

/* Packages — full width on small mobile */
@media (max-width: 576px) {
  .packages-section .col-md-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .package-price { font-size: 1.6rem; }
}

/* CTA section — tighter on mobile */
@media (max-width: 576px) {
  .cta-section h2 { font-size: 1.5rem; }
  .cta-section .lead { font-size: 0.9rem; }
  .btn-cta {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
  }
}

/* Footer — better mobile layout */
@media (max-width: 576px) {
  .footer-jf .container { padding: 1.5rem 1rem; }
  .footer-jf small { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
  .footer-jf small a { margin: 0 !important; }
}

/* Insurer partner cards — 2-col on mobile */
@media (max-width: 576px) {
  .insurer-grid .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* Smooth scroll */
html { scroll-behavior: smooth; }
