/* أنماط نظام المختبرات الطبية Rafeef Lab */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Cairo:wght@400;600;700;800;900&display=swap');

:root {
  --font-arabic: 'Tajawal', 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --accent-cyan: #06b6d4;
  --accent-blue: #2563eb;
  --surface-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  background-color: var(--surface-bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Glassmorphism & UI Accents */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.medical-gradient {
  background: linear-gradient(135deg, #059669 0%, #0d9488 50%, #0284c7 100%);
}

.medical-header-gradient {
  background: linear-gradient(90deg, #064e3b 0%, #065f46 50%, #047857 100%);
}

.subtle-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
}

/* Pulse animation for critical results and urgent samples */
@keyframes urgent-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.badge-urgent-pulse {
  animation: urgent-pulse 1.8s infinite;
}

/* Barcode visual styling simulation */
.barcode-visual {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 3px;
  background: #fff;
  padding: 8px 12px;
  display: inline-block;
  border: 1px dashed #94a3b8;
  border-radius: 4px;
}

.barcode-lines {
  height: 38px;
  background-image: repeating-linear-gradient(
    90deg,
    #000 0px,
    #000 2px,
    transparent 2px,
    transparent 4px,
    #000 4px,
    #000 7px,
    transparent 7px,
    transparent 9px,
    #000 9px,
    #000 10px,
    transparent 10px,
    transparent 13px
  );
  width: 100%;
}

/* Modal Backdrops */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* --- الختم الرسمي الدائري الطبي والتوقيع الإلكتروني --- */
.medical-official-stamp {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid #1e3a8a;
  color: #1e3a8a;
  text-align: center;
  user-select: none;
  background: #ffffff;
  box-sizing: border-box;
  padding: 6px;
}

.signature-drawing-canvas {
  touch-action: none;
  cursor: crosshair;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
}

/* شارة المطوّر في الوسط — مثل نظام براءة الذمة */
.dev-footer {
  width: 100%;
  text-align: center;
  padding: 28px 20px 28px;
  margin-top: auto;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .dev-footer {
    padding-bottom: 96px;
  }
}

.dev-footer-badge,
.dev-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 22px;
  background: linear-gradient(135deg, #047857 0%, #059669 55%, #0d9488 100%);
  color: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
  transition: all 0.25s;
  white-space: nowrap;
  font-family: 'Tajawal', sans-serif;
  opacity: 0.95;
  cursor: pointer;
}

.dev-badge {
  margin-top: 10px;
  padding: 7px 16px;
  opacity: 1;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
}

.dev-footer-badge:hover,
.dev-badge:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: white;
}

.dev-badge-pulse {
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  animation: devBadgePulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes devBadgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.login-copyright {
  margin-top: 20px;
  text-align: center;
  border-top: 1px solid #edf2f7;
  padding-top: 18px;
}

.login-copyright p {
  font-size: 13px;
  color: #718096;
}

#copyright-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ecfdf5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#copyright-overlay.is-open,
#copyright-overlay.is-open[hidden] {
  display: block !important;
}

.cp-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  min-height: 0;
}

.cp-brand-side {
  flex: 1;
  background: linear-gradient(145deg, #064e3b 0%, #047857 48%, #0d9488 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 48px 40px;
}

.cp-brand-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 55%);
}

.cp-floating-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cp-shape {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  animation: cpFloatShape 15s ease-in-out infinite;
}

.cp-shape:nth-child(1) { width: 120px; height: 120px; top: 8%; left: 12%; }
.cp-shape:nth-child(2) { width: 80px; height: 80px; top: 65%; left: 70%; animation-delay: 2s; }
.cp-shape:nth-child(3) { width: 55px; height: 55px; top: 38%; left: 5%; animation-delay: 4s; }
.cp-shape:nth-child(4) { width: 95px; height: 95px; top: 80%; left: 22%; animation-delay: 6s; }

@keyframes cpFloatShape {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  50% { transform: translateY(-25px) rotate(180deg); opacity: 0.85; }
}

