/* ============================================================
   CarePlus Design System
   Shared foundation — tokens, components, animations
   ============================================================ */

/* 1. Reset
   ------------------------------------------------------------ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* 2. Custom Properties
   ------------------------------------------------------------ */
:root {
  /* Primary Teal */
  --pine: #0D9488;
  --pine2: #0F766E;
  --pine-light: #CCFBF1;
  --pine-dark: #115E59;

  /* Backgrounds */
  --paper: #F8FAFB;
  --paper2: #F1F5F9;
  --card: #FFFFFF;

  /* Text */
  --ink: #0F172A;
  --muted: #64748B;
  --muted2: #94A3B8;

  /* Accents */
  --marigold: #F5A623;
  --marigold2: #D97706;
  --sage: #10B981;
  --done: #10B981;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --amber: #F59E0B;
  --amber-light: #FEF3C7;

  /* Borders */
  --line: #E2E8F0;
  --line2: #CBD5E1;

  /* Shadows (softer, premium) */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  --shadow-md: 0 4px 16px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.03);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.1);

  /* Border Radius (larger, more rounded) */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Spacing Scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Transition */
  --transition: all .25s cubic-bezier(.4,0,.2,1);

  /* Category Colors */
  --cat-med: #3B82F6;
  --cat-med-bg: #EFF6FF;
  --cat-physio: #10B981;
  --cat-physio-bg: #ECFDF5;
  --cat-diet: #F59E0B;
  --cat-diet-bg: #FFFBEB;
  --cat-general: #8B5CF6;
  --cat-general-bg: #F5F3FF;
}

/* 3. Typography Base
   ------------------------------------------------------------ */
body {
  font-family: 'Mukta', sans-serif;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

/* 4. Reusable Component Classes
   ============================================================ */

/* Cards
   ------------------------------------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  padding: var(--sp-5);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-flat {
  background: var(--paper2);
  border-radius: var(--radius-md);
  border: none;
  padding: var(--sp-4);
}

.card-elevated {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: none;
  padding: var(--sp-5);
}

/* Buttons
   ------------------------------------------------------------ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: var(--pine);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-family: 'Mukta', sans-serif;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--pine2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: transparent;
  color: var(--pine);
  border: 1.5px solid var(--pine);
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-family: 'Mukta', sans-serif;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-ghost:hover {
  background: var(--pine-light);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-family: 'Mukta', sans-serif;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  opacity: .9;
}

/* Badges & Chips
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-pine  { background: var(--pine-light);  color: var(--pine-dark);  }
.badge-sage  { background: #ECFDF5;            color: #065F46;           }
.badge-red   { background: var(--red-light);   color: var(--red);        }
.badge-amber { background: var(--amber-light); color: #92400E;           }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
}

.chip.active, .chip.on {
  background: var(--pine);
  color: #fff;
  border-color: var(--pine);
}

.chip-med    { border-color: var(--cat-med);    color: var(--cat-med);    }
.chip-med.active    { background: var(--cat-med);    color: #fff; }
.chip-physio { border-color: var(--cat-physio); color: var(--cat-physio); }
.chip-physio.active { background: var(--cat-physio); color: #fff; }
.chip-diet   { border-color: var(--cat-diet);   color: var(--cat-diet);   }
.chip-diet.active   { background: var(--cat-diet);   color: #fff; }
.chip-general { border-color: var(--cat-general); color: var(--cat-general); }
.chip-general.active { background: var(--cat-general); color: #fff; }

/* Progress Ring (SVG circular progress)
   ------------------------------------------------------------ */
.progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring .track {
  fill: none;
  stroke: var(--line);
  stroke-width: 6;
}

.progress-ring .fill {
  fill: none;
  stroke: var(--pine);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1);
}

.progress-ring .label {
  position: absolute;
  text-align: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  color: var(--ink);
}

/* Empty State
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: var(--sp-4);
  opacity: .5;
}

.empty-state h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-2);
  color: var(--ink);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 280px;
}

/* Skeleton Loading
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--paper2) 25%, var(--line) 50%, var(--paper2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text   { height: 14px; margin-bottom: 8px;  border-radius: 4px; }
.skeleton-title  { height: 20px; width: 60%;  margin-bottom: 12px; }
.skeleton-card   { height: 120px; border-radius: var(--radius-md); }
.skeleton-avatar { width: 40px;  height: 40px; border-radius: 50%; }

/* Toast
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  z-index: 9999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast.err {
  background: var(--red);
}

/* Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--sp-6);
  transform: translateY(20px) scale(.97);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.modal-overlay.show .modal-box {
  transform: translateY(0) scale(1);
}

/* Form Inputs
   ------------------------------------------------------------ */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-family: 'Mukta', sans-serif;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--card);
  transition: var(--transition);
  outline: none;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px var(--pine-light);
}

.input::placeholder {
  color: var(--muted2);
}

/* Utility Classes
   ------------------------------------------------------------ */
.hidden          { display: none !important; }
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: var(--sp-2); }
.gap-3           { gap: var(--sp-3); }
.gap-4           { gap: var(--sp-4); }
.text-center     { text-align: center; }
.text-muted      { color: var(--muted); }
.text-sm         { font-size: var(--text-sm); }
.text-xs         { font-size: var(--text-xs); }
.text-lg         { font-size: var(--text-lg); }
.text-xl         { font-size: var(--text-xl); }
.font-bold       { font-weight: 700; }
.w-full          { width: 100%; }

/* 5. Animations
   ============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes breathe {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50%      { box-shadow: var(--shadow-md); }
}

@keyframes pop {
  0%   { opacity: 0; transform: scale(.9); }
  100% { opacity: 1; transform: scale(1);  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-rise    { animation: rise    .4s cubic-bezier(.4,0,.2,1) both;      }
.animate-breathe { animation: breathe 2s  ease-in-out infinite;              }
.animate-pop     { animation: pop     .3s cubic-bezier(.4,0,.2,1) both;      }
.animate-spin    { animation: spin    1s  linear infinite;                    }
