/* File: frontend/assets/styles.css */
/* External stylesheet only — no inline/internal CSS in index.html */

:root {
  --medical-primary: #1e40af;
  /* professional medical blue */
  --medical-secondary: #0f766e;
  /* teal for accents */
  --medical-success: #059669;
  /* success green */
  --medical-warning: #d97706;
  /* warning orange */
  --medical-danger: #dc2626;
  /* error red */
  --medical-light: #f8fafc;
  /* light background */
  --medical-dark: #1e293b;
  /* dark text */
  --medical-muted: #64748b;
  /* muted text */

  /* Legacy variables for backward compatibility */
  --root-deep: var(--medical-primary);
  --root-soft: var(--medical-light);
  --accent-blue: var(--medical-secondary);
  --accent-lilac: #6366f1;
  /* modern purple */

  --surface: var(--medical-light);
  --brand: var(--medical-primary);
  --cta: var(--medical-secondary);
  --cta-2: var(--accent-lilac);

  /* Enhanced layout tokens */
  --header-height: 70px;
  /* unified default navbar height */
  --footer-height: 80px;
  --border-radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinners {
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Enhanced page background with medical theme */
.bg-page {
  background: radial-gradient(circle at 25% 20%, rgba(30, 64, 175, 0.03), transparent 60%),
    radial-gradient(circle at 75% 80%, rgba(15, 118, 110, 0.03), transparent 60%),
    linear-gradient(135deg, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.95));
  min-height: 100vh;
  opacity: 0;
  animation: pageFade 0.8s ease forwards;
}

/* Medical Dashboard Styles */
.medical-dashboard {
  padding: 1rem 0;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  box-sizing: border-box;
}

.dashboard-header {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.05), rgba(15, 118, 110, 0.03));
  border-radius: var(--border-radius);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(30, 64, 175, 0.08);
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--medical-primary);
  margin-bottom: 0.5rem;
}

.dashboard-subtitle {
  color: var(--medical-muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.stats-summary {
  display: flex;
  justify-content: center;
}

.stat-card {
  background: #fff;
  padding: 1.25rem 1rem;
  border-radius: .75rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, .05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--medical-primary);
  line-height: 1;
}

.stat-label {
  color: var(--medical-muted);
  font-weight: 600;
  margin-top: 0.5rem;
}

/* Container/card entrance */
.login-card {
  animation: cardIn .55s ease .1s both;
}

@keyframes pageFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes cardIn {
  from {
    transform: translateY(18px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Card */
.login-card {
  border: none;
  border-radius: 12px;
  overflow: hidden;
}

/* Brand / heading refinement */
.brand-title,
.login-card h1.h4,
.login-card h1.h5,
.login-card h1,
.login-card h2,
.login-card .form-title {
  color: var(--brand);
  font-weight: 700;
  letter-spacing: .5px;
  position: relative;
  line-height: 1.2;
}

/* Subtle accent underline */
.brand-title:after,
.login-card h1.h4:after,
.login-card h1.h5:after,
.login-card h1:after,
.login-card h2:after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 46px;
  height: 3px;
}

@media (max-width: 575.98px) {

  .brand-title,
  .login-card h1.h4,
  .login-card h1.h5,
  .login-card h1,
  .login-card h2 {
    font-size: 1.15rem;
  }
}

/* Primary button using brand accent */
.btn-login {
  background: linear-gradient(90deg, var(--cta), var(--cta-2));
  border: none;
  padding: .75rem 1.05rem;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(60, 42, 153, 0.12);
  transition: box-shadow .25s ease, transform .25s ease;
}

.btn-login:hover {
  box-shadow: 0 6px 18px rgba(60, 42, 153, 0.18);
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:focus {
  box-shadow: 0 0 0 3px rgba(60, 42, 153, 0.25);
  outline: none;
}

/* Links */
.link-forgot,
.link-register {
  color: var(--brand);
  text-decoration: none;
}

.link-forgot,
.link-register {
  position: relative;
}

.link-forgot:after,
.link-register:after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cta), var(--cta-2));
  transition: width .35s ease;
  border-radius: 2px;
}

.link-forgot:hover:after,
.link-register:hover:after {
  width: 100%;
}

.link-forgot:hover,
.link-register:hover {
  text-decoration: none;
}

/* Form controls gentle focus */
input.form-control,
.form-check-input {
  transition: border-color .25s ease, box-shadow .25s ease, background-color .3s ease;
}

input.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .15rem rgba(60, 42, 153, .25);
}