.cp-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 420px;
  width: 100%;
}

.cp-logo-wrap {
  width: 88%;
  max-width: 380px;
  margin: 0 auto 28px;
  background: transparent;
  border: none;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.cp-logo-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.cp-brand-subtitle {
  font-size: 14px;
  opacity: 0.82;
  line-height: 1.7;
  margin-bottom: 28px;
}

.cp-brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cp-feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 13px 18px;
  text-align: right;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cp-feature-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #fbbf24;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.45));
}

.cp-feature-item span {
  font-size: 14px;
  font-weight: 500;
}

.cp-info-side {
  width: 480px;
  min-width: 380px;
  min-height: 0;
  background: #ecfdf5;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 28px 44px 24px;
  overflow-y: auto;
}

.cp-info-side h2 {
  font-size: 26px;
  font-weight: 800;
  color: #2d3748;
  text-align: center;
  margin-bottom: 10px;
}

.cp-info-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #ecfdf5, #ccfbf1);
  border: 1.5px solid #a7f3d0;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  color: #047857;
}

.cp-info-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.cp-info-divider::before,
.cp-info-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.cp-info-divider span {
  font-size: 12px;
  color: #a0aec0;
  white-space: nowrap;
}

.cp-info-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #d1fae5;
  box-shadow: 0 4px 18px rgba(5, 150, 105, 0.08);
  overflow: hidden;
  margin-bottom: 20px;
}

.cp-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f2f8;
  gap: 12px;
}

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

.cp-info-label {
  font-size: 13px;
  color: #718096;
  font-weight: 600;
  white-space: nowrap;
}

.cp-info-value {
  font-size: 14px;
  color: #2d3748;
  font-weight: 700;
  text-align: left;
  direction: ltr;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cp-info-value.ar {
  direction: rtl;
  text-align: right;
}

@media (max-width: 420px) {
  .cp-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .cp-info-value,
  .cp-info-value.ar {
    text-align: right;
    width: 100%;
  }
}

.cp-info-value a {
  color: #059669;
  text-decoration: none;
  font-weight: 700;
}

.cp-info-value a:hover {
  color: #047857;
  text-decoration: underline;
}

.cp-btn-system {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, #059669, #0d9488);
  border: none;
  border-radius: 13px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
  margin-bottom: 16px;
  font-family: inherit;
}

.cp-btn-system:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(5, 150, 105, 0.5);
  color: white;
}

.cp-info-footer {
  margin-top: 8px;
  text-align: center;
  border-top: 1px solid #edf2f7;
  padding-top: 16px;
}

.cp-info-footer p {
  font-size: 12px;
  color: #a0aec0;
}

@media (max-width: 900px) {
  .cp-wrapper {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .cp-brand-side {
    padding: 36px 24px;
    min-height: 42vh;
  }
  .cp-info-side {
    width: 100%;
    min-width: unset;
    padding: 32px 24px 40px;
  }
  .cp-logo-wrap {
    width: 55%;
    max-width: 200px;
  }
}

/* --- أنماط الطباعة المخصصة (Print Stylesheets) --- */
@media print {
  /* إخفاء عناصر واجهة المستخدم أثناء الطباعة */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  
  .no-print,
  #app-sidebar,
  #app-header,
  #app-mobile-nav,
  #dev-copyright-footer,
  #copyright-overlay,
  .toast-container,
  button:not(.allow-print) {
    display: none !important;
  }

  /* إظهار ورقة التقرير فقط عند الطباعة */
  .printable-report-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    margin: 0 !important;
    padding: 10mm !important;
    background: white !important;
    box-shadow: none !important;
  }

  .print-page-break {
    page-break-after: always;
  }

  /* ستيكر الباركود لأنابيب الدم (2x1 إنش) */
  .tube-barcode-print {
    width: 50mm !important;
    height: 25mm !important;
    padding: 2mm !important;
    page-break-inside: avoid;
    display: block !important;
  }
}

