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

:root {
  /* Colors */
  --bg-color: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-glass: rgba(17, 24, 39, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-active: rgba(59, 130, 246, 0.4);
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-glow: rgba(59, 130, 246, 0.35);
  
  --secondary: #8b5cf6;
  --secondary-glow: rgba(139, 92, 246, 0.25);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.25);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.35);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Font Families */
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Global Layout Header */
header {
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 2rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.logo-text h1 {
  font-size: 1.5rem;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Simulator Switcher Panel */
.simulator-panel {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  padding: 0.35rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.simulator-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 0.75rem;
}

.profile-select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.profile-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Main Layout */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Banner Notificación Push Simulada */
.notification-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 5px solid var(--danger);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.notification-banner.hidden {
  display: none !important;
}
.notification-banner .content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.notification-banner .icon {
  color: var(--danger);
  font-size: 1.5rem;
  animation: pulseDanger 1.5s infinite;
}
.notification-banner .title {
  font-weight: 600;
  color: var(--text-primary);
}
.notification-banner .msg {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.notification-banner .close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition-fast);
}
.notification-banner .close-btn:hover {
  color: var(--text-primary);
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 1.75rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: var(--border-color-active);
  box-shadow: 0 12px 40px 0 rgba(59, 130, 246, 0.08);
  transform: translateY(-2px);
}

/* User Identity Header Card */
.user-info-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid var(--border-color);
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.user-name-role h2 {
  font-size: 1.5rem;
}

.user-name-role p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.postop-badge {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid var(--primary-glow);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-family: var(--font-display);
  font-weight: 600;
  color: #93c5fd;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Navigation Tabs */
.tabs-navigation {
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary-glow);
}

/* Views Panes */
.view-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view-pane.active {
  display: block;
}

/* Grid Layouts */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Nutritional Plan Widget */
.diet-widget {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.diet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.stage-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--success-glow);
  color: #34d399;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.diet-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .diet-details {
    grid-template-columns: 1fr;
  }
}

.diet-detail-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 16px;
}

.diet-detail-item h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.diet-detail-item p {
  font-size: 0.95rem;
  line-height: 1.5;
}

.gold-recommendation {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.02) 100%);
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 1.25rem;
  border-radius: 18px;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.gold-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.gold-text h4 {
  color: #fbbf24;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.gold-text p {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-primary);
}

/* Water tracker styles */
.water-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.water-visualizer {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.4);
  border: 5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0 4px 15px rgba(0,0,0,0.4);
}

.water-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(37, 99, 235, 0.7), rgba(96, 165, 250, 0.5));
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.water-text {
  position: relative;
  z-index: 2;
}