.form-check-input:focus {
  box-shadow: 0 0 0 .15rem rgba(60, 42, 153, .25);
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

  .bg-page,
  .login-card,
  .btn-login,
  .link-forgot:after,
  .link-register:after {
    animation: none !important;
    transition: none !important;
  }

  .bg-page {
    opacity: 1;
  }
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: .9rem;
  /* align with doctor-friendly, compact sizing */
  color: #dc3545;
  font-weight: 500;
}

/* Footer brand strip (kept for compatibility) */
.footer-brand {
  background: linear-gradient(90deg, rgba(60, 42, 153, 0.04), rgba(105, 79, 235, 0.03));
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

/* Small responsive adjustments */
@media (max-width: 575.98px) {
  .card-body {
    padding: 1.25rem;
  }
}


/* ---------------- App layout additions (improved) ---------------- */

/* Medical Header Styles */
.site-header {
  height: var(--header-height);
  background: linear-gradient(135deg, var(--medical-primary) 0%, var(--medical-secondary) 100%);
  border-bottom: 3px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  z-index: 1030;
}

.medical-logo-container {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.brand-info .brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  margin: 0;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.doctor-profile {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  transition: all var(--transition-fast);
  text-decoration: none !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.doctor-profile:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.doctor-name {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.doctor-role {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

.medical-dropdown {
  border-radius: var(--border-radius);
  border: 1px solid rgba(30, 64, 175, 0.1);
  min-width: 280px;
}

.medical-dropdown .dropdown-header {
  background: rgba(30, 64, 175, 0.05);
  border-bottom: 1px solid rgba(30, 64, 175, 0.1);
  padding: 1rem;
}

.medical-dropdown .dropdown-item {
  padding: 0.75rem 1rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.medical-dropdown .dropdown-item:hover {
  background: linear-gradient(90deg, rgba(30, 64, 175, 0.08), rgba(15, 118, 110, 0.05));
}

/* reduce navbar padding so the container controls spacing */
.site-header .navbar {
  width: 100%;
}

/* bigger logo */
.logo-lg {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
}

/* brand title tweaks */
.brand-title {
  font-size: 1.175rem;
  font-weight: 800;
  color: var(--brand);
}

/* user toggle — pill style for nicer touch targets */
.user-toggle {
  cursor: pointer;
  padding: .28rem .6rem;
  border-radius: 999px;
  background: rgba(105, 79, 235, 0.02);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.user-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(60, 42, 153, 0.06);
}

.avatar-sm {
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
}

/* dropdown menu refined */
.dropdown-menu {
  min-width: 220px;
  border-radius: 12px;
  padding: .25rem 0;
}

.dropdown-item {
  font-weight: 600;
  padding: .6rem 1rem;
}

.dropdown-item:hover {
  background: linear-gradient(90deg, rgba(0, 140, 186, 0.06), rgba(105, 79, 235, 0.04));
}

.dropdown-item .bi {
  font-size: 1.05rem;
  vertical-align: -0.08em;
  margin-right: 8px;
  color: rgba(0, 0, 0, 0.55);
}

/* ensure header and page content align (no inline styles) */


/* footer */
.site-footer {
  background: linear-gradient(90deg, rgba(60, 42, 153, 0.02), rgba(105, 79, 235, 0.02));
}

/* make sure the central container prevents content from touching sides */
.container {
  max-width: 1140px;
}

/* touch / accessibility improvements */
.navbar .nav-link,
.navbar-brand {
  padding: .45rem .6rem;
}

/* subtle hover elevation on brand */
.navbar-brand:hover {
  transform: translateY(-1px);
  transition: transform .18s ease;
}

/* responsive tweaks */
@media (max-width: 767.98px) {
  :root {
    --header-height: 78px;
  }

  .brand-title {
    display: none;
  }

  .site-header {
    padding-left: 6px;
    padding-right: 6px;
  }

  .main-content {
    padding-top: calc(var(--header-height) + 10px);
  }
}

@media (max-width: 575.98px) {
  .avatar-sm {
    display: none;
  }

  .dropdown-menu {
    right: 8px;
    left: auto;
  }
}

/* Utility: if you still want a fixed footer, add .fixed-footer on <footer> and it will pin without overlapping content */
.fixed-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1020;
}

/* When footer is fixed, ensure main content leaves space so buttons/CTAs aren't hidden */
body:has(footer.position-fixed) .main-content {
  padding-bottom: calc(var(--footer-height, 80px) + 1.5rem);
  /* fallback + extra breathing space */
}

/* Broad fallback for browsers without :has support */
@supports not(selector(:has(*))) {
  .main-content {
    padding-bottom: calc(var(--footer-height, 80px) + 1.5rem);
  }
}

/* Offset for fixed header */
body .main-content {
  padding-top: calc(var(--header-height) + 1rem);
}

@media (max-width: 767.98px) {
  :root {
    --header-height: 78px;
  }

  body .main-content {
    padding-top: calc(var(--header-height) + .75rem);
  }
}

/* OTP Inputs (moved from inline login blade) */
.otp-inputs {
  display: flex;
  gap: .5rem;
  justify-content: center;
}

.otp-inputs .otp-digit {
  text-align: center;
  width: 46px;
  height: 46px;
  font-size: 1.125rem;
  font-weight: 600;
  border: 2px solid #dbe4f1;
  border-radius: 10px;
  transition: border-color .25s ease, box-shadow .25s ease, background-color .3s ease;
}

@media (max-width:480px) {
  .otp-inputs .otp-digit {
    width: 40px;
    height: 46px;
    font-size: 1rem;
  }
}

.otp-inputs .otp-digit:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .15rem rgba(60, 42, 153, .25);
  outline: none;
}

/* Unified gradient navbar */
.app-navbar-gradient {
  background: linear-gradient(90deg, #0d6efd 0%, #00d4ff 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Footer fixed helper (replace inline style attr) */
.footer-fixed-elevated {
  z-index: 1020;
}


/* Medical Card Enhancement for Bootstrap Cards */
.medical-card {
  transition: all 0.25s ease;
  border: 1px solid rgba(30, 64, 175, 0.12) !important;
  min-height: 260px;
  /* allow growth for longer titles */
  display: flex;
  flex-direction: column;
}

.medical-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(30, 64, 175, 0.12) !important;
  border-color: var(--medical-primary) !important;
}

/* Visual accent & accessibility improvements */
.medical-card {
  position: relative;
  border-radius: .85rem;
  background: #fff;
  overflow: hidden;
}

.medical-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--medical-primary), var(--medical-secondary));
  opacity: .85;
  transition: height .25s ease, opacity .25s ease;
}

.medical-card:hover::before {
  height: 6px;
  opacity: 1;
}

.medical-card:focus-within {
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .25), 0 4px 18px rgba(30, 64, 175, .18);
}

.medical-card .card-header {
  padding-top: .85rem;
  padding-bottom: .35rem;
}

.medical-card .badge {
  font-weight: 600;
  letter-spacing: .5px;
}

.medical-card .card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* standard */
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  min-height: calc(1.25em * 2);
}

