:root {
  --bg-gradient-from: #f4fbf7;
  --bg-gradient-to: #e8f6ee;
  --card-bg: #ffffff;
  --card-border: rgba(15, 138, 75, 0.14);
  --text-primary: #0f2a1f;
  --text-muted: #4d6b5b;
  --accent-primary: #0f8a4b;
  --accent-primary-soft: rgba(15, 138, 75, 0.12);
  --accent-success: #1f9d57;
  --accent-success-soft: rgba(31, 157, 87, 0.14);
  --shadow-soft: 0 12px 36px rgba(15, 138, 75, 0.16);
  --radius-xl: 1.25rem;
  --radius-lg: 0.9rem;
  --transition-fast: 180ms ease-out;
  --transition-med: 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --blur-strong: 18px;
}

/* Page background */
.app-body {
  min-height: 100vh;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top left, rgba(15, 138, 75, 0.11), transparent 58%),
    radial-gradient(circle at top right, rgba(31, 157, 87, 0.08), transparent 58%),
    linear-gradient(145deg, var(--bg-gradient-from), var(--bg-gradient-to));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

/* Center container and animate in */
.container {
  max-width: 1120px;
  width: 100%;
  animation: fadeInUp var(--transition-med) 40ms both;
}

.app-topbar .card-body {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.topbar-user {
  padding: 0.2rem 0.75rem;
  border: 1px solid rgba(77, 107, 91, 0.25);
  border-radius: 999px;
  background: rgba(77, 107, 91, 0.08);
}

.topbar-badge {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f8a4b;
  border: 1px solid rgba(15, 138, 75, 0.25);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(15, 138, 75, 0.08);
}

.page-intro {
  padding: 0.25rem 0.1rem 0.35rem;
}

/* Card styling – glassmorphism */
.card {
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  backdrop-filter: blur(var(--blur-strong)) saturate(135%);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(135%);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

/* Subtle glow accent on top edge */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 0% 0%, rgba(15, 138, 75, 0.10), transparent 60%),
    radial-gradient(circle at 100% 0%, rgba(31, 157, 87, 0.08), transparent 65%);
  opacity: 0.6;
  mix-blend-mode: normal;
  pointer-events: none;
  z-index: 0;
}

/* Content sits above the glow layer */
.card-body {
  position: relative;
  z-index: 1;
}

/* Typography */
.card h1,
.card h2,
.card h3,
.card .h1,
.card .h2,
.card .h3,
.card .h4,
.card .h5,
.card .h6 {
  color: #0f2a1f;
  letter-spacing: 0.01em;
}

.text-muted {
  color: var(--text-muted) !important;
}

.flash-alert {
  border: 1px solid rgba(15, 138, 75, 0.2);
  background: rgba(15, 138, 75, 0.08);
  color: #0f2a1f;
  border-radius: 0.9rem;
}

.alert-danger.flash-alert,
.alert-warning.flash-alert {
  border-color: rgba(184, 28, 28, 0.24);
  background: rgba(184, 28, 28, 0.08);
  color: #7f1d1d;
}

.alert-success.flash-alert {
  border-color: rgba(15, 138, 75, 0.24);
  background: rgba(15, 138, 75, 0.1);
  color: #0c6f3c;
}

/* List styling inside profile */
.card ul.list-unstyled li {
  padding: 0.15rem 0;
  font-size: 0.95rem;
  color: #1f3b2f;
}

.card ul.list-unstyled li strong {
  color: #0f2a1f;
  font-weight: 600;
}

/* Primary button – gradient + micro-interactions */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding-inline: 1.25rem;
  border-radius: 999px;
  border: none;
  background-image: linear-gradient(135deg, #0f8a4b, #0c6f3c);
  color: #f9fafb;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(15, 138, 75, 0.38);
  transition:
    transform var(--transition-med),
    box-shadow var(--transition-med),
    filter var(--transition-fast),
    background-position 220ms ease-out;
  background-size: 180% 180%;
  background-position: 0% 50%;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-position: 100% 50%;
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 14px 38px rgba(15, 138, 75, 0.48);
  filter: brightness(1.03);
}

/* Outline variants refined */
.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary,
.btn-outline-danger {
  border-radius: 999px;
  border-width: 1px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-med),
    box-shadow var(--transition-med);
}

/* Call button (outline-primary) */
.btn-outline-primary {
  color: #0f8a4b;
  border-color: rgba(15, 138, 75, 0.55);
  background-color: rgba(15, 138, 75, 0.05);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  color: #0c6f3c;
  border-color: rgba(15, 138, 75, 0.85);
  background-color: rgba(15, 138, 75, 0.14);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(15, 138, 75, 0.24);
}

