/* ==========================================================================
   MedFlow — Smart Hospital Medication Delivery & Adherence Platform
   Styles & Print Media Rules
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sarabun:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary-med: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --accent-teal: #0d9488;
  --status-emergency: #e11d48;
  --status-warning: #f59e0b;
  --status-success: #10b981;
}

html, body {
  font-family: 'Prompt', 'Sarabun', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ป้องกัน iOS ซูมตอนคลิกกล่องข้อความ */
input, select, textarea {
  font-size: 16px !important;
}
@media (min-width: 640px) {
  input, select, textarea {
    font-size: 0.875rem !important;
  }
}

/* Typography สำหรับผู้สูงอายุ (Elderly-Friendly & High Contrast) */
.elderly-text-lg {
  font-size: 1.25rem !important;
  line-height: 1.75rem !important;
  font-weight: 600 !important;
}

.elderly-text-xl {
  font-size: 1.5rem !important;
  line-height: 2rem !important;
  font-weight: 700 !important;
}

.elderly-high-contrast {
  color: #0f172a !important;
  font-weight: 600 !important;
}

/* แถบไฟสถานะฉุกเฉินกะพริบอย่างสุภาพ */
@keyframes emergency-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
    border-color: #e11d48;
  }
  50% {
    box-shadow: 0 0 15px 4px rgba(225, 29, 72, 0.6);
    border-color: #f43f5e;
  }
}

.glow-emergency {
  animation: emergency-glow 1.8s infinite ease-in-out;
}

/* แอนิเมชันสำหรับหุ่นยนต์กำลังเคลื่อนที่ */
@keyframes robot-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

.robot-moving-indicator {
  animation: robot-pulse 1.5s infinite ease-in-out;
}

/* สลิปยาอัจฉริยะ (Smart Med-Slip & Thermal Label) */
.thermal-slip {
  width: 80mm;
  min-height: 120mm;
  background-color: #ffffff;
  color: #000000;
  font-family: 'Sarabun', 'Prompt', sans-serif;
  padding: 16px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  position: relative;
}

/* รอยปรุฉีกสลิป (Receipt Tear Edge) */
.thermal-slip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: radial-gradient(circle, transparent, transparent 50%, #ffffff 50%, #ffffff 100% ) repeat-x;
  background-size: 12px 12px;
}

/* กฎการพิมพ์ (Print CSS) สำหรับส่งออกเป็นใบสลิปจริงหรือบันทึกเป็น PDF */
@media print {
  body * {
    visibility: hidden;
  }
  #thermalSlipModal, #thermalSlipModal * {
    visibility: visible;
  }
  #thermalSlipModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .no-print {
    display: none !important;
  }
  .thermal-slip {
    box-shadow: none !important;
    border: none !important;
    width: 80mm !important;
    margin: 0 auto !important;
    padding: 8px !important;
  }
}

/* สไตล์เฟรมมือถือสำหรับจำลองหน้าจอคนไข้ (Patient Mobile Portal Preview) */
.mobile-device-frame {
  max-width: 420px;
  border-radius: 40px;
  border: 12px solid #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background: #ffffff;
  margin: 0 auto;
}

.mobile-notch {
  width: 140px;
  height: 24px;
  background: #1e293b;
  margin: 0 auto;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

/* แถบสแกนเลเซอร์จำลอง (Laser Scanner Simulation Bar) */
@keyframes laser-sweep {
  0% { top: 10%; opacity: 0.2; }
  50% { top: 90%; opacity: 0.9; }
  100% { top: 10%; opacity: 0.2; }
}

.scanner-laser {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ef4444, #f87171, #ef4444, transparent);
  box-shadow: 0 0 12px 2px #ef4444;
  animation: laser-sweep 2s infinite ease-in-out;
}

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