/* ==============================================================================
   MedRegia Public Portal — Inner Components & Patient Views Styles
   Headers, Searchbars, Tokens, Navbars, Edge Tabs & Directory Cards
   ============================================================================== */

/* ================= 1. PAGE HEADERS ================= */
.page-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header .back {
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
}

.page-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ================= 2. SEARCHBAR ================= */
.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0B1915;
  border-radius: var(--radius);
  padding: 0 12px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 14px;
}

.searchbar input {
  background: transparent;
  border: none;
  outline: none;
  color: #FFFFFF;
  font-size: 13px;
  width: 100%;
  caret-color: #5DCAA5;
}

.searchbar input::placeholder {
  color: #94A3B8;
}

/* ================= 3. TOKENS ================= */
.token-box {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border: 0.5px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
}

.token-box.served {
  background: var(--primary-light);
  border-color: var(--primary-bright);
  color: var(--text);
}

.token-box.mine {
  border: 2px solid var(--highlight);
  background: var(--highlight);
  color: var(--highlight-text);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(194, 24, 91, 0.5);
}

.token-box.missed {
  background: var(--accent-light);
  border-color: var(--accent);
  color: #FF8FA3;
  text-decoration: line-through;
  opacity: .8;
}

.token-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16A34A;
  border: 1.5px solid var(--surface-2);
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ================= 4. BOTTOM NAVIGATION ================= */
.bottom-nav,
.customer-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  height: 62px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 30;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item,
button.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  flex: 1;
  padding: 6px 0;
  font-size: 10.5px;
  transition: all 0.18s ease;
  position: relative;
  background: none;
  border: none;
  font-family: inherit;
  outline: none;
}

.nav-item.active {
  color: var(--primary-bright);
  font-weight: 600;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: var(--primary-bright, #0D9488);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 8px rgba(13, 148, 136, 0.7);
}

.nav-item svg,
.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.nav-item.active svg,
.nav-item.active .nav-icon {
  color: var(--primary-bright);
  filter: drop-shadow(0 0 6px rgba(13, 148, 136, 0.45));
}


.edge-tab.active {
  background: var(--primary-bright, #0D9488);
  color: #FFFFFF;
  border-color: var(--primary-bright, #0D9488);
  box-shadow: -2px 2px 12px rgba(13, 148, 136, 0.5);
}

.doc-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.doc-card:hover {
  border-color: rgba(13, 148, 136, 0.4);
}

.doc-clinic-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
}


/* ================= 5. EDGE TABS (STRICT VERTICAL LAYOUT) ================= */
.edge-tabs {
  position: fixed;
  right: max(0px, calc(50% - 230px));
  bottom: 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 35;
  pointer-events: none;
}

.edge-tab {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 10px 4px;
  background: var(--surface-1);
  color: var(--text);
  border: 0.5px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  width: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  pointer-events: auto;
}

.edge-tab:hover,
.edge-tab:focus {
  background: var(--surface-2);
  color: var(--primary-bright);
}

.edge-tab:active {
  transform: rotate(180deg) scale(0.96);
}

/* ================= 6. FIELD ROWS (PROFILE & SETTINGS) ================= */
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  background: var(--surface-1);
  transition: background 0.15s ease;
}

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

.field-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.field-row:active {
  background: rgba(255, 255, 255, 0.08);
}

.edge-tab.active {
  background: var(--primary-bright) !important;
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  border-color: var(--primary-bright) !important;
  font-weight: 800 !important;
}

.edge-tab-badge {
  display: inline-block;
  background: #EF4444;
  color: white;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
  margin-top: 3px;
  line-height: 1.2;
}

/* ================= 7. WAITING HALL NOTIFICATIONS & REQUESTS ================= */
.notif-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.notif-card.pending {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, var(--surface-1) 100%);
}

.notif-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.notif-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.notif-countdown-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: #D97706;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.notif-card-msg {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 6px 0 12px 0;
  line-height: 1.4;
}

.notif-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.btn-notif-accept {
  width: 100%;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.btn-notif-accept:hover {
  filter: brightness(1.08);
}

.btn-notif-accept:active {
  transform: scale(0.98);
}

.badge-notif-accepted {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-notif-expired {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

/* ================= 9. UNIVERSAL TOP HEADER ================= */
.universal-header {
  height: 68px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 0.5px solid var(--border);
}

.universal-header-inner {
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.universal-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0F6E56;
  border: 1.5px solid #5DCAA5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #FFFFFF;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.universal-avatar:hover {
  transform: scale(1.05);
}

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

.universal-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.universal-patient-id {
  font-size: 11.5px;
  color: var(--primary-bright);
  margin: 2px 0 0 0;
  font-weight: 500;
}

.universal-bell {
  color: var(--text-muted);
  cursor: pointer;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.universal-bell:hover {
  color: var(--text);
}

/* Sub-back bar for nested views */
.sub-back-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-bright);
  cursor: pointer;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
}

.sub-back-bar:hover {
  background: var(--surface-2);
}

/* ================= STICKY CLINIC SUB-HEADER BAR ================= */
.sticky-clinic-subbar {
  position: sticky;
  top: 68px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0B1914;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.sticky-clinic-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #5DCAA5;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sticky-clinic-back-btn:hover {
  background: rgba(93, 202, 165, 0.12);
  border-color: rgba(93, 202, 165, 0.3);
}

.sticky-clinic-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 58%;
}

.sticky-clinic-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.sticky-clinic-badge {
  font-size: 10px;
  font-weight: 700;
  color: #5DCAA5;
  background: rgba(93, 202, 165, 0.12);
  border: 1px solid rgba(93, 202, 165, 0.28);
  border-radius: 6px;
  padding: 3px 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ================= 8. PWA INSTALL BANNER ================= */
.pwa-install-banner {
  position: fixed;
  bottom: 68px;
  left: 12px;
  right: 12px;
  max-width: 440px;
  margin: 0 auto;
  z-index: 9999;
  background: rgba(4, 52, 44, 0.95);
  border: 1px solid rgba(93, 202, 165, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: slideUpPwa 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpPwa {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pwa-install-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.pwa-install-text {
  min-width: 0;
}

.pwa-install-title {
  font-size: 13px;
  font-weight: 700;
  color: #ECEEEC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-desc {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-btn {
  background: linear-gradient(135deg, #0F6E56, #5DCAA5);
  color: #04241E;
  font-weight: 700;
  font-size: 12px;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  filter: brightness(1.1);
}

.pwa-install-btn:active {
  transform: scale(0.96);
}

.pwa-dismiss-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.15s ease;
}

.pwa-dismiss-btn:hover {
  color: var(--text);
}

/* Patient Selector Modal Flat List UI */
.patient-group-header {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 10px 0 4px 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.patient-group-header:first-child {
  margin-top: 2px;
}

.patient-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.patient-card:hover {
  border-color: var(--primary-bright);
  background: rgba(93, 202, 165, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.patient-card:active {
  transform: scale(0.985);
}

.patient-card-booked {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
  cursor: not-allowed;
}

.patient-card-booked:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(239, 68, 68, 0.4);
}

.patient-card-booked:active {
  transform: none;
}




.btn-primary {
  background: linear-gradient(135deg, #0F6E56 0%, #0D9488 100%) !important;
  color: #FFFFFF !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(15, 110, 86, 0.35);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #128266 0%, #10A396 100%) !important;
  color: #FFFFFF !important;
}
.btn-primary:active {
  transform: scale(0.98);
}