/* WhatsApp button (outline-success) */
.btn-outline-success {
  color: #1f9d57;
  border-color: rgba(31, 157, 87, 0.55);
  background-color: rgba(31, 157, 87, 0.06);
}

.btn-outline-success:hover,
.btn-outline-success:focus-visible {
  color: #157543;
  border-color: rgba(31, 157, 87, 0.9);
  background-color: rgba(31, 157, 87, 0.14);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(31, 157, 87, 0.24);
}

/* Secondary small buttons */
.btn-outline-secondary {
  color: #355747;
  border-color: rgba(77, 107, 91, 0.35);
  background-color: rgba(77, 107, 91, 0.08);
  font-size: 0.78rem;
  padding-block: 0.4rem;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  border-color: rgba(77, 107, 91, 0.75);
  background-color: rgba(77, 107, 91, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(77, 107, 91, 0.22);
}

.btn-outline-danger {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
  background-color: rgba(180, 35, 24, 0.05);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
  color: #8a1c14;
  border-color: rgba(180, 35, 24, 0.62);
  background-color: rgba(180, 35, 24, 0.12);
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.2);
}

/* Input fields – sleek dark */
.form-control,
textarea.form-control {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(77, 107, 91, 0.28);
  background-color: #ffffff;
  color: #0f2a1f;
  font-size: 0.93rem;
  padding-block: 0.6rem;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.form-control::placeholder {
  color: rgba(77, 107, 91, 0.55);
}

.form-control:focus {
  border-color: rgba(15, 138, 75, 0.82);
  box-shadow: 0 0 0 1px rgba(15, 138, 75, 0.3);
  background-color: #ffffff;
  color: #0f2a1f;
  transform: translateY(-0.5px);
}

/* Labels spacing */
.form-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(77, 107, 91, 0.95);
  margin-bottom: 0.25rem;
}

.empty-state {
  border: 1px dashed rgba(15, 138, 75, 0.35);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  background: rgba(15, 138, 75, 0.04);
}

.empty-state-title {
  font-weight: 700;
  color: #0f2a1f;
  margin-bottom: 0.45rem;
}

.list-group {
  gap: 0.6rem;
}

.list-group-item.contact-list-item {
  border: 1px solid rgba(77, 107, 91, 0.25);
  border-radius: 0.9rem;
  background: #ffffff;
  padding: 0.9rem 1rem;
}

.contact-list-actions form {
  margin: 0;
}

/* QR area */
#qrcode img,
#qrcode canvas {
  border-radius: 1.1rem;
  border: 1px solid rgba(77, 107, 91, 0.25);
  background-color: #ffffff;
  padding: 0.6rem;
  box-shadow: 0 10px 28px rgba(77, 107, 91, 0.18);
}

/* Small title above QR */
.card h2.h6 {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: rgba(77, 107, 91, 0.9);
}

/* QR card hover motion */
.qr-card {
  transform: translateY(0);
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.qr-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(15, 138, 75, 0.2);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Button tap animation for mobile */
.btn:active {
  transform: translateY(0) scale(0.985);
  box-shadow: none !important;
}

/* Brand header */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.brand-logo {
  max-height: 64px;
  width: auto;
  filter: drop-shadow(0 8px 14px rgba(15, 138, 75, 0.22));
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f2a1f;
}

.brand-tagline {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(77, 107, 91, 0.92);
}

/* Brand footer */
.app-footer {
  color: rgba(77, 107, 91, 0.9);
  font-size: 0.8rem;
}

.app-footer .brand-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f2a1f;
}

.app-footer .brand-tagline {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(77, 107, 91, 0.92);
}

/* Utility: subtle padding on larger screens */
@media (min-width: 768px) {
  .card-body.p-4 {
    padding: 2.25rem !important;
  }
}

/* Adjust body behavior on smaller screens so it scrolls naturally */
@media (max-width: 991.98px) {
  .app-body {
    justify-content: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 1.75rem;
  }

  .topbar-actions {
    align-items: center;
    width: 100%;
  }
}

/* Mobile + tablet: keep QR card visible and touch-friendly */
@media (max-width: 991.98px) {
  .qr-card {
    display: block !important;
    margin-top: 1rem;
  }

  .qr-card .card-body {
    padding: 1rem;
  }

  #qrcode canvas,
  #qrcode img {
    width: min(70vw, 220px) !important;
    height: auto !important;
  }
}

/* Desktop layout adjustments for profile cards */
@media (min-width: 992px) {
  .profile-layout .card-body {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .profile-layout .qr-card .card-body {
    align-items: center;
    justify-content: center;
  }
}