.medical-card .card-text {
  font-size: .8rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Progress bar (optional future dynamic width) */
.progress.progress-thin {
  height: 4px;
  border-radius: 2px;
  background: #edf2f7;
}

.progress.progress-thin .progress-bar {
  border-radius: 2px;
}

/* Stretched link support tweak */
.medical-card .stretched-link::after {
  border-radius: inherit;
}

@media (max-width: 575.98px) {
  .row.g-4 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
  }

  .medical-card {
    min-height: 240px;
  }
}

/* Remove old card styles */
.crf-grid,
.medical-crf-card-mini,
.crf-content-mini,
.crf-title-mini,
.crf-status-mini,
.status-badge-mini,
.crf-actions-mini,
.btn-start-crf-mini {
  display: none !important;
}

/* Empty State */
.empty-state {
  padding: 0rem 0 3rem;
}

.empty-state-card {
  max-width: 640px;
  border-radius: 1rem;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.empty-state-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 30% 20%, rgba(30, 64, 175, 0.06), transparent 60%);
}

.empty-state-icon-wrapper {
  position: relative;
}

.icon-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--medical-primary), var(--medical-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  box-shadow: 0 6px 18px rgba(30, 64, 175, .25);
  position: relative;
}

.icon-ring::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(255, 255, 255, .5);
  border-radius: inherit;
}

