/* MediAI Enterprise - Custom Styles */
/* Extends Tailwind CSS with glassmorphism, animations, and medical UI components */

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

:root {
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --surface-800: #1e293b;
  --surface-900: #0f172a;
  --glass-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(51, 65, 85, 0.5);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.4); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.7); }

/* ─── Glassmorphism ─────────────────────────────────────────────────────────── */
.glass {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

.glass-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ─── Gradients ─────────────────────────────────────────────────────────────── */
.bg-gradient-radial {
  background: radial-gradient(circle, var(--tw-gradient-from), var(--tw-gradient-to, transparent));
}

.gradient-brand {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.gradient-medical {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #8b5cf6 100%);
}

/* ─── Animated Cards ────────────────────────────────────────────────────────── */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* ─── Skeleton Loaders ──────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(51,65,85,0.6) 25%, rgba(71,85,105,0.8) 50%, rgba(51,65,85,0.6) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Toast Notifications ──────────────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  border: 1px solid;
  font-size: 0.8125rem;
  font-weight: 500;
  pointer-events: all;
  min-width: 240px;
  max-width: 380px;
  animation: toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
}

.toast.success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: #6ee7b7; }
.toast.error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.4);  color: #fca5a5; }
.toast.warning { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.4); color: #fcd34d; }
.toast.info    { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); color: #93c5fd; }

@keyframes toast-in {
  from { transform: translateX(120%) scale(0.95); opacity: 0; }
  to   { transform: translateX(0) scale(1);       opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0) scale(1);   opacity: 1; }
  to   { transform: translateX(120%) scale(0.95); opacity: 0; }
}

.toast.removing { animation: toast-out 0.25s ease forwards; }

/* ─── Message Animation ─────────────────────────────────────────────────────── */
.message-enter {
  animation: msg-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Prose Styles (AI analysis output) ────────────────────────────────────── */
.prose-medical h1, .prose-medical h2, .prose-medical h3 {
  color: #f1f5f9;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.prose-medical h1 { font-size: 1.125rem; }
.prose-medical h2 { font-size: 1rem; border-bottom: 1px solid rgba(51,65,85,0.6); padding-bottom: 0.25rem; }
.prose-medical h3 { font-size: 0.9rem; color: #93c5fd; }
.prose-medical p  { margin-bottom: 0.75rem; color: #cbd5e1; line-height: 1.7; }
.prose-medical ul, .prose-medical ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.prose-medical li { margin-bottom: 0.25rem; color: #cbd5e1; }
.prose-medical strong { color: #f1f5f9; font-weight: 600; }
.prose-medical em { color: #94a3b8; font-style: italic; }
.prose-medical code {
  background: rgba(51,65,85,0.6);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.8rem;
  color: #93c5fd;
  font-family: 'Fira Code', 'JetBrains Mono', monospace;
}
.prose-medical pre {
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(51,65,85,0.5);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}
.prose-medical blockquote {
  border-left: 3px solid #3b82f6;
  padding-left: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  margin: 0.75rem 0;
}
.prose-medical hr {
  border-color: rgba(51,65,85,0.5);
  margin: 1rem 0;
}
.prose-medical table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.8rem; }
.prose-medical th { background: rgba(51,65,85,0.5); color: #e2e8f0; padding: 6px 12px; text-align: left; font-weight: 600; }
.prose-medical td { border-top: 1px solid rgba(51,65,85,0.4); padding: 6px 12px; color: #cbd5e1; }

/* ─── Drag and Drop ─────────────────────────────────────────────────────────── */
.drag-over {
  border-color: #3b82f6 !important;
  background: rgba(59,130,246,0.05) !important;
}

/* ─── Loading States ────────────────────────────────────────────────────────── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(59,130,246,0.3); }
  50%       { box-shadow: 0 0 25px rgba(59,130,246,0.6); }
}
.glow-pulse { animation: pulse-glow 2s infinite; }

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar { width: 3px; }

/* ─── Page Transitions ──────────────────────────────────────────────────────── */
body { animation: page-in 0.2s ease; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive Table ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .overflow-x-auto table { font-size: 0.8125rem; }
}

/* ─── Chart Container ───────────────────────────────────────────────────────── */
canvas { max-width: 100% !important; }

/* ─── Button Loading ────────────────────────────────────────────────────────── */
button:disabled { cursor: not-allowed; }

/* ─── Focus visible ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(59,130,246,0.6);
  outline-offset: 2px;
}

/* ─── Search highlight ──────────────────────────────────────────────────────── */
mark {
  background: rgba(59,130,246,0.25);
  color: #93c5fd;
  border-radius: 2px;
  padding: 0 2px;
}
