/* SANCTUARI - Material Design 3 Custom Styles */

:root {
  --md-sys-color-primary: #1976d2;
  --md-sys-color-secondary: #009688;
  --md-sys-color-error: #f44336;
  --md-sys-color-warning: #ffc107;
  --md-sys-color-success: #4caf50;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-background: #fafafa;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-on-surface: #1c1b1f;
  
  /* Triage Colors */
  --triage-green: #4caf50;
  --triage-yellow: #ffc107;
  --triage-red: #f44336;
  
  /* Shadows */
  --md-sys-elevation-1: 0 1px 3px rgba(0,0,0,0.12);
  --md-sys-elevation-2: 0 2px 6px rgba(0,0,0,0.16);
  --md-sys-elevation-3: 0 4px 12px rgba(0,0,0,0.20);
  
  /* Border Radius */
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
}

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

body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Material Symbols Icons */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 28px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* Larger icons for better touch */
button .material-symbols-outlined,
.touch-target .material-symbols-outlined {
  font-size: 32px;
}

.nav-rail-item .material-symbols-outlined {
  font-size: 28px;
}

/* Touch Target Size - Minimum 48dp */
button, .btn, .touch-target {
  min-height: 48px;
  min-width: 48px;
  touch-action: manipulation;
}

/* Material Design 3 Button Styles */
.md-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-transform: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  outline: none;
  min-height: 48px;
}

.md-button-filled {
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, #1565c0 100%);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.md-button-filled:hover {
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.4);
  transform: translateY(-2px);
}

.md-button-filled:active {
  transform: translateY(0);
}

.md-button-outlined {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border: 2px solid var(--md-sys-color-primary);
  border-radius: 24px;
}

.md-button-outlined:hover {
  background-color: rgba(25, 118, 210, 0.08);
  border-width: 2px;
}

.md-button-text {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border-radius: 24px;
}

.md-button-text:hover {
  background-color: rgba(25, 118, 210, 0.08);
}

/* Material Design 3 Card */
.md-card {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-1);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.md-card:hover {
  box-shadow: var(--md-sys-elevation-2);
}

/* Material Design 3 Chip */
.md-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
}

.md-chip:hover {
  background-color: #c8e6c9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.md-chip.active {
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, #1565c0 100%);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
  border-color: var(--md-sys-color-primary);
}

.dark .md-chip {
  background-color: #2d3d2d;
  color: #90ee90;
}

.dark .md-chip:hover {
  background-color: #3d4d3d;
}

/* Triage Status Badges */
.triage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.triage-green {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.triage-yellow {
  background-color: #fff9c4;
  color: #f57f17;
}

.triage-red {
  background-color: #ffebee;
  color: #c62828;
}

/* Vital Signs Display */
.vital-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-left: 4px solid var(--md-sys-color-primary);
}

.vital-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: #1c1b1f;
}

.vital-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-top: 4px;
}

.vital-unit {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  margin-left: 4px;
}

/* Alert Status */
.alert-critical {
  border-left-color: var(--md-sys-color-error);
}

.alert-high {
  border-left-color: var(--md-sys-color-warning);
}

.alert-medium {
  border-left-color: var(--md-sys-color-secondary);
}

/* Navigation Rail for Tablet */
.nav-rail {
  width: 96px;
  background-color: var(--md-sys-color-surface);
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.dark .nav-rail {
  background-color: #1e1e1e;
  border-right-color: #3d3d3d;
}

.nav-rail-item {
  width: 72px;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 6px 0;
  position: relative;
}

.nav-rail-item:hover {
  background-color: rgba(25, 118, 210, 0.12);
  transform: scale(1.05);
}

.nav-rail-item.active {
  background-color: rgba(25, 118, 210, 0.18);
}

.nav-rail-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  background-color: var(--md-sys-color-primary);
  border-radius: 0 4px 4px 0;
}

.nav-rail-label {
  font-size: 11px;
  margin-top: 4px;
  color: #666;
  font-weight: 500;
}

.dark .nav-rail-label {
  color: #a0a0a0;
}

.nav-rail-item.active .nav-rail-label {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

/* FAB - Floating Action Button */
.md-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background-color: var(--md-sys-color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.24);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 50;
}

.md-fab:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.32);
  transform: scale(1.05);
}

/* Modal/Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: var(--md-sys-shape-corner-large);
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24);
  animation: slideUp 0.3s ease;
}

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

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.16);
  z-index: 1000;
  animation: slideUpBottom 0.3s ease;
}

@keyframes slideUpBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Tabs */
.md-tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.md-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.md-tab:hover {
  background-color: rgba(25, 118, 210, 0.04);
}

.md-tab.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

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

/* IoT Connection Indicator */
.iot-indicator {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.iot-connected {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.iot-disconnected {
  background-color: #ffebee;
  color: #c62828;
}

.iot-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Responsive - Tablet optimized (1280x800) */
@media (min-width: 768px) {
  .container-tablet {
    max-width: 1280px;
    margin: 0 auto;
  }
  
  .grid-tablet {
    display: grid;
    grid-template-columns: 80px 1fr 320px;
    gap: 16px;
  }
}

/* Dark Mode Support */
.dark {
  --md-sys-color-surface: #1e1e1e;
  --md-sys-color-background: #121212;
  --md-sys-color-on-surface: #e6e1e5;
}

.dark body {
  background-color: #121212;
  color: #e6e1e5;
}

.dark .bg-gray-50 {
  background-color: #1e1e1e !important;
}

.dark .bg-white {
  background-color: #2d2d2d !important;
}

.dark .bg-gray-100 {
  background-color: #2d2d2d !important;
}

.dark .text-gray-900 {
  color: #e6e1e5 !important;
}

.dark .text-gray-800 {
  color: #d0d0d0 !important;
}

.dark .text-gray-700 {
  color: #b8b8b8 !important;
}

.dark .text-gray-600 {
  color: #a0a0a0 !important;
}

.dark .text-gray-500 {
  color: #888888 !important;
}

.dark .border-gray-200 {
  border-color: #3d3d3d !important;
}

.dark .border-gray-300 {
  border-color: #4d4d4d !important;
}

.dark .md-card {
  background-color: #2d2d2d !important;
  color: #e6e1e5;
}

.dark .hover\:bg-gray-50:hover {
  background-color: #3d3d3d !important;
}

.dark .hover\:bg-gray-100:hover {
  background-color: #3d3d3d !important;
}

.dark input {
  background-color: #2d2d2d !important;
  color: #e6e1e5 !important;
  border-color: #4d4d4d !important;
}

.dark textarea {
  background-color: #2d2d2d !important;
  color: #e6e1e5 !important;
  border-color: #4d4d4d !important;
}

.dark select {
  background-color: #2d2d2d !important;
  color: #e6e1e5 !important;
  border-color: #4d4d4d !important;
}

/* Accessibility - Focus Indicators */
*:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-in-right {
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
