/* ═══════════════════════════════════════════════════
   UI POLISH — Patient cards, Toasts, Today, PDF
   ═══════════════════════════════════════════════════ */

/* ── 1. PATIENT CARDS — Premium redesign ── */
#patients-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 16px !important;
  padding: 24px !important;
}

.patient-card {
  background: linear-gradient(160deg, rgba(20,28,45,0.95), rgba(14,20,34,0.98)) !important;
  border: 1px solid rgba(127,157,209,0.1) !important;
  border-radius: 20px !important;
  padding: 24px !important;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1) !important;
  position: relative;
  overflow: hidden;
}
.patient-card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,0.2), transparent);
}
.patient-card:hover {
  border-color: rgba(96,165,250,0.2) !important;
  transform: translateY(-4px) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2), 0 0 0 1px rgba(96,165,250,0.08) !important;
}

.pc-avatar {
  width: 56px !important;
  height: 56px !important;
  border-radius: 16px !important;
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.pc-name {
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

.pc-meta {
  font-size: 0.76rem !important;
  color: rgba(148,163,184,0.5) !important;
}

.pc-stats {
  margin-top: 16px !important;
  padding-top: 14px !important;
  border-top: 1px solid rgba(255,255,255,0.04) !important;
  gap: 8px !important;
}

.pc-stat {
  font-size: 0.8rem !important;
  padding: 6px 0 !important;
}

.pc-stat-dot {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  box-shadow: 0 0 6px currentColor;
}

.pc-badges {
  margin-top: 14px !important;
  gap: 8px !important;
}

.pc-badge {
  font-size: 0.72rem !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
}

.add-patient-card {
  background: rgba(255,255,255,0.02) !important;
  border: 2px dashed rgba(127,157,209,0.12) !important;
  border-radius: 20px !important;
  min-height: 160px !important;
  transition: all 0.3s !important;
}
.add-patient-card:hover {
  border-color: rgba(96,165,250,0.3) !important;
  background: rgba(96,165,250,0.04) !important;
}
.apc-icon {
  font-size: 2rem !important;
  opacity: 0.5;
}

/* Light theme */
[data-theme="light"] .patient-card {
  background: linear-gradient(160deg, #fff, #f8fafc) !important;
  border-color: rgba(0,0,0,0.06) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04) !important;
}
[data-theme="light"] .patient-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.08) !important;
}


/* ── 2. TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
  width: calc(100vw - 32px);
  pointer-events: none;
}
[dir="rtl"] .toast-container {
  right: auto;
  left: 16px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: all;
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
[dir="rtl"] .toast {
  transform: translateX(-40px);
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast.hide {
  opacity: 0;
  transform: translateX(40px) scale(0.95);
}
[dir="rtl"] .toast.hide {
  transform: translateX(-40px) scale(0.95);
}

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Types */
.toast-success { border-color: rgba(34,197,94,0.15); }
.toast-success .toast-icon { background: rgba(34,197,94,0.15); color: #4ade80; }

.toast-error { border-color: rgba(239,68,68,0.15); }
.toast-error .toast-icon { background: rgba(239,68,68,0.15); color: #f87171; }

.toast-warning { border-color: rgba(245,158,11,0.15); }
.toast-warning .toast-icon { background: rgba(245,158,11,0.15); color: #fbbf24; }

.toast-info { border-color: rgba(59,130,246,0.15); }
.toast-info .toast-icon { background: rgba(59,130,246,0.15); color: #60a5fa; }

.toast-msg { flex: 1; min-width: 0; }

.toast-close {
  background: none;
  border: none;
  color: rgba(148,163,184,0.4);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.2s;
}
.toast-close:hover { color: rgba(148,163,184,0.8); }

/* Light theme */
[data-theme="light"] .toast {
  background: rgba(255,255,255,0.95);
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  color: #1e293b;
}

/* Mobile */
@media (max-width: 480px) {
  .toast-container {
    top: auto;
    bottom: 70px;
    right: 8px;
    left: 8px;
    max-width: none;
    width: auto;
  }
  [dir="rtl"] .toast-container {
    right: 8px;
    left: 8px;
  }
}


/* ── 3. TODAY SUMMARY — Premium polish ── */
.today-card {
  background: linear-gradient(160deg, rgba(20,28,45,0.95), rgba(14,20,34,0.98)) !important;
  border: 1px solid rgba(127,157,209,0.08) !important;
  border-radius: 20px !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.02) !important;
  overflow: hidden !important;
  transition: all 0.3s !important;
}
.today-card:hover {
  border-color: rgba(127,157,209,0.14) !important;
}

.today-card-head {
  padding: 16px 20px !important;
  border-bottom: 1px solid rgba(255,255,255,0.04) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.today-card-title {
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

.today-pill {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  padding: 4px 12px !important;
  border-radius: 8px !important;
}

.today-list {
  padding: 8px 12px !important;
}

.today-row {
  padding: 10px 8px !important;
  border-bottom: 1px solid rgba(255,255,255,0.03) !important;
  border-radius: 8px !important;
  transition: background 0.2s !important;
}
.today-row:hover {
  background: rgba(255,255,255,0.02) !important;
}
.today-row:last-child {
  border-bottom: none !important;
}

.today-value {
  font-family: var(--mono) !important;
  font-weight: 800 !important;
  font-size: 0.88rem !important;
}
.today-value.ok { color: var(--green) !important; }
.today-value.warn { color: #fbbf24 !important; }

/* Quick actions buttons */
.today-actions {
  padding: 12px 16px !important;
}
.today-actions button {
  border-radius: 12px !important;
  transition: all 0.25s !important;
}
.today-actions button:hover {
  transform: translateY(-1px) !important;
}

/* Therapy updates card */
.therapy-updates-card {
  border-radius: 20px !important;
}

/* Light theme */
[data-theme="light"] .today-card {
  background: linear-gradient(160deg, #fff, #f8fafc) !important;
  border-color: rgba(0,0,0,0.05) !important;
}


/* ── 4. PDF BUTTON — Direct download feel ── */
#system-pdf-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s !important;
}
#system-pdf-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
#system-pdf-btn::after {
  content: '📄';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.3;
}

/* Print button in report tab */
.btn-print-report {
  border-radius: 14px !important;
  padding: 12px 24px !important;
  font-weight: 700 !important;
  transition: all 0.25s !important;
}
.btn-print-report:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
}
