/* ---------------------------------------------------------------------------
   Member portal — anne healthcare house-style demo.
   Self-contained stylesheet. Tokens match the dashboard, bloods tool, and hub.
--------------------------------------------------------------------------- */

:root {
  --cta:            #1a67cc;
  --cta-dark:       #14509f;
  --accent:         #18d6c4;
  --accent-dark:    #13a89a;
  --cream:          #f4eed7;
  --cream-border:   #e9ddaf;
  --cool:           #e5eef8;
  --dark:           #333;
  --grey:           #4d4d4d;
  --grey-soft:      #676767;
  --grey-line:      #e0e0e0;
  --light:          #fff;

  --font-heading:   "Inter", system-ui, sans-serif;
  --font-body:      "DM Sans", system-ui, sans-serif;

  --radius-sm:      0.5rem;
  --radius-md:      1.5rem;
  --radius-pill:    100em;
  --shadow-soft:    0 3px 6px 0 rgba(0, 0, 0, 0.06);
  --shadow-lift:    0 12px 32px -16px rgba(20, 80, 159, 0.22),
                    0  3px  6px  0   rgba(0, 0, 0, 0.06);

  --content-max:    112rem;
  --gutter:         clamp(2rem, 5vw, 6rem);

  /* Status colours */
  --verified-bg:    #e8f5e9;
  --verified-fg:    #2e7d32;
  --pending-bg:     #fff8e1;
  --pending-fg:     #f57f17;
  --new-bg:         #e5eef8;
  --new-fg:         #1a67cc;
}

/* 10px rem base */
html { font-size: 62.5%; -webkit-text-size-adjust: 100%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 1.7rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse 90rem 50rem at 8% -10%,  rgba(229, 238, 248, 0.9), transparent 60%),
    radial-gradient(ellipse 70rem 40rem at 100% 5%,  rgba(244, 238, 215, 0.65), transparent 55%);
  background-repeat: no-repeat;
}

a { color: var(--cta); text-decoration: none; }
a:hover { color: var(--cta-dark); text-decoration: underline; }


/* --- Header --------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.4rem var(--gutter);
  max-width: var(--content-max);
  margin: 0 auto;
}
.brand { display: inline-flex; }
.brand img { height: 3.6rem; width: auto; display: block; }

.brand-group { display: flex; flex-direction: column; gap: 0.6rem; }
.back-links { display: flex; gap: 1.2rem; }


.back-link {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--grey-soft);
  text-decoration: none;
}
.back-link:hover { color: var(--cta); text-decoration: none; }

.chip {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--cream);
  color: var(--cta-dark);
  border: 1px solid var(--cream-border);
  white-space: nowrap;
}


/* --- Main layout ---------------------------------------------------------- */

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem var(--gutter) 8rem;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}


/* --- Member banner -------------------------------------------------------- */

.member-banner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2.4rem 3rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.member-avatar {
  width: 5.6rem;
  height: 5.6rem;
  border-radius: 50%;
  background: var(--cool);
  border: 2px solid var(--cta);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cta);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.2rem;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.member-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2.2rem;
  color: var(--dark);
  line-height: 1.2;
}

.member-since {
  font-size: 1.4rem;
  color: var(--grey-soft);
}


/* --- Toolbar (search) ----------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.search-wrap {
  position: relative;
  flex: 1 1 28rem;
  max-width: 48rem;
}
.search-icon {
  position: absolute;
  left: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--grey-soft);
  pointer-events: none;
}
.search-input {
  font-family: var(--font-body);
  font-size: 1.5rem;
  padding: 1rem 1.4rem 1rem 4rem;
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-sm);
  width: 100%;
  background: var(--light);
  color: var(--dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: #aaa; }
.search-input:focus {
  outline: none;
  border-color: var(--cta);
  box-shadow: 0 0 0 3px rgba(26, 103, 204, 0.18);
}


/* --- Portal layout (sidebar + content) ------------------------------------ */

.portal-layout {
  display: grid;
  grid-template-columns: 24rem 1fr;
  gap: 2.4rem;
  align-items: start;
}


