/* ================================================================
   Patient Portal — style.css
   Excellent Health Consultant
   ================================================================ */

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

:root {
  --blue:    #1A5FD4;
  --teal:    #0B9B93;
  --dark:    #0F172A;
  --slate:   #334155;
  --muted:   #64748B;
  --border:  #E2E8F0;
  --bg:      #F8FAFC;
  --white:   #ffffff;
  --sidebar: 260px;
  --radius:  14px;
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--slate); min-height: 100vh; }

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

/* ── AUTH PAGES ─────────────────────────────────────────────── */
.portal-auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0B1F4D 0%, #1A3A6B 50%, #0B9B93 100%);
  padding: 24px;
}

.portal-auth-card {
  background: var(--white); border-radius: 24px;
  padding: 40px 44px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
}
.portal-auth-card--wide { max-width: 680px; }

.portal-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; margin-bottom: 32px;
}
.portal-brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.portal-brand-name {
  font-size: 1.05rem; font-weight: 800; color: var(--dark);
  line-height: 1.2;
}
.portal-brand-name em { color: var(--blue); font-style: normal; }
.portal-brand-sub { font-size: .75rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

.portal-auth-title { font-size: 1.55rem; font-weight: 800; color: var(--dark); margin-bottom: 6px; }
.portal-auth-sub   { color: var(--muted); font-size: .9rem; margin-bottom: 24px; line-height: 1.5; }

/* Alerts */
.portal-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  font-size: .88rem; margin-bottom: 16px; line-height: 1.5;
}
.portal-alert-err { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.portal-alert-ok  { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.portal-alert svg { flex-shrink: 0; margin-top: 1px; }

/* Form */
.portal-form { display: flex; flex-direction: column; gap: 16px; }
.pf-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:520px) { .pf-row { grid-template-columns: 1fr; } }

.pf-group { display: flex; flex-direction: column; gap: 6px; }
.pf-group label {
  font-size: .82rem; font-weight: 600; color: var(--slate);
  display: flex; justify-content: space-between; align-items: center;
}
.pf-forgot { font-size: .8rem; font-weight: 500; color: var(--blue); }

.pf-input-wrap {
  position: relative; display: flex; align-items: center;
}
.pf-input-wrap > svg {
  position: absolute; left: 14px; color: #94A3B8; pointer-events: none;
}
.pf-input-wrap input {
  width: 100%; padding: 11px 42px 11px 42px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: .92rem; font-family: inherit; color: var(--dark);
  background: #fff; outline: none; transition: border-color .15s;
}
.pf-input-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,95,212,.1); }
.pf-input-wrap input::placeholder { color: #CBD5E1; }

.pf-eye {
  position: absolute; right: 12px; background: none; border: none;
  color: #94A3B8; cursor: pointer; padding: 4px; display: flex;
}
.pf-eye:hover { color: var(--slate); }
.pf-err { font-size: .8rem; color: #DC2626; }

.portal-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff; border: none; border-radius: 10px;
  padding: 13px 24px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: opacity .2s, transform .2s;
  text-decoration: none; font-family: inherit;
}
.portal-btn-primary:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; color: #fff; }

.portal-auth-switch { text-align: center; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.portal-auth-switch a { font-weight: 600; }
.portal-auth-back { text-align: center; margin-top: 10px; font-size: .82rem; color: #94A3B8; }

/* ── PORTAL LAYOUT ──────────────────────────────────────────── */
.portal-body { display: flex; min-height: 100vh; }

/* Sidebar */
.portal-sidebar {
  width: var(--sidebar); background: var(--dark);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 100;
  padding: 0 0 24px;
}

.portal-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 22px; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.portal-sidebar-brand span {
  font-size: 1rem; font-weight: 800; color: #fff;
}
.portal-sidebar-brand em { color: var(--teal); font-style: normal; }

.portal-nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 4px; }
.portal-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,.6); font-size: .88rem; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
}
.portal-nav-item:hover, .portal-nav-item.active {
  background: rgba(255,255,255,.08); color: #fff; text-decoration: none;
}
.portal-nav-item.active { background: linear-gradient(135deg, rgba(26,95,212,.4), rgba(11,155,147,.3)); color: #fff; }

.portal-sidebar-footer {
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.portal-sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; margin-bottom: 4px;
}
.portal-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff; font-size: .8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.portal-sidebar-uname  { font-size: .84rem; font-weight: 600; color: #fff; line-height: 1.3; }
.portal-sidebar-uemail { font-size: .72rem; color: rgba(255,255,255,.45); }
.portal-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  color: rgba(255,255,255,.5); font-size: .85rem; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
}
.portal-logout:hover { background: rgba(239,68,68,.15); color: #FCA5A5; text-decoration: none; }

/* Main content */
.portal-main {
  margin-left: var(--sidebar);
  flex: 1; padding: 32px 36px;
  max-width: calc(100vw - var(--sidebar));
}
@media(max-width:768px) {
  .portal-sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .portal-main { margin-left: 0; padding: 20px; max-width: 100%; }
}

/* Top bar */
.portal-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 28px;
}
.portal-page-title { font-size: 1.6rem; font-weight: 800; color: var(--dark); }
.portal-page-sub   { color: var(--muted); font-size: .9rem; margin-top: 4px; }

/* Stats row */
.portal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 16px; margin-bottom: 32px;
}
.portal-stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.04);
}
.portal-stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.portal-stat-value { font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1; }
.portal-stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: 4px; }