.water-text .qty {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.water-text .meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.water-controls {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.water-btn {
  flex: 1;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary-glow);
  color: var(--primary-hover);
  padding: 0.65rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.water-btn:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 12px var(--primary-glow);
}

.water-btn-reset {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.65rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.water-btn-reset:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

/* Button UI */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(30, 41, 59, 0.2);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.6);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-input[readonly] {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.checkbox-card {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.checkbox-card:hover {
  background: rgba(30, 41, 59, 0.5);
  border-color: var(--border-color-active);
}

.checkbox-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-card span {
  font-size: 0.9rem;
  font-weight: 500;
}

.checkbox-card.danger-checked {
  border-color: rgba(239, 68, 68, 0.2);
}
.checkbox-card.danger-checked:hover {
  border-color: rgba(239, 68, 68, 0.5);
}
.checkbox-card.danger-checked input {
  accent-color: var(--danger);
}

/* Patient Progress Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primary);
}

.stat-card.stat-ewl::before {
  background: var(--secondary);
}

.stat-card.stat-loss::before {
  background: var(--success);
}

.stat-card h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.stat-card .val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-card .unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 0.15rem;
}

/* SVG Chart */
.chart-container {
  position: relative;
  background: rgba(30, 41, 59, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
}

.chart-svg {
  width: 100%;
  height: 280px;
}

.chart-tooltip {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Accordion Guides */
.guide-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition-smooth);
}

.accordion-item.active-week {
  border-color: var(--primary-glow);
  background: rgba(59, 130, 246, 0.03);
}

.accordion-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accordion-header h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.accordion-badge {
  background: var(--primary-glow);
  color: #60a5fa;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.accordion-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.accordion-item.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 0 solid var(--border-color);
}

.accordion-item.open .accordion-content {
  max-height: 500px; /* Suficiente para el contenido */
  border-top: 1px solid var(--border-color);
}

.guide-details-grid {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .guide-details-grid {
    grid-template-columns: 1fr;
  }
}

.guide-card-content h4 {
  color: #60a5fa;
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-card-content p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.guide-card-content ul {
  padding-left: 1.25rem;
}

.guide-card-content li {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* User Profile Setup Tab */
.profile-setup-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .profile-setup-grid {
    grid-template-columns: 1fr;
  }
}

.live-calculations-panel {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.calc-value {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.calc-value.highlight-blue {
  color: #60a5fa;
}
.calc-value.highlight-green {
  color: #34d399;
}
.calc-value.highlight-purple {
  color: #c084fc;
}

/* Doctor Views Dashboard */
.doctor-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .doctor-summary-row {
    grid-template-columns: 1fr;
  }
}

.doc-summary-card {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.doc-summary-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.doc-summary-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.doc-summary-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.doc-summary-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.doc-summary-info h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.doc-summary-info .num {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.doctor-layout-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .doctor-layout-grid {
    grid-template-columns: 1fr;
  }
}

/* Alerts History Log Card */
.alerts-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.alert-log-item {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  border-left: 4px solid var(--danger);
  animation: fadeIn 0.3s ease;
}

.alert-log-item .time {
  font-size: 0.7rem;
  color: var(--text-muted);
  align-self: flex-end;
  position: absolute;
  top: 0.85rem;
  right: 1rem;
}

.alert-log-item .title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #f87171;
}

.alert-log-item .desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-right: 4rem;
}

/* Patient clinical list */
.patient-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.patient-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.patient-row-card {
  background: rgba(255,255,255,0.01);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  transition: var(--transition-smooth);
}

.patient-row-card:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--primary-glow);
}

.patient-main-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 250px;
}

.patient-avatar-letter {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  color: #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  border: 1px solid var(--primary-glow);
}

.patient-text-details h4 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.patient-text-details p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.patient-vital-stats {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.vital-metric {
  text-align: center;
}

.vital-metric .lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.vital-metric .val {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Indicators */
.patient-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.led-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
}

.led-indicator.danger {
  background-color: var(--danger);
  box-shadow: 0 0 12px var(--danger-glow);
  animation: pulseLed 1s infinite alternate;
}

.attachment-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.attachment-badge.good {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.attachment-badge.risk {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulseGlowRisk 2s infinite;
}

/* Sheet Inspector Styles */
.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sheet-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sheet-tab-btn {
  background: rgba(30, 41, 59, 0.4);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sheet-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.sheet-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(11, 15, 25, 0.6);
}

.google-sheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.google-sheet-table th {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
}

.google-sheet-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: monospace;
}

.google-sheet-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.google-sheet-table tr:last-child td {
  border-bottom: none;
}

/* Patient details modal specific style */
.patient-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.history-item-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.history-item-header h5 {
  font-weight: 600;
  color: var(--text-primary);
}

.history-item-header .date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.symptom-tag-container {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.symptom-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
}

.symptom-tag.true {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.symptom-tag.false {
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulseDanger {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes pulseLed {
  from { box-shadow: 0 0 4px var(--danger-glow); opacity: 0.6; }
  to { box-shadow: 0 0 16px var(--danger); opacity: 1; }
}

@keyframes pulseGlowRisk {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Historial de Registros Tab Styles */
.collapsible-chart-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.collapsible-chart-panel.open {
  max-height: 480px;
}
.btn-view-chart {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-view-chart:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: white;
}

/* Global Hidden Helper */
.hidden {
  display: none !important;
}

/* Login Screen Styles */
#login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 2.5rem 1.5rem;
  z-index: 10;
}

.login-card {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: loginFadeIn 0.4s ease-out;
}

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

.login-header {
  text-align: center;
}

.login-logo {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
}

.login-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  transition: var(--transition-smooth);
}

.login-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}

.login-btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.login-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-google-signin {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-google-signin:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-color-active);
  transform: translateY(-1px);
}

.alert-danger {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 1rem;
  animation: alertFadeIn 0.3s ease-out;
  display: block;
}

@keyframes alertFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.demo-credentials-box {
  background: rgba(59, 130, 246, 0.05);
  border: 1px dashed rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.demo-credentials-box h4 {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.demo-credentials-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Logo Styling */
.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.login-logo-img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
  display: block;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
  /* Scrollable tabs bar */
  .tabs-navigation {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    gap: 0.5rem;
  }
  .tabs-navigation::-webkit-scrollbar {
    height: 4px;
  }
  .tabs-navigation::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
  }
  .tab-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Header adjustments */
  header {
    padding: 0.75rem 1rem !important;
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .logo-section {
    justify-content: center;
  }
  .simulator-panel {
    justify-content: space-between;
    width: 100%;
  }

  /* App container adjustments */
  body {
    padding: 0;
  }
  #app-container {
    padding: 0.5rem;
  }
  main {
    padding: 0.75rem 0.5rem !important;
  }
  .card {
    padding: 1.25rem !important;
    border-radius: 16px !important;
  }

  /* Layout and grids */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .diet-details {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Modals responsiveness */
  .modal-container {
    width: 95% !important;
    margin: 1rem auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 1.25rem !important;
    border-radius: 18px !important;
  }
  .modal-body {
    max-height: 60vh !important;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .logo-text h1 {
    font-size: 1.25rem;
  }
  .user-identity {
    gap: 0.5rem;
  }
  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }
  .user-name-role h2 {
    font-size: 1.1rem;
  }
  .user-name-role p {
    font-size: 0.75rem;
  }
  .login-card {
    padding: 1.5rem !important;
    border-radius: 16px;
  }
}