/* --- Category sidebar (desktop) ------------------------------------------- */

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem;
  position: sticky;
  top: 2rem;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 1.4rem;
  border: none;
  border-radius: 1rem;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--grey);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.cat-btn:hover {
  background: #f5f7fa;
  color: var(--dark);
}
.cat-btn--active {
  background: var(--cool);
  color: var(--cta);
  font-weight: 600;
}
.cat-btn--active:hover {
  background: var(--cool);
  color: var(--cta);
}

.cat-btn__icon {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f5f7fa;
  color: var(--grey-soft);
  transition: background 0.15s, color 0.15s;
}
.cat-btn--active .cat-btn__icon {
  background: var(--cta);
  color: var(--light);
}

.cat-btn__label {
  flex: 1;
}

.cat-btn__count {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--grey-soft);
  background: #f0f0f0;
  padding: 0.2rem 0.8rem;
  border-radius: var(--radius-pill);
  min-width: 2.4rem;
  text-align: center;
}
.cat-btn--active .cat-btn__count {
  background: rgba(26, 103, 204, 0.15);
  color: var(--cta);
}


/* --- Category tabs (mobile) ----------------------------------------------- */

.category-tabs {
  display: none;
  gap: 0.8rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.4rem;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  border: 1.5px solid var(--grey-line);
  border-radius: var(--radius-pill);
  background: var(--light);
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--grey);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover {
  border-color: var(--cta);
  color: var(--cta);
}
.tab-btn--active {
  background: var(--cta);
  border-color: var(--cta);
  color: var(--light);
  font-weight: 600;
}
.tab-btn--active:hover {
  background: var(--cta-dark);
  border-color: var(--cta-dark);
  color: var(--light);
}


/* --- File area ------------------------------------------------------------ */

.file-area {
  min-width: 0; /* prevent grid blowout */
}

.file-area__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

.file-area__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2rem;
  color: var(--dark);
  margin: 0;
  line-height: 1.3;
}

.file-area__subtitle {
  font-size: 1.4rem;
  color: var(--grey-soft);
  margin: 0.2rem 0 0;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--light);
  background: var(--cta);
  border: none;
  border-radius: var(--radius-pill);
  padding: 1rem 2.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.upload-btn:hover {
  background: var(--cta-dark);
  transform: translateY(-1px);
}
.upload-btn:active {
  transform: translateY(0);
}
.upload-btn svg {
  flex-shrink: 0;
}


/* --- File cards ----------------------------------------------------------- */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 1.6rem 2rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s, transform 0.2s;
  opacity: 0;
  transform: translateY(0.6rem);
  animation: card-in 0.45s cubic-bezier(.22, 1, .36, 1) forwards;
}
.file-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

@keyframes card-in { to { opacity: 1; transform: none; } }

