/* ==========================================================================
   UrgentChart Patient Portal - Design System
   Bootstrap 5 companion CSS with custom properties and components
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  --color-dark-blue: #0b3c6f;
  --color-light-blue: #2fa4e7;
  --color-cta-gradient: linear-gradient(90deg, #4b6cb7, #355c8a);
  --color-btn-gradient: linear-gradient(90deg, #2a6db0, #3b82f6);
  --color-bg-panel: #f4f6f8;
  --color-bg-footer: #f2f2f2;
  --color-login-bg: #f4f6f8;
  --color-error: #dc3545;
  --color-text-primary: #333333;
  --color-text-secondary: #666666;
  --color-text-muted: #777777;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Landing Page Header (D-08)
   -------------------------------------------------------------------------- */
.portal-header {
  background: #fff;
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-header .logo img {
  height: 40px;
}

.portal-header .btn-login {
  color: var(--color-dark-blue);
  font-weight: 700;
  text-decoration: none;
}

.btn-login-header {
  color: var(--color-dark-blue);
  font-weight: 700;
  text-decoration: none;
  font-size: 16px;
}

.btn-login-header:hover {
  color: var(--color-light-blue);
}

.mobile-menu-toggle {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-wrapper {
  background: var(--color-bg-panel);
}

.hero-section {
  display: flex;
  min-height: 480px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.hero-bg {
  flex: 0 0 600px;
  background-size: auto 100%;
  background-position: top right;
  background-repeat: no-repeat;
  position: relative;
  background-color: var(--color-bg-panel);
}

.hero-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 100%;
  background: linear-gradient(to left, transparent, rgb(244, 246, 248));
}

.hero-right {
  flex: 1;
  background: var(--color-bg-panel);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-title {
  font-size: 80px;
  font-weight: 800;
  line-height: 0.85;
  color: var(--color-dark-blue);
  margin-bottom: 20px;
}

.hero-title .light {
  color: var(--color-light-blue);
  font-size: 64px;
}

.hero-welcome {
  margin-bottom: 0;
}

.hero-welcome-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-dark-blue);
}

.hero-welcome-clinic {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--color-dark-blue);
}

.hero-description {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  max-width: 440px;
}

.hero-info-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-hours-summary {
  font-size: 14px;
  color: var(--color-text-primary);
  line-height: 1.7;
}

.hero-hours-line strong {
  color: var(--color-text-primary);
}

.hero-wait-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  padding: 10px 20px 10px 14px;
}

.hero-wait-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-dark-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.hero-wait-badge-text {
  display: flex;
  flex-direction: column;
}

.hero-wait-badge-number {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.hero-wait-badge-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-light-blue);
}

.hero-address {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--color-text-secondary);
  letter-spacing: 0.3px;
}

.hero-address i {
  margin-right: 6px;
  color: var(--color-light-blue);
}

.small-label {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hero-detail {
  font-size: 16px;
  color: var(--color-text-secondary);
}

.otp-hint {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

.btn-link-subtle {
  background: none;
  border: none;
  color: var(--color-light-blue);
  cursor: pointer;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   CTA Section
   -------------------------------------------------------------------------- */
.cta-section {
  background: linear-gradient(135deg, #3a6fb5, #4a7ec2);
  padding: 48px 0 56px;
}

.cta-heading {
  text-align: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
}

.cta-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 32px;
  padding: 24px 32px;
  text-decoration: none;
  color: #fff;
  flex: 1;
  max-width: 460px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cta-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  color: #fff;
}

.cta-card-appointment {
  background: linear-gradient(135deg, #7ec8e3, #5bb0d0);
}

.cta-card-signin {
  background: linear-gradient(135deg, #e8864a, #d4753e);
}

.cta-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cta-card-title {
  font-size: 20px;
  font-weight: 500;
}

.cta-card-desc {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Footer (D-04)
   -------------------------------------------------------------------------- */
.portal-footer {
  background: var(--color-bg-footer);
  padding: var(--spacing-md);
  text-align: center;
}

.portal-footer .copyright {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Landing page footer */
.portal-footer-landing {
  background: #fff;
  border-top: 1px solid #e8e8e8;
  padding: 24px 0;
}

.portal-footer-landing .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.portal-footer-landing .footer-left {
  text-align: left;
}

.portal-footer-landing .footer-brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-primary);
}

.portal-footer-landing .footer-copyright {
  font-size: 12px;
  color: var(--color-text-muted);
}

.portal-footer-landing .footer-center {
  text-align: center;
}

.footer-logo-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-dark-blue);
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-dark-blue);
  color: #fff;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
}

.portal-footer-landing .footer-right {
  display: flex;
  gap: 24px;
}

.portal-footer-landing .footer-right a {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.portal-footer-landing .footer-right a:hover {
  color: var(--color-dark-blue);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Reason for Visit Autocomplete
   -------------------------------------------------------------------------- */
.reason-visit-wrap {
  position: relative;
}

.reason-visit-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.reason-visit-item {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--color-text-primary);
  cursor: pointer;
  border-bottom: 1px solid #f4f4f4;
}

.reason-visit-item:last-child {
  border-bottom: none;
}

.reason-visit-item:hover {
  background: #f0f6ff;
}

.reason-visit-item strong {
  color: var(--color-dark-blue);
}

/* --------------------------------------------------------------------------
   Appointment Wizard
   -------------------------------------------------------------------------- */
.wizard-container {
  background: #fff;
  border-radius: 20px;
  padding: 40px 48px;
  max-width: 720px;
  width: 100%;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.08);
  margin: 40px auto;
}

.wizard-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-dark-blue);
  margin-bottom: 32px;
}