.empty-state-card .badge {
  background: #eef2ff !important;
}

.empty-state-card .badge.text-secondary {
  color: #475569 !important;
}

.empty-state-card .btn-outline-secondary {
  background: #fff;
}

.empty-state-card .btn-outline-secondary:hover {
  background: #f1f5f9;
}

.empty-state-card .btn-primary {
  box-shadow: 0 4px 12px rgba(30, 64, 175, .3);
}

.empty-state-card .btn-primary:hover {
  box-shadow: 0 6px 16px rgba(30, 64, 175, .4);
}

.empty-state-card .small.opacity-75 {
  font-size: .7rem;
  letter-spacing: .5px;
}

@media (prefers-reduced-motion: no-preference) {
  .icon-ring {
    animation: floatPulse 5s ease-in-out infinite;
  }
}

@keyframes floatPulse {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* Medical Modal */
.medical-modal .modal-header {
  background: linear-gradient(135deg, var(--medical-primary), var(--medical-secondary));
  color: white;
  border-bottom: none;
}

.medical-modal .modal-title {
  color: white;
}

.modal-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.crf-modal-content {
  padding: 1rem 0;
}

.crf-metadata {
  background: rgba(30, 64, 175, 0.03);
  border-radius: 8px;
  padding: 1rem;
  height: fit-content;
}

.metadata-item {
  margin-bottom: 1rem;
}

.metadata-item:last-child {
  margin-bottom: 0;
}

/* Medical Alert */
.medical-alert {
  border-radius: var(--border-radius);
  border-left: 4px solid var(--medical-danger);
  background: rgba(220, 38, 38, 0.05);
}

.medical-alert-success {
  border-radius: var(--border-radius);
  border-left: 4px solid var(--medical-success);
  background: rgba(10, 247, 2, 0.05);
}

/* Responsive Design */
@media (max-width: 768px) {
  .crf-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .dashboard-header {
    padding: 1.5rem;
    text-align: center;
  }

  .dashboard-title {
    font-size: 1.5rem;
  }

  .stats-summary {
    margin-top: 1rem;
  }

  .medical-crf-card:hover {
    transform: none;
  }
}

@media (max-width: 576px) {
  .crf-actions {
    flex-direction: column;
  }

  .brand-info {
    display: none !important;
  }

  .dashboard-header {
    padding: 1rem;
  }
}

/* Medical Footer */
.medical-footer {
  background: linear-gradient(135deg, var(--medical-dark) 0%, #334155 100%);
  border-top: 3px solid var(--medical-primary);
  color: white;
  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  gap: 2rem;
}

.footer-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.25rem;
}

.footer-description {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 400px;
}

.footer-meta {
  text-align: right;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: #60a5fa;
}

.footer-copyright {
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 0;
  }

  .footer-meta {
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* End of Medical Theme Styles */

/* -------------------------------------------------------------- */
/* Letter / Greeting Page Enhancements (Bootstrap-first approach) */
/* -------------------------------------------------------------- */
.letter-content {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--medical-dark, #1e293b);
}

.letter-content h1,
.letter-content h2,
.letter-content h3,
.letter-content h4 {
  color: var(--medical-primary, #1e40af);
  font-weight: 600;
  margin-top: 1.5rem;
}

.letter-content h1:first-child,
.letter-content h2:first-child,
.letter-content h3:first-child,
.letter-content h4:first-child {
  margin-top: 0.25rem;
}

.letter-content p {
  margin-bottom: 1rem;
}

.letter-content ul,
.letter-content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.letter-content blockquote {
  border-left: 4px solid var(--medical-primary, #1e40af);
  padding-left: 1rem;
  background: rgba(30, 64, 175, 0.04);
  border-radius: 4px;
  font-style: italic;
}

@media (max-width: 575.98px) {
  .letter-content {
    font-size: .95rem;
  }
}

/* Contract / Signature Enhancements */
.contract-scroll {
  position: relative;
}

.contract-scroll:before,
.contract-scroll:after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 16px;
  pointer-events: none;
  z-index: 2;
}

.contract-scroll:before {
  top: 0;
  background: linear-gradient(#fff, rgba(255, 255, 255, 0));
}

.contract-scroll:after {
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
}

.signature-pad-wrapper {
  min-height: 200px;
}

.signature-pad-wrapper canvas {
  cursor: crosshair;
}

.signature-pad-wrapper:focus-within {
  outline: 3px solid rgba(30, 64, 175, .25);
  outline-offset: 2px;
}

.signature-hint {
  font-size: .65rem;
  opacity: .7;
}

@media (max-width: 767.98px) {
  .signature-pad-wrapper {
    min-height: 180px;
  }

  .contract-scroll {
    max-height: 55vh !important;
  }
}

/* Formal Contract Styling */
.contract-document {
  position: relative;
  background: #fff;
}

.contract-document:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(30, 64, 175, 0.03), transparent 120px);
}

.contract-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* signature guide line (single definition; duplicate removed below) */
.signature-guideline {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 42px;
  height: 1px;
  background: repeating-linear-gradient(90deg, #bbb, #bbb 6px, transparent 6px, transparent 12px);
  opacity: .6;
  pointer-events: none;
}

/* CRF Form Enhancements */
.crf-form-wrapper {
  --crf-gap: 1.25rem;
}

.section-card {
  transition: box-shadow .25s ease, transform .25s ease;
  border: 1px solid rgba(0, 0, 0, .05);
}

.section-card:hover {
  box-shadow: 0 4px 18px -4px rgba(0, 0, 0, .08), 0 2px 6px -1px rgba(0, 0, 0, .05);
}

.section-card:focus-within {
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .15), 0 4px 18px -4px rgba(0, 0, 0, .08);
}

.section-card .card-header h2 {
  letter-spacing: .25px;
}

/* Custom checkbox / radio tile variations */
.custom-check-tile,
.custom-check-outline {
  position: relative;
  padding: .55rem .75rem .55rem 2.25rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .5rem;
  font-size: .85rem;
  line-height: 1.2;
  background: #fff;
  cursor: pointer;
  min-height: 100%;
  display: flex;
  align-items: center;
}

.custom-check-tile input.form-check-input,
.custom-check-outline input.form-check-input {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  cursor: pointer;
}

.custom-check-tile:hover,
.custom-check-outline:hover {
  background: #f8f9fa;
}

.custom-check-tile input:focus-visible+label,
.custom-check-outline input:focus-visible+label {
  outline: 2px solid rgba(13, 110, 253, .5);
  outline-offset: 2px;
}

.custom-check-outline {
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, var(--bs-primary), var(--bs-info)) border-box;
  border: 1px solid transparent;
}

.custom-check-outline input.form-check-input {
  background-color: #fff;
}

.custom-check-outline input.form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.custom-check-outline label {
  cursor: pointer;
}

.custom-check-tile input.form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.custom-check-tile label,
.custom-check-outline label {
  cursor: pointer;
  user-select: none;
}

/* Action bar */
.action-bar {
  border-top: 1px solid rgba(0, 0, 0, .06);
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, .9) !important;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding-left: .5rem;
  padding-right: .5rem;
}