.file-card__icon {
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Per-category icon colours */
.file-card__icon--prescriptions { background: #eef3ff; color: #3b7ddd; }
.file-card__icon--gp-letters    { background: #e6f7f5; color: var(--accent-dark); }
.file-card__icon--blood-results { background: #fceef0; color: #c0392b; }
.file-card__icon--invoices      { background: var(--cream); color: #b8860b; }
.file-card__icon--id            { background: #f0eaf8; color: #7c3aed; }
.file-card__icon--consent       { background: #e5eef8; color: var(--cta-dark); }

.file-card__body {
  flex: 1;
  min-width: 0;
}

.file-card__name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--dark);
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card__meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.file-card__date,
.file-card__size {
  font-size: 1.3rem;
  color: var(--grey-soft);
  white-space: nowrap;
}

.file-card__date::before {
  content: "";
}

.file-card__size::before {
  content: "";
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--grey-soft);
  vertical-align: middle;
  margin-right: 0.6rem;
}

/* Status badges */
.file-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 1rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.file-badge--verified { background: var(--verified-bg); color: var(--verified-fg); }
.file-badge--pending  { background: var(--pending-bg);  color: var(--pending-fg); }
.file-badge--new      { background: var(--new-bg);      color: var(--new-fg); }

/* Download button */
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.8rem;
  height: 3.8rem;
  border: 1.5px solid var(--grey-line);
  border-radius: 1rem;
  background: var(--light);
  color: var(--grey-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.download-btn:hover {
  border-color: var(--cta);
  color: var(--cta);
  background: #f5f8ff;
}


/* --- Empty state ---------------------------------------------------------- */

.empty-state {
  padding: 6rem 2rem;
  text-align: center;
}
.empty-state__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2rem;
  color: var(--dark);
  margin: 0 0 0.6rem;
}
.empty-state__desc {
  font-size: 1.5rem;
  color: var(--grey-soft);
  margin: 0;
}


/* --- Toast ---------------------------------------------------------------- */

.toast-area {
  position: fixed;
  bottom: 2.4rem;
  right: 2.4rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: none;
}
.toast {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--light);
  background: var(--dark);
  padding: 1.2rem 2rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  animation: toast-in 0.35s cubic-bezier(.22, 1, .36, 1) forwards;
  max-width: 40rem;
}
.toast--success {
  background: var(--verified-fg);
}
.toast--out {
  animation: toast-out 0.25s ease forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(0.5rem) scale(0.96); }
}


/* --- Integrated tool panels ------------------------------------------------ */

.tool-panel {
  background: linear-gradient(180deg, var(--light) 0%, #fcfcfd 100%);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-md);
  padding: 3rem;
  box-shadow: var(--shadow-soft);
}
.tool-panel__header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.4rem;
}
.tool-panel__icon {
  width: 5.2rem; height: 5.2rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--light);
  flex-shrink: 0;
}
.tool-panel__icon--results { background: var(--accent-dark); }
.tool-panel__icon--tracker { background: var(--cta); }

.tool-panel__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1.2;
  color: var(--dark);
  margin: 0 0 0.4rem;
}
.tool-panel__sub {
  font-size: 1.5rem;
  color: var(--grey-soft);
  margin: 0;
}

.tool-panel__preview {
  display: grid;
  gap: 1.2rem;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--light);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius-sm, 0.5rem);
}

.tool-preview-row {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  font-size: 1.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(224, 224, 224, 0.5);
}
.tool-preview-row:last-child { border-bottom: none; }
.tool-preview-label {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--dark);
  min-width: 14rem;
}
.tool-preview-value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--grey);
}
.tool-preview-value--good { color: var(--accent-dark); }
.tool-preview-value--warn { color: #b87a00; }
.tool-preview-range { font-size: 1.3rem; color: var(--grey-soft); margin-left: auto; }

.tool-preview-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.4rem;
}
.tool-panel__preview:has(.tool-preview-stat) {
  grid-template-columns: repeat(3, 1fr);
}
.tool-preview-stat__value {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2rem;
  color: var(--cta-dark);
}
.tool-preview-stat__label {
  font-size: 1.2rem;
  color: var(--grey-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-heading);
  font-weight: 600;
  margin-top: 0.3rem;
}

.tool-panel__note {
  font-size: 1.3rem;
  color: var(--grey-soft);
  margin: 0 0 2rem;
}

.tool-panel__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--light);
  background: var(--cta);
  border: none;
  border-radius: 100em;
  padding: 1.1rem 2.4rem;
  text-decoration: none;
  transition: background 0.15s;
}
.tool-panel__btn:hover { background: var(--cta-dark); color: var(--light); }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--grey-line);
  padding: 3rem var(--gutter) 4rem;
  max-width: var(--content-max);
  margin: 4rem auto 0;
  color: var(--grey-soft);
  font-size: 1.35rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--cta); }
.site-footer a:hover { color: var(--cta-dark); }


/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .file-card,
  .toast {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}


/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .portal-layout {
    grid-template-columns: 1fr;
  }
  .category-nav {
    display: none;
  }
  .category-tabs {
    display: flex;
  }
}

@media (max-width: 540px) {
  .member-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 2rem;
  }

  .file-card {
    flex-wrap: wrap;
    gap: 1.2rem;
    padding: 1.4rem 1.6rem;
  }

  .file-card__body {
    min-width: calc(100% - 6rem);
  }

  .file-badge {
    order: 10;
  }

  .download-btn {
    order: 11;
    margin-left: auto;
  }

  .file-area__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
  }

  .toolbar {
    flex-direction: column;
  }

  .search-wrap {
    max-width: 100%;
  }
}