.wizard-progress {
  margin-bottom: 36px;
  position: relative;
}

.wizard-progress-track {
  height: 4px;
  background: #e4e8ee;
  border-radius: 4px;
  position: absolute;
  top: 16px;
  left: 48px;
  right: 48px;
}

.wizard-progress-fill {
  height: 100%;
  background: var(--color-light-blue);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: default;
  flex: 1;
}

.wizard-step.completed {
  cursor: pointer;
}

.wizard-step-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e4e8ee;
  color: #999;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #e4e8ee;
}

.wizard-step.active .wizard-step-dot {
  background: var(--color-light-blue);
  color: #fff;
  box-shadow: 0 0 0 2px var(--color-light-blue);
}

.wizard-step.completed .wizard-step-dot {
  background: var(--color-dark-blue);
  color: #fff;
  box-shadow: 0 0 0 2px var(--color-dark-blue);
}

.wizard-step-label {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wizard-step.active .wizard-step-label {
  color: var(--color-light-blue);
}

.wizard-step.completed .wizard-step-label {
  color: var(--color-dark-blue);
}

.wizard-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.wizard-panel-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #eee;
}

.wizard-btn {
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.wizard-btn-next {
  background: var(--color-btn-gradient);
  color: #fff;
}

.wizard-btn-next:hover {
  opacity: 0.9;
}

.wizard-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wizard-btn-back {
  background: #f0f2f5;
  color: var(--color-text-secondary);
}

.wizard-btn-back:hover {
  background: #e4e8ee;
}

.wizard-btn-submit {
  background: linear-gradient(135deg, #28a745, #20913b);
  color: #fff;
}

.wizard-btn-submit:hover {
  opacity: 0.9;
}

.wizard-slot-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eaf7ee;
  color: #1a7c35;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
}

.wizard-slot-selected i {
  font-size: 18px;
}

.wizard-review {
  background: var(--color-bg-panel);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 20px;
}

.wizard-review-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.wizard-review-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.wizard-review-label {
  color: var(--color-text-secondary);
}

.wizard-review-value {
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: right;
}

@media (max-width: 767px) {
  .wizard-container {
    padding: 24px 20px;
    margin: 16px;
    border-radius: 16px;
  }

  .wizard-step-label {
    font-size: 10px;
  }

  .wizard-progress-track {
    left: 32px;
    right: 32px;
  }

  .wizard-nav {
    gap: 12px;
  }

  .wizard-btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .wizard-review-row {
    flex-direction: column;
    gap: 2px;
  }
}

.login-header {
  background: var(--color-dark-blue);
  padding: 14px 24px;
  text-align: center;
}

.login-header-brand {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.login-header-brand:hover {
  color: #fff;
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Login / Auth Card (D-10)
   -------------------------------------------------------------------------- */
.login-body {
  background: var(--color-login-bg);
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px var(--spacing-lg) var(--spacing-lg);
  position: relative;
}

.login-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.5;
  filter: blur(5px);
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.login-box .clinic-logo {
  display: block;
  margin: 0 auto var(--spacing-lg);
  max-height: 60px;
}

.login-box h2 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-primary);
}

.login-input {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  width: 100%;
  font-size: 16px;
}

.login-input:focus {
  border-color: var(--color-light-blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 164, 231, 0.2);
}

.btn-login {
  background: var(--color-btn-gradient);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-login:hover {
  opacity: 0.9;
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-alert-message {
  color: var(--color-error);
  font-size: 14px;
  margin-top: var(--spacing-sm);
}

.login-success-message {
  color: #198754;
  font-size: 14px;
  margin-top: var(--spacing-sm);
}

/* --------------------------------------------------------------------------
   OTP Input Boxes (D-11)
   -------------------------------------------------------------------------- */
.otp-inputs {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  margin: var(--spacing-lg) 0;
}

.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid #ddd;
  border-radius: 10px;
}

.otp-inputs input:focus {
  border-color: var(--color-light-blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 164, 231, 0.2);
}

/* --------------------------------------------------------------------------
   Form Card (D-15)
   -------------------------------------------------------------------------- */
.appointment-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  max-width: 800px;
  width: 100%;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.appt-section {
  border-top: 1px solid #ddd;
  padding-top: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

/* --------------------------------------------------------------------------
   Mobile Responsive (D-06, D-07)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .hero-section {
    flex-direction: column;
  }

  .hero-bg {
    min-height: 0;
    flex: none;
    aspect-ratio: auto;
    background-size: 100% auto;
    background-position: top center;
    height: auto;
    padding-top: 56%;
  }

  .hero-bg::after {
    display: none;
  }

  .hero-right {
    padding: var(--spacing-xl);
    text-align: center;
  }

  .hero-title {
    font-size: 50px;
  }

  .hero-description {
    max-width: 100%;
  }

  .hero-info-row {
    justify-content: center;
  }

  .cta-card {
    max-width: 100%;
  }

  .cta-heading {
    font-size: 22px;
  }

  .login-box {
    max-width: 100%;
    margin: 0 var(--spacing-md);
    padding: var(--spacing-lg);
  }

  .appointment-box {
    padding: var(--spacing-lg);
  }

  .otp-inputs input {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }

  .portal-footer-landing .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .portal-footer-landing .footer-left {
    text-align: center;
  }

  .portal-footer-landing .footer-right {
    justify-content: center;
  }
}

.mobile-menu {
  background: #1a1a2e;
  color: #fff;
}

.mobile-menu .offcanvas-body a {
  color: #fff;
  text-decoration: none;
  display: block;
  padding: var(--spacing-md);
  font-size: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu .offcanvas-body a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Authenticated Portal Layout (Phase 2)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Additional CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  --color-card-header-start: #276EBD;
  --color-card-header-end: #2D93E2;
  --color-sidebar-active: #e6f0ff;
  --color-sidebar-bg: #ffffff;
  --color-topbar-bg-start: #276EBD;
  --color-topbar-bg-end: #2D93E2;
  --color-offcanvas-bg: #111111;
  --radius-card: 15px;
  --radius-sidebar: 15px;
  --color-success: #198754;
  --color-upload-border: #cccccc;
  --color-upload-border-active: #2fa4e7;
}

/* --------------------------------------------------------------------------
   Portal Topbar (D-02)
   -------------------------------------------------------------------------- */
.portal-topbar {
  background: #fff;
  padding: 12px var(--spacing-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #333;
}

.portal-topbar .logo img {
  height: 36px;
  margin-right: 30px;
}

.portal-topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.portal-topbar .user-info .header-separator {
  margin: 0 0 0 10px;
  font-weight: 400;
  color: #999;
}

.portal-topbar .btn-logout {
  color: #3f66a0;
  background: transparent;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  transition: color 0.2s;
}

.portal-topbar .btn-logout:hover {
  color: #1a3d6e;
}

.portal-topbar .hamburger {
  display: none;
  background: none;
  border: none;
  color: #333;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

/* Mobile Navigation Menu */
.mobile-nav {
  display: none;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 8px 0;
}

.mobile-nav.open {
  display: block;
}

.mobile-nav-link {
  display: block;
  padding: 12px var(--spacing-xl);
  font-size: 15px;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  transition: background 0.15s;
}

.mobile-nav-link:hover {
  background: #f5f7fa;
  color: #333;
  text-decoration: none;
}

.mobile-nav-link.active {
  color: #3f66a0;
  background: #f0f5fb;
}

.mobile-nav-link i {
  width: 24px;
  text-align: center;
  margin-right: 8px;
  color: #3f66a0;
}

.mobile-nav-logout {
  margin: 0;
}

.mobile-nav-logout .mobile-nav-link {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 767px) {
  .portal-topbar .hamburger {
    display: block;
  }

  .topbar-desktop-only {
    display: none !important;
  }

  .dashboard-action-flex {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Portal Nav Bar (persistent patient info + action buttons)
   -------------------------------------------------------------------------- */
.portal-nav-bar {
  background: var(--color-bg-panel);
  padding: var(--spacing-md) var(--spacing-lg);
}

/* --------------------------------------------------------------------------
   Portal Layout (D-07)
   -------------------------------------------------------------------------- */
.portal-layout {
  min-height: calc(100vh - 60px);
}

/* --------------------------------------------------------------------------
   Portal Sidebar (D-03, D-05, D-08)
   -------------------------------------------------------------------------- */
.portal-sidebar {
  width: 260px;
  background: var(--color-sidebar-bg);
  border-radius: var(--radius-sidebar);
  padding: var(--spacing-lg) var(--spacing-md);
  flex-shrink: 0;
  border-right: 1px solid #eee;
}

.portal-sidebar .patient-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid #eee;
}

.portal-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 12px 16px;
  color: var(--color-text-primary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 16px;
  transition: background 0.2s;
}

.portal-sidebar .nav-link:hover {
  background: #f4f6f8;
}

.portal-sidebar .nav-link.active {
  background: var(--color-sidebar-active);
  font-weight: 600;
}

.portal-sidebar .nav-link.disabled {
  color: var(--color-text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.portal-sidebar .nav-link.disabled .coming-soon {
  font-size: 12px;
  margin-left: auto;
  color: var(--color-text-muted);
}

.portal-sidebar .nav-link i {
  width: 20px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Portal Content Area
   -------------------------------------------------------------------------- */
.portal-content {
  flex: 1;
  padding: var(--spacing-lg);
  background: var(--color-bg-panel);
  min-height: calc(100vh - 60px);
}

/* --------------------------------------------------------------------------
   Portal Cards (D-06)
   -------------------------------------------------------------------------- */
.portal-card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.portal-card-header {
  background: linear-gradient(90deg, var(--color-card-header-start), var(--color-card-header-end));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  padding: 16px 24px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.portal-card-body {
  padding: 24px;
}

.portal-status-card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 40px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Upload Zone (D-14)
   -------------------------------------------------------------------------- */
.upload-zone {
  border: 2px dashed var(--color-upload-border);
  border-radius: 10px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: var(--spacing-lg);
  transition: border-color 0.2s, background-color 0.2s;
}

.upload-zone:hover {
  border-color: var(--color-upload-border-active);
}

.upload-zone.drag-over {
  border-color: var(--color-upload-border-active);
  background: rgba(47, 164, 231, 0.05);
}

.upload-zone .preview img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
}

.upload-zone .upload-icon {
  font-size: 48px;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

.upload-zone .upload-text {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   Portal Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .portal-content {
    padding: var(--spacing-md);
  }

  .portal-nav-bar {
    padding: var(--spacing-sm) var(--spacing-md);
  }
}

/* --------------------------------------------------------------------------
   Portal Offcanvas (Mobile Sidebar - D-05)
   -------------------------------------------------------------------------- */
.portal-offcanvas {
  background: var(--color-offcanvas-bg) !important;
  color: #fff;
  max-width: 280px;
}

.portal-offcanvas .nav-link {
  color: #fff !important;
}

.portal-offcanvas .nav-link.active {
  background: rgba(255, 255, 255, 0.1);
}

.portal-offcanvas .nav-link.disabled {
  color: rgba(255, 255, 255, 0.4) !important;
}

.portal-offcanvas .patient-name {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Portal Primary Button (D-16)
   -------------------------------------------------------------------------- */
.btn-portal-primary {
  background: linear-gradient(90deg, var(--color-card-header-start), var(--color-card-header-end));
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 600;
}

.btn-portal-primary:hover {
  opacity: 0.9;
  color: #fff;
}

.btn-portal-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   Phase 3: Appointments & Past Visits
   ========================================================================== */

/* --------------------------------------------------------------------------
   Status Badges (D-14, D-15)
   -------------------------------------------------------------------------- */
.badge-confirmed {
  background: #198754;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  display: inline-block;
}

.badge-pending {
  background: #ffc107;
  color: #333;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  display: inline-block;
}

/* --------------------------------------------------------------------------
   Appointment Items (D-16, D-17, D-18, D-19)
   -------------------------------------------------------------------------- */
.appointment-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-item:last-child {
  margin-bottom: 0;
}

.appointment-item .appt-info .appt-datetime {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.appointment-item .appt-info .appt-detail {
  font-size: 14px;
  font-weight: 400;
  color: #666;
}

/* --------------------------------------------------------------------------
   Time Slots (D-07, D-08, D-11)
   -------------------------------------------------------------------------- */
.time-slot {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.time-slot:hover {
  background: #e6f0ff;
}

.time-slot.selected {
  background: #276EBD;
  color: #fff;
  border-color: #276EBD;
}

/* --------------------------------------------------------------------------
   Availability Days (D-01, D-12)
   -------------------------------------------------------------------------- */
.availability-day {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.availability-day:last-child {
  border-bottom: none;
}

.availability-day .day-header {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.availability-day .day-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.availability-day .no-availability {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Week Navigation (D-05, D-10)
   -------------------------------------------------------------------------- */
.week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.week-nav .week-label {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.week-nav .week-arrow {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.week-nav .week-arrow:hover {
  background: #f4f6f8;
}

.week-nav .week-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.week-nav .week-arrow i {
  font-size: 14px;
  color: #333;
}

/* --------------------------------------------------------------------------
   Visit Type Select
   -------------------------------------------------------------------------- */
.visit-type-select {
  max-width: 320px;
}

/* --------------------------------------------------------------------------
   Slot Confirmation Modal (D-30, D-31, D-32, D-33)
   -------------------------------------------------------------------------- */
.slot-confirmation-modal {
  border: none;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.slot-modal-header {
  background: linear-gradient(90deg, var(--color-card-header-start), var(--color-card-header-end));
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.slot-modal-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.slot-modal-header .modal-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.slot-modal-body {
  padding: 24px;
}

.slot-modal-detail {
  background: var(--color-bg-panel);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.slot-modal-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
  color: var(--color-text-primary);
}

.slot-modal-detail-row:not(:last-child) {
  border-bottom: 1px solid #e8ecf0;
}

.slot-modal-detail-row i {
  width: 20px;
  text-align: center;
  color: var(--color-card-header-start);
  font-size: 16px;
}

.slot-modal-detail-row span {
  font-weight: 600;
}

.slot-modal-note {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 0;
  text-align: center;
}

.slot-modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.slot-modal-cancel {
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
}

#submission-success {
  text-align: center;
  padding: 24px 0;
}

#submission-success .success-icon {
  font-size: 48px;
  color: #198754;
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Appointments Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .appointment-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .visit-type-select {
    max-width: 100%;
  }
}

/* ==========================================================================
   Phase 3: Past Visits
   ========================================================================== */

/* --------------------------------------------------------------------------
   Visit Rows (D-22, D-23)
   -------------------------------------------------------------------------- */
.visit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.visit-row:hover {
  background: #f4f6f8;
}

.visit-row:last-child {
  border-bottom: none;
}

.visit-row .visit-date {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.visit-row .visit-detail {
  font-size: 14px;
  font-weight: 400;
  color: #666;
}

.visit-row .visit-chevron {
  font-size: 14px;
  color: #999;
}

/* --------------------------------------------------------------------------
   Visit Pagination
   -------------------------------------------------------------------------- */
.visit-pagination {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   Back Link (D-24)
   -------------------------------------------------------------------------- */
.back-link {
  font-size: 14px;
  color: #276EBD;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link i {
  margin-right: 4px;
}

/* --------------------------------------------------------------------------
   Visit Detail Definition List (D-24)
   -------------------------------------------------------------------------- */
.visit-detail-dl dt {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.visit-detail-dl dd {
  font-size: 16px;
  color: #666;
  margin-bottom: 16px;
  margin-left: 0;
}

/* --------------------------------------------------------------------------
   Report Rows (D-26)
   -------------------------------------------------------------------------- */
.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}

.report-row:last-child {
  border-bottom: none;
}

.report-row .report-name {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.report-row .report-meta {
  font-size: 14px;
  color: #666;
}

.report-row .report-status {
  font-weight: 600;
}

.report-row .report-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Report Viewer (D-27, D-29)
   -------------------------------------------------------------------------- */
.report-viewer {
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f4f6f8;
  margin-top: 16px;
  overflow: hidden;
}

.report-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: #fff;
}

.report-viewer-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.report-viewer-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-viewer-close:hover {
  color: #333;
}

.report-viewer-iframe {
  width: 100%;
  height: 600px;
  border: none;
}

/* --------------------------------------------------------------------------
   Past Visits Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .report-viewer-iframe {
    height: 400px;
  }

  .report-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .report-row .report-actions {
    width: 100%;
  }
}

/* ==========================================================================
   Panel Layout (col-3 / col-9 pattern)
   ========================================================================== */

.panel-layout {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-height: 500px;
  align-content: start;
}

.panel-sidebar {
  background: #fff;
  border-right: 1px solid #eee;
}

.panel-sidebar-inner {
  padding: var(--spacing-md);
}

.panel-sidebar-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.panel-header {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  padding: 14px var(--spacing-md);
  box-sizing: border-box;
  flex-shrink: 0;
}

.panel-header-documents {
  background: linear-gradient(0deg, rgba(50,183,182,1) 0%, rgba(53,129,165,1) 49%, rgba(66,83,137,1) 100%);
}

.panel-header-appointments {
  background: linear-gradient(0deg, rgba(102,110,232,1) 0%, rgba(111,134,214,1) 100%);
}

.panel-header-messages {
  background: linear-gradient(0deg, rgba(106,90,205,1) 0%, rgba(130,100,220,1) 49%, rgba(148,103,189,1) 100%);
}

.panel-header-account {
  background: linear-gradient(0deg, #3f66a0, #5a8ac0);
}

.panel-sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  padding: 8px 12px 4px;
}

.panel-sidebar-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-status-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 8px;
}

.doc-status-icon.complete {
  color: var(--color-primary);
}

.doc-status-icon.pending {
  color: #f0ad4e;
}

.doc-status-icon.empty {
  color: var(--color-text-secondary);
  opacity: 0.4;
}

.panel-sidebar-item:hover {
  background: var(--color-bg-panel);
}

.panel-sidebar-item.active {
  background: var(--color-sidebar-active);
}

.panel-sidebar-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.panel-sidebar-item-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.panel-content {
  background: #fff;
  padding: var(--spacing-lg);
  position: relative;
}

.btn-back-to-list {
  display: none;
  margin-bottom: 12px;
  font-size: 14px;
  color: #3f66a0;
}

.panel-content .portal-card {
  margin-bottom: var(--spacing-lg);
}

/* --------------------------------------------------------------------------
   Panel Layout Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .panel-layout {
    min-height: auto;
  }

  .panel-sidebar {
    border-right: none;
    border-bottom: 1px solid #eee;
  }

  .panel-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--spacing-sm);
  }

  .panel-sidebar-item {
    padding: 6px 10px;
    font-size: 13px;
  }

  .panel-sidebar-label {
    width: 100%;
  }

  .panel-content {
    padding: var(--spacing-md);
  }

  /* Mobile: show list or detail, not both */
  .panel-theme-appointments .panel-content,
  .panel-theme-documents .panel-content,
  .panel-theme-account .panel-content {
    display: none;
  }

  .panel-theme-appointments.detail-active .panel-sidebar,
  .panel-theme-documents.detail-active .panel-sidebar,
  .panel-theme-account.detail-active .panel-sidebar {
    display: none;
  }

  .panel-theme-appointments.detail-active .panel-content,
  .panel-theme-documents.detail-active .panel-content,
  .panel-theme-account.detail-active .panel-content {
    display: block;
  }

  .detail-active .btn-back-to-list,
  .thread-active .btn-back-to-list {
    display: inline-block;
  }

  .thread-active .btn-back-to-list {
    padding: var(--spacing-md) var(--spacing-md) 0;
  }
}

/* ==========================================================================
   Dashboard Redesign
   ========================================================================== */

/* --------------------------------------------------------------------------
   Patient Info Card (top row left)
   -------------------------------------------------------------------------- */
.dashboard-patient-card {
  background: #fff;
  height: 184px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.dashboard-patient-info {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Next Visit Panel (inside patient card, right side)
   -------------------------------------------------------------------------- */
.dashboard-next-visit {
  width: 160px;
  border-radius: 0 20px 20px 0;
  background: linear-gradient(0deg, rgba(56, 235, 186, 1) 0%, rgba(111, 177, 210, 1) 100%);
  color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 12px;
  flex-shrink: 0;
}

.dashboard-next-visit-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.dashboard-next-visit-date {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-next-visit-time {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.dashboard-next-visit-detail {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Action Button Container (top row right)
   -------------------------------------------------------------------------- */
.dashboard-action-flex {
  display: flex;
  align-items: stretch;
  gap: 16px;
  height: 184px;
}

/* --------------------------------------------------------------------------
   Action Button Cards
   -------------------------------------------------------------------------- */
.dashboard-action-box {
  flex: 1;
  border-radius: 20px;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  line-height: 0.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s;
}

.dashboard-action-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  color: #fff;
  text-decoration: none;
}

.dashboard-action-box i {
  font-size: 60px;
  margin-bottom: 8px;
}

.dashboard-action-box span {
  display: block;
  text-align: center;
}

@media (max-width: 1399px) {
  .dashboard-action-box {
    font-size: 20px;
    padding: 8px;
  }

  .dashboard-action-box i {
    font-size: 40px;
  }
}

@media (max-width: 1199px) {
  .dashboard-action-box {
    font-size: 16px;
  }

  .dashboard-action-box i {
    font-size: 32px;
  }
}

/* Documents button gradient */
.dashboard-action-documents {
  background: linear-gradient(0deg, rgba(50,183,182,1) 0%, rgba(53,129,165,1) 49%, rgba(66,83,137,1) 100%);
}

.dashboard-action-documents i {
  color: #aeffae;
}

/* Appointments button gradient */
.dashboard-action-appointments {
  background: linear-gradient(0deg, rgba(102,110,232,1) 0%, rgba(111,134,214,1) 100%);
}

.dashboard-action-appointments i {
  color: #c4e4ff;
}

/* Secure Messages button gradient */
.dashboard-action-messages {
  background: linear-gradient(0deg, rgba(106,90,205,1) 0%, rgba(130,100,220,1) 49%, rgba(148,103,189,1) 100%);
}

.dashboard-action-messages i {
  color: #d8c8f0;
}

/* --------------------------------------------------------------------------
   Alternating Card Header Colors
   -------------------------------------------------------------------------- */
.portal-card-header-dark {
  background: #276ebd;
}

.portal-card-header-bright {
  background: #329dff;
}

/* --------------------------------------------------------------------------
   Dashboard Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .dashboard-action-flex {
    flex-direction: column;
    height: auto;
  }

  .dashboard-action-box {
    height: 120px;
  }

  .dashboard-patient-card {
    height: auto;
    flex-direction: column;
  }

  .dashboard-next-visit {
    width: 100%;
    border-radius: 0 0 20px 20px;
    padding: 12px;
    flex-direction: row;
    gap: 12px;
  }

  .dashboard-next-visit-label {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   Phase 4: Account Settings
   ========================================================================== */

/* --------------------------------------------------------------------------
   Account Settings Layout
   -------------------------------------------------------------------------- */
.account-settings {
    max-width: 600px;
    margin: 0 auto;
}

.password-status {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: var(--spacing-md);
}

.inline-action-form {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid #eee;
}

.contact-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 32px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    background: #fff;
    flex: 1;
    text-align: center;
}

.contact-method-btn i {
    font-size: 28px;
    color: #999;
    transition: color 0.2s;
}

.contact-method-btn:hover {
    border-color: #3f66a0;
    color: #3f66a0;
}

.contact-method-btn:hover i {
    color: #3f66a0;
}

.contact-method-btn.active {
    border-color: #3f66a0;
    background: #f0f5fb;
    color: #3f66a0;
}

.contact-method-btn.active i {
    color: #3f66a0;
}

.pref-radio-group .form-check-label {
    font-size: 16px;
}

.pref-radio-group .form-check-label .text-muted {
    font-size: 14px;
}

/* ==========================================================================
   Phase 4: Secure Messaging
   ========================================================================== */

/* --------------------------------------------------------------------------
   Messaging Layout
   -------------------------------------------------------------------------- */
.messaging-layout {
    align-content: start;
    height: calc(100vh - 60px - 220px);
    overflow: hidden;
}

.messaging-layout > .thread-list-panel,
.messaging-layout > .thread-content-panel {
    height: calc(100% - 49px);
}

.messaging-layout .thread-list-panel {
    overflow-y: auto;
}

.messaging-layout .panel-sidebar-inner {
    padding: var(--spacing-md);
}

.messaging-layout .panel-content {
    padding: 0;
}

.thread-content-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* --------------------------------------------------------------------------
   Thread Rows
   -------------------------------------------------------------------------- */
.thread-row {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    position: relative;
}

.thread-row.unread .thread-subject {
    font-weight: 700;
}

.thread-subject {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
}

.thread-preview {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-text-secondary, #6c757d);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-timestamp {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-text-muted, #adb5bd);
    white-space: nowrap;
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
}

.unread-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: var(--color-light-blue, #2fa4e7);
    margin-top: 6px;
}

.thread-info {
    flex: 1;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Message Blocks
   -------------------------------------------------------------------------- */
.message-block {
    padding: var(--spacing-md);
    border-radius: 10px;
    margin-bottom: var(--spacing-md);
}

.message-block.patient {
    background: #e6f0ff;
    margin-left: 40px;
}

.message-block.staff {
    background: #fff;
    border: 1px solid #eee;
    margin-right: 40px;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--spacing-xs);
}

.message-sender {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.message-time {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--color-text-muted, #adb5bd);
}

.message-body {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Thread Content Header
   -------------------------------------------------------------------------- */
.thread-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid #eee;
}

.thread-header h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

/* --------------------------------------------------------------------------
   Reply Box
   -------------------------------------------------------------------------- */
.reply-box {
    border-top: 1px solid #eee;
    padding: var(--spacing-md) var(--spacing-lg);
}

.reply-box textarea {
    resize: vertical;
    min-height: 80px;
}

.reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-sm);
}

/* --------------------------------------------------------------------------
   Compose Form
   -------------------------------------------------------------------------- */
.compose-form {
    padding: var(--spacing-lg);
}

.compose-form .login-input {
    margin-bottom: var(--spacing-md);
}

/* --------------------------------------------------------------------------
   Attachment Chips
   -------------------------------------------------------------------------- */
.attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 10px;
    background: var(--color-bg-panel, #f4f6f8);
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.attachment-chip .remove {
    background: none;
    border: none;
    color: var(--color-error, #dc3545);
    cursor: pointer;
    padding: 0 2px;
    font-size: 16px;
    line-height: 1;
}

/* --------------------------------------------------------------------------
   Received Attachment Rows
   -------------------------------------------------------------------------- */
.attachment-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    font-size: 14px;
}

.attachment-row i {
    color: var(--color-text-secondary, #6c757d);
}

.attachment-row a {
    color: var(--color-text-secondary, #6c757d);
    text-decoration: none;
}

.attachment-row a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Paperclip Button
   -------------------------------------------------------------------------- */
.btn-paperclip {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--color-text-secondary, #6c757d);
    cursor: pointer;
}

.btn-paperclip:hover {
    background: var(--color-bg-panel, #f4f6f8);
}

/* --------------------------------------------------------------------------
   Messaging Empty States
   -------------------------------------------------------------------------- */
.messaging-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--color-text-muted, #adb5bd);
}

.messaging-empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary, #6c757d);
}

.messaging-empty-state p {
    font-size: 16px;
    max-width: 300px;
}

/* --------------------------------------------------------------------------
   Messaging Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .messaging-layout {
        align-content: stretch;
        height: auto;
    }

    .messaging-layout > .thread-list-panel,
    .messaging-layout > .thread-content-panel {
        height: auto;
    }

    .messaging-layout .thread-content-panel {
        display: none;
    }

    .messaging-layout.thread-active .thread-list-panel {
        display: none;
    }

    .messaging-layout.thread-active .thread-content-panel {
        display: flex;
    }

    .message-block.patient {
        margin-left: 20px;
    }

    .message-block.staff {
        margin-right: 20px;
    }
}

/* --------------------------------------------------------------------------
   Clinic Hours Display
   -------------------------------------------------------------------------- */
.clinic-hours-toggle {
  margin-left: 8px;
  font-size: 12px;
  color: #3f66a0;
  text-decoration: none;
  cursor: pointer;
}

.clinic-hours-toggle:hover {
  text-decoration: underline;
}

.clinic-hours-full {
  margin-top: 6px;
  overflow-x: auto;
}

.clinic-hours-table {
  display: flex;
  flex-wrap: nowrap;
  font-size: 11px;
  width: 100%;
}

.clinic-hours-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 3px 6px;
  text-align: center;
}

.clinic-hours-day {
  font-weight: 600;
  color: var(--color-text-primary);
  padding-bottom: 3px;
  border-bottom: 1px solid #eee;
  width: 100%;
}

.clinic-hours-time {
  color: var(--color-text-secondary);
  font-weight: 400;
  padding-top: 3px;
}

.clinic-hours-cell.today {
  font-weight: 700;
  background: #f0f5fb;
  border-radius: 4px;
}

.clinic-hours-cell.today .clinic-hours-day,
.clinic-hours-cell.today .clinic-hours-time {
  color: var(--color-text-primary);
  font-weight: 700;
}

@media (max-width: 575px) {
  .clinic-hours-table {
    flex-wrap: wrap;
  }

  .clinic-hours-cell {
    flex: 0 0 100%;
    flex-direction: row;
    justify-content: space-between;
    padding: 4px 8px;
  }

  .clinic-hours-day {
    border-bottom: none;
    padding-bottom: 0;
    width: auto;
  }

  .clinic-hours-time {
    padding-top: 0;
  }
}
