/* ========================================================
   ICU Neuro Clinical & Quality Registry System
   Theme: Soft Mint Clinical + Night Shift Dark Mode
   Responsive: Mobile (iPhone), Tablet (iPad), Desktop (PC)
   ======================================================== */

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

:root {
  --font-body: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Mint Green Clinical Palette */
  --mint-50: #f2fbf7;
  --mint-100: #e3f7ed;
  --mint-200: #c7eedb;
  --mint-300: #9de0c1;
  --mint-400: #6dcca1;
  --mint-500: #42b382;
  --mint-600: #2f9469;
  --mint-700: #277655;
  --mint-800: #235e46;
  --mint-900: #1e4d3b;
  --mint-950: #0f2c21;

  /* App Theme Variables (Light) */
  --bg-main: #f2fbf7;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-header: rgba(255, 255, 255, 0.92);
  --border-card: rgba(199, 238, 219, 0.7);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --sidebar-bg: #ffffff;
  --sidebar-border: #dcf2e7;
}

/* Night Shift Dark Mode Theme */
body.dark {
  --bg-main: #0c1514;
  --bg-card: rgba(18, 30, 28, 0.95);
  --bg-header: rgba(15, 26, 24, 0.95);
  --border-card: rgba(47, 148, 105, 0.25);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --sidebar-bg: #101c1a;
  --sidebar-border: #1e3630;
  background-color: #0a1211 !important;
  color: #e2e8f0 !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(157, 224, 193, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(109, 204, 161, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

/* Glassmorphism Styles */
.glass-header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  box-shadow: 0 4px 20px -2px rgba(39, 118, 85, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
}

body.dark .glass-card {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

/* Sidebar & Navigation */
.app-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #334155;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  user-select: none;
}

body.dark .sidebar-nav-item {
  color: #cbd5e1;
}

.sidebar-nav-item:hover {
  background-color: var(--mint-100);
  color: var(--mint-950);
}

body.dark .sidebar-nav-item:hover {
  background-color: rgba(47, 148, 105, 0.2);
  color: #6dcca1;
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, var(--mint-600), var(--mint-700));
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(39, 118, 85, 0.25);
}

.sidebar-submenu {
  padding-left: 1.5rem;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
}

.sidebar-submenu.collapsed {
  max-height: 0 !important;
  display: none;
}

.rotate-180 {
  transform: rotate(180deg);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--mint-300);
  border-radius: 9999px;
}
body.dark ::-webkit-scrollbar-thumb {
  background: #277655;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--mint-500);
}

/* Activity Stepper Touch Target */
.stepper-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  font-weight: bold;
  font-size: 1.15rem;
  transition: all 0.15s;
  user-select: none;
  touch-action: manipulation;
}

.stepper-btn:active {
  transform: scale(0.92);
}

.stepper-input {
  width: 3.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  padding: 0.25rem 0.1rem;
}

body.dark .stepper-input {
  background-color: #162a26;
  border-color: #277655;
  color: #fff;
}

/* Activity Categories Colors */
.activity-card-resp {
  border-left: 4px solid #0284c7;
  background: rgba(240, 249, 255, 0.7);
}
body.dark .activity-card-resp {
  background: rgba(8, 47, 73, 0.35);
  border-left-color: #38bdf8;
}

.activity-card-monitor {
  border-left: 4px solid #10b981;
  background: rgba(236, 253, 245, 0.7);
}
body.dark .activity-card-monitor {
  background: rgba(6, 78, 59, 0.35);
  border-left-color: #34d399;
}

.activity-card-nursing {
  border-left: 4px solid #f59e0b;
  background: rgba(254, 252, 232, 0.7);
}
body.dark .activity-card-nursing {
  background: rgba(120, 53, 15, 0.35);
  border-left-color: #fbbf24;
}

.activity-card-critical {
  border-left: 4px solid #64748b;
  background: rgba(248, 250, 252, 0.85);
}
body.dark .activity-card-critical {
  background: rgba(30, 41, 59, 0.45);
  border-left-color: #94a3b8;
}

/* Device Risk Alert Badges */
.badge-risk-alert {
  animation: riskPulse 2s infinite;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes riskPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
  }
}

/* Modal Animations */
.modal-overlay {
  animation: fadeIn 0.18s ease-out forwards;
}
.modal-content {
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Sticky Data Tables */
.table-sticky-head th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--mint-100);
}
body.dark .table-sticky-head th {
  background: #17322c;
  color: #e2e8f0;
}

.table-sticky-col {
  position: sticky;
  left: 0;
  z-index: 12;
  background: #ffffff;
}
body.dark .table-sticky-col {
  background: #132226;
  color: #e2e8f0;
}

/* Ward Bed Map Floor Plan Architectural Styles */
.ward-map-container {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.9));
  border: 2px solid #cbd5e1;
}
body.dark .ward-map-container {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border-color: #334155;
}

.ward-room-header {
  border-bottom: 2px dashed #94a3b8;
}

.ward-bed-card {
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}
.ward-bed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.12);
}

.ward-bed-occupied {
  background: linear-gradient(145deg, #ffffff, #f0fdf4);
  border: 2px solid #34d399;
  box-shadow: 0 4px 14px -2px rgba(16, 185, 129, 0.15);
}
body.dark .ward-bed-occupied {
  background: linear-gradient(145deg, #132a22, #0d1e18);
  border-color: #10b981;
}

.ward-bed-vacant {
  background: rgba(255, 255, 255, 0.7);
  border: 2px dashed #cbd5e1;
}
body.dark .ward-bed-vacant {
  background: rgba(30, 41, 59, 0.5);
  border-color: #475569;
}
.ward-bed-vacant:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.ward-pillar {
  background: #e2e8f0;
  border: 2px solid #94a3b8;
}
body.dark .ward-pillar {
  background: #334155;
  border-color: #64748b;
}

.ward-counter {
  background: linear-gradient(180deg, #e0f2fe, #bae6fd);
  border: 2px solid #38bdf8;
}
body.dark .ward-counter {
  background: linear-gradient(180deg, #0c4a6e, #075985);
  border-color: #0284c7;
}

/* Print Stylesheet */
@media print {
  @page {
    size: landscape;
    margin: 8mm;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 8.5pt !important;
  }
  .no-print,
  #headerNav,
  #appSidebar,
  #mobileDrawer,
  .action-buttons,
  .modal-overlay,
  #toastContainer,
  button {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .main-content-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .glass-card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8pt !important;
  }
  th, td {
    border: 1px solid #94a3b8 !important;
    padding: 3px 5px !important;
  }
  thead {
    display: table-header-group;
  }
}