@media (min-width: 768px) {
  .action-bar {
    margin-left: 0;
    margin-right: 0;
    border-radius: .75rem;
  }
}

/* Improve invalid feedback spacing */
.invalid-feedback.d-block {
  font-size: .90rem;
  margin-top: .25rem;
}

/* Compact radios/checkbox alignment when inside tiles */
.custom-check-tile .form-check-input,
.custom-check-outline .form-check-input {
  width: 1.05rem;
  height: 1.05rem;
}

@media (max-width: 575.98px) {
  .section-card .card-body {
    padding: 1rem 1rem 1.25rem;
  }

  .section-card .card-header {
    padding: 1rem 1rem 0;
  }

  .action-bar {
    position: sticky;
  }

  /* Tighten counter spacing on small screens to avoid overlap */
  .char-counter {
    bottom: -1rem;
  }
}

/* CRF meta bar & utilities */
.crf-meta-bar {
  background: #ffffff;
  /* cleaner, neutral surface */
  border: 1px solid #e5e7eb;
  /* subtle slate border */
  box-shadow: none;
  /* remove elevation */
}

.crf-meta-bar .crf-meta-accent {
  display: none;
  /* remove decorative overlay */
}

.crf-meta-bar h1,
.crf-meta-bar h5 {
  letter-spacing: 0;
  /* default tracking for readability */
  line-height: 1.35;
  margin-bottom: .25rem;
}