/* Sections */
.portal-section { margin-bottom: 32px; }
.portal-section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.portal-section-head h2 { font-size: 1.1rem; font-weight: 700; color: var(--dark); }
.portal-count-pill {
  background: #EBF2FF; color: var(--blue);
  font-size: .75rem; font-weight: 700;
  padding: 2px 9px; border-radius: 50px;
}

/* Appointment cards */
.portal-appt-list { display: flex; flex-direction: column; gap: 10px; }
.portal-appt-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  text-decoration: none; transition: box-shadow .15s, transform .15s;
}
.portal-appt-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); transform: translateY(-1px); text-decoration: none; }
.portal-appt-card--upcoming { border-left: 4px solid var(--blue); }

.portal-appt-date-block {
  text-align: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff; border-radius: 10px; padding: 8px 14px; min-width: 58px;
}
.portal-appt-month { font-size: .68rem; font-weight: 700; text-transform: uppercase; opacity: .85; }
.portal-appt-day   { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.portal-appt-year  { font-size: .68rem; opacity: .7; }

.portal-appt-info  { flex: 1; min-width: 0; }
.portal-appt-service { font-size: .92rem; font-weight: 600; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-appt-meta  { display: flex; gap: 12px; align-items: center; margin-top: 5px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.portal-appt-virtual { color: var(--teal); font-weight: 600; }
.portal-appt-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-appt-arrow  { color: #CBD5E1; flex-shrink: 0; }

/* Badges */
.portal-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 50px; font-size: .75rem; font-weight: 700;
}
.badge-ok   { background: #ECFDF5; color: #059669; }
.badge-warn { background: #FFFBEB; color: #D97706; }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-err  { background: #FEF2F2; color: #DC2626; }

/* Table */
.portal-table-wrap { overflow-x: auto; }
.portal-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  font-size: .88rem;
}
.portal-table th {
  background: #F1F5F9; padding: 12px 16px;
  text-align: left; font-size: .78rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.portal-table td { padding: 12px 16px; border-bottom: 1px solid #F1F5F9; color: var(--slate); vertical-align: middle; }
.portal-table tr:last-child td { border: none; }
.portal-table tr:hover td { background: #F8FAFC; }
.portal-ref { font-family: monospace; font-size: .82rem; color: var(--muted); }
.portal-svc-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-table-link { color: var(--blue); font-weight: 600; font-size: .82rem; }
.portal-table-link:hover { text-decoration: underline; }

/* Empty state */
.portal-empty {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 48px 32px;
  text-align: center; color: var(--muted);
}
.portal-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.portal-empty p { font-size: .95rem; }

/* ── BOOKING DETAIL PAGE ─────────────────────────────────────── */
.portal-back-link { color: var(--muted); font-size: .85rem; display: inline-flex; align-items: center; gap: 4px; }
.portal-back-link:hover { color: var(--blue); }

.portal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px; align-items: start;
}
@media(max-width:900px) { .portal-detail-grid { grid-template-columns: 1fr; } }
.portal-detail-col { display: flex; flex-direction: column; gap: 20px; }

.portal-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.portal-card--meeting { border-top: 3px solid var(--teal); }
.portal-card--info    { border-top: 3px solid #E2E8F0; }
.portal-card--help    { border-top: 3px solid var(--blue); }

.portal-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: .9rem; font-weight: 700; color: var(--dark);
  background: #FAFBFC;
}
.portal-card-head svg { color: var(--blue); }

.portal-detail-rows { padding: 6px 0; }
.portal-detail-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 11px 20px; border-bottom: 1px solid #F1F5F9;
  font-size: .88rem;
}
.portal-detail-row:last-child { border: none; }
.pdr-label { color: var(--muted); font-weight: 500; flex-shrink: 0; min-width: 110px; }
.pdr-val   { color: var(--dark); font-weight: 500; text-align: right; flex-wrap: wrap; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.portal-svc-pill {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  background: #EBF2FF; color: var(--blue); font-size: .77rem; font-weight: 600;
}

/* Receipt */
.portal-receipt { padding: 16px 20px; }
.portal-receipt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #F1F5F9;
  font-size: .9rem; color: var(--slate);
}
.portal-receipt-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0 0; font-size: 1.05rem; color: var(--dark); margin-top: 4px;
}
.portal-receipt-total strong { font-size: 1.2rem; color: var(--blue); }
.portal-receipt-paid {
  display: flex; align-items: center; gap: 8px;
  background: #F0FDF4; color: #15803D; font-weight: 700;
  padding: 12px 14px; border-radius: 10px; font-size: .88rem;
  margin-top: 14px; border: 1px solid #BBF7D0;
}
.portal-receipt-unpaid { text-align: center; margin-top: 14px; }
.portal-receipt-unpaid p { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.portal-pay-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff; padding: 13px 28px; border-radius: 10px;
  font-weight: 800; font-size: .95rem; text-decoration: none;
  transition: opacity .2s, transform .2s;
}
.portal-pay-btn:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; color: #fff; }

/* Meeting info */
.portal-meeting-info { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.portal-meeting-platform { font-size: 1rem; font-weight: 700; color: var(--dark); }
.portal-join-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--teal), #0B7A73);
  color: #fff; padding: 13px 24px; border-radius: 10px;
  font-weight: 700; font-size: .92rem; text-decoration: none;
  transition: opacity .2s; margin-top: 4px;
}
.portal-join-btn:hover { opacity: .9; text-decoration: none; color: #fff; }
.portal-meeting-copy { display: flex; gap: 8px; margin-top: 4px; }
.portal-meeting-copy input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: .8rem; font-family: monospace;
  color: var(--muted); background: #F8FAFC; outline: none;
}
.portal-copy-btn {
  background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 9px 14px; font-size: .8rem;
  font-weight: 600; cursor: pointer; transition: background .2s;
  font-family: inherit;
}
.portal-copy-btn:hover { background: #1450B0; }

/* Help card */
.portal-contact-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 9px; background: #F8FAFC;
  font-size: .85rem; color: var(--slate); text-decoration: none;
  border: 1px solid var(--border); transition: background .15s;
}
.portal-contact-link:hover { background: #EBF2FF; color: var(--blue); text-decoration: none; }

/* Misc */
.portal-card .portal-detail-rows { padding: 0; }
.portal-card > .portal-meeting-info .portal-detail-row { padding: 9px 0; }

/* ── Forgot password page ────────────────────────────────────── */
.fp-info-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fp-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: .9rem;
  color: #334155;
  line-height: 1.5;
}
.fp-info-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Consultation Report card ──────────────────────────────── */
.portal-report-card {
  border-left: 4px solid #1A5FD4;
}
.portal-report-card .portal-card-head {
  background: linear-gradient(135deg, #EFF6FF, #F0FDFA);
  color: #1E40AF;
  position: relative;
}
.portal-report-new-badge {
  margin-left: auto;
  background: #1A5FD4;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.portal-report-body {
  padding: 20px 22px;
}
.portal-report-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: #94A3B8;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F1F5F9;
}
.portal-report-text {
  font-size: .9rem;
  color: #334155;
  line-height: 1.85;
}
/* Quill HTML output formatting inside patient portal */
.portal-report-text h1, .portal-report-text h2, .portal-report-text h3 {
  font-weight: 700;
  margin: 14px 0 6px;
  color: #0F172A;
}
.portal-report-text h1 { font-size: 1.15rem; }
.portal-report-text h2 { font-size: 1rem; }
.portal-report-text h3 { font-size: .92rem; }
.portal-report-text p  { margin-bottom: 10px; }
.portal-report-text ul, .portal-report-text ol {
  padding-left: 20px;
  margin-bottom: 10px;
}
.portal-report-text li { margin-bottom: 4px; }
.portal-report-text blockquote {
  border-left: 3px solid #93C5FD;
  padding: 6px 14px;
  margin: 10px 0;
  color: #475569;
  font-style: italic;
}
.portal-report-text strong { font-weight: 700; }
.portal-report-text em     { font-style: italic; }
.portal-report-text u      { text-decoration: underline; }
.portal-report-text s      { text-decoration: line-through; }
.portal-report-card--empty {
  border-left-color: #E2E8F0;
  opacity: .85;
}
.portal-report-card--empty .portal-card-head {
  background: #F8FAFC;
  color: #94A3B8;
}

/* Report badge on appointment cards / table */
.portal-report-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: #EFF6FF;
  color: #1A5FD4;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid #BFDBFE;
  white-space: nowrap;
}