@media (max-width: 576px) {
  .crf-meta-bar h1.h5 {
    font-size: 1rem;
  }

  .crf-meta-bar .lh-sm {
    line-height: 1.25 !important;
  }
}

.bmi-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  font-weight: 500;
  background: #f1f5f9;
  padding: .4rem .65rem;
  border-radius: 2rem;
  line-height: 1;
  border: 1px solid rgba(0, 0, 0, .06);
}

.bmi-badge.normal {
  background: #e8f7ef;
  color: #0f5132;
}

.bmi-badge.overweight {
  background: #fff4e5;
  color: #804400;
}

.bmi-badge.obese {
  background: #ffe5e5;
  color: #842029;
}

.bmi-badge.under {
  background: #e7f3ff;
  color: #084298;
}

.char-counter {
  position: absolute;
  right: .25rem;
  bottom: -1.2rem;
  font-size: .65rem;
  letter-spacing: .5px;
}

.char-counter.warning {
  color: #d97706;
}

.char-counter.limit {
  color: #b91c1c;
  font-weight: 600;
}

/* Fieldset normalization */
fieldset {
  min-inline-size: unset;
}

fieldset legend {
  float: none;
  width: auto;
  font-size: .85rem;
  font-weight: 600;
  padding: 0;
}

/* Input group subtle refinement */
.input-group>.form-control {
  flex: 1 1 auto;
}

.input-group-text {
  background: #f8fafc;
  font-size: .75rem;
}

/* Improve tile focus */
.custom-check-tile input:focus-visible,
.custom-check-outline input:focus-visible {
  outline: 2px solid rgba(13, 110, 253, .6);
  outline-offset: 2px;
}

/* Action bar spacing on large screens */
@media (min-width: 1200px) {
  [data-action-bar] {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

.contract-meta {
  font-size: .8rem;
  letter-spacing: .5px;
}

.contract-content h2 {
  letter-spacing: .5px;
}

.contract-content ul {
  padding-left: 1.1rem;
}

.contract-content ul li {
  margin-bottom: .35rem;
}

.signature-pad-wrapper {
  position: relative;
}

/* duplicate .signature-guideline removed */
.contract-toolbar .btn {
  font-size: .75rem;
}

@media print {
  body {
    background: #fff !important;
  }

  .site-header,
  .medical-footer,
  .contract-toolbar a.btn,
  .contract-toolbar button.btn,
  #submitContract {
    display: none !important;
  }

  .contract-scroll {
    max-height: none !important;
    overflow: visible !important;
  }

  .contract-document {
    box-shadow: none !important;
  }

  .signature-pad-wrapper {
    border: 1px solid #000 !important;
  }
}


/* Login */
.login-card {
  border-radius: 16px;
  overflow: hidden;
}

@media (max-width: 576px) {
  .login-card .card-body {
    padding: 1.25rem !important;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .btn-login {
    width: 100%;
  }
}

/* OTP Inputs */

.brand-title {
  letter-spacing: .5px;
}

.login-card {
  border-radius: 16px;
  overflow: hidden;
}

.login-card .card-body {
  padding: 2rem;
}

.subtle {
  color: #6c757d;
  font-size: .925rem;
}

.otp-input {
  font-size: 1.25rem;
  letter-spacing: .4em;
  padding-left: .9rem;
}

.btn-login {
  padding: .65rem 1rem;
  font-weight: 600;
}

.footer-brand {
  background: transparent;
}

.badge-soft {
  background: #eef4ff;
  color: #3d64f4;
  border-radius: 50rem;
  padding: .35rem .6rem;
  font-weight: 600;
}

.muted-mask {
  font-variant-numeric: tabular-nums;
}

/* Alpine.js utility: prevent FOUC for cloaked elements */
[x-cloak] {
  display: none !important;
}