/* ==========================================================================
   STYLING SYSTEM: HOSPITALITY SMART TV 16:9 INTERFACE
   Aesthetic: Ultra-luxurious Glassmorphism, Deep Ambient Glows & Vibrant Accents
   ========================================================================== */

:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Color Palette */
  --bg-dark: #070b14;
  --glass-bg: rgba(15, 23, 42, 0.48);
  --glass-bg-hover: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-focus: rgba(56, 189, 248, 0.85);
  
  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-green: #34d399;
  --accent-coral: #f43f5e;
  --accent-gold: #fbbf24;
  
  --focus-glow: 0 0 25px rgba(56, 189, 248, 0.65);
  --card-radius: 16px;
  --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden {
  display: none !important;
}

/* TV Viewport Wrapper - Enforces 16:9 Aspect Ratio Always */
.tv-viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000000;
  padding: clamp(6px, 1.2vw, 20px);
}

.tv-container {
  position: relative;
  width: 100%;
  max-width: 1920px;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Background Layer with Dark Ambient Overlay */
.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  filter: brightness(0.9) contrast(1.05);
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 40%, rgba(14, 116, 144, 0.15) 0%, transparent 60%),
    linear-gradient(180deg, rgba(7, 11, 20, 0.55) 0%, rgba(7, 11, 20, 0.25) 50%, rgba(7, 11, 20, 0.75) 100%);
  backdrop-filter: blur(2px);
}

/* Glassmorphism Common Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Header Component */
.tv-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.2rem 0.2rem 2.2rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green);
}

.status-text {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.time-display {
  font-size: 1.15rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
  background: rgba(15, 23, 42, 0.45);
  padding: 0.35rem 1.1rem;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Main Content Grid */
.main-content {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  padding: 0.5rem 2.2rem;
  align-items: center;
  margin: auto 0;
}

/* COSTADO IZQUIERDO: FICHA INFORMATIVA DEL PACIENTE */
.patient-card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  background: rgba(11, 19, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  height: fit-content;
  max-height: 440px;
}

.patient-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}

.clinic-logo-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--accent-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.clinic-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clinic-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.clinic-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.room-badge {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.1rem;
}

.divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.02) 100%);
  margin: 0.8rem 0;
}

.patient-info-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.4rem;
}

.info-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 90px;
}

.info-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.info-value.highlight {
  color: var(--text-primary);
  font-weight: 700;
}

.highlight-box {
  background: rgba(244, 63, 94, 0.12);
  border-left: 3px solid var(--accent-coral);
  padding: 0.6rem 0.8rem;
  border-radius: 0 8px 8px 0;
  margin-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.alert-text {
  color: #fecdd3;
  font-size: 0.9rem;
  line-height: 1.35;
}

.allergy-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fca5a5;
}

/* COSTADO DERECHO: 3 TARJETAS TRANSLÚCIDAS */
.services-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.3rem;
  align-items: center;
}

.service-card {
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: 440px;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  background: rgba(15, 23, 42, 0.45);
  position: relative;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 145px;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card-body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1.25;
}

#card-wellness .card-title {
  color: var(--accent-cyan);
}

#card-gastronomy .card-title {
  color: var(--accent-blue);
}

#card-entertainment .card-title {
  color: var(--accent-green);
}

.card-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   VISTA COMPLETA 1: MENÚ DE MÓDULOS (BOTONES GRANDES VERTICALES NATIVOS)
   ========================================================================== */
.fullscreen-view {
  position: absolute;
  inset: 55px 2.2rem 60px 2.2rem;
  z-index: 50;
  background: rgba(11, 19, 36, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 1.5rem 2rem 1.8rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: fadeInView 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.fullscreen-view.detail-overlay {
  z-index: 60;
  background: rgba(8, 14, 28, 0.94);
  border-color: rgba(52, 211, 153, 0.4);
}

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.header-detail {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-icon {
  font-size: 2.2rem;
  background: rgba(56, 189, 248, 0.15);
  padding: 0.4rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.view-title-group h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.view-title-group p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.back-view-btn {
  padding: 0.6rem 1.4rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

/* REJILLA DE 6 COLUMNAS CON BOTONES GRANDES VERTICALES (ÍCONO ARRIBA, TEXTO ABAJO) */
.large-buttons-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.1rem;
  flex: 1;
  align-items: stretch;
  padding: 12px 6px 12px 6px; /* Padding para evitar recorte del borde superior iluminado */
  overflow-y: auto;
}

.ehr-large-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.4rem 0.9rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  text-align: center;
  min-height: 145px;
}

.ehr-large-btn .btn-icon {
  font-size: 3.2rem;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ehr-large-btn .btn-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: 0.3px;
}

/* ENFOQUE DEL CONTROL REMOTO: RESALTE COMPLETO SIN RECORTE SUPERIOR */
.ehr-large-btn:hover,
.ehr-large-btn:focus,
.ehr-large-btn.focused {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-blue);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.75);
  transform: translateY(-4px) scale(1.04);
  z-index: 10;
}

.ehr-large-btn:hover .btn-icon,
.ehr-large-btn:focus .btn-icon {
  transform: scale(1.1);
}

.ehr-large-btn:hover .btn-label,
.ehr-large-btn:focus .btn-label {
  color: var(--accent-blue);
}

/* VISTA COMPLETA 2: CONTENIDO DE DETALLE DEL MÓDULO */
.detail-body-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-section-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detail-section-card h3 {
  font-size: 1.15rem;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* DATA TABLES FOR CLINICAL VITAL SIGNS, LABS, MEDS */
.clinical-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.clinical-table th {
  background: rgba(30, 41, 59, 0.7);
  color: var(--accent-cyan);
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.clinical-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.clinical-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.badge-normal {
  background: rgba(52, 211, 153, 0.2);
  color: #a7f3d0;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.badge-warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fef08a;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

/* TV FOCUS STATES & HOVER (FOR TV REMOTE NAVIGATION) */
.nav-item:hover,
.nav-item:focus,
.nav-item.focused,
.nav-item-view:hover,
.nav-item-view:focus,
.nav-item-view.focused,
.nav-item-detail:hover,
.nav-item-detail:focus,
.nav-item-detail.focused {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--glass-border-focus);
  box-shadow: var(--focus-glow);
  background: var(--glass-bg-hover);
}

/* Footer Control Guide */
.tv-footer {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 2.2rem 1rem 2.2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.remote-hints {
  display: flex;
  gap: 1.2rem;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

kbd.btn-ok {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

kbd.btn-back {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-coral);
  color: #fecdd3;
}

kbd.btn-home {
  background: rgba(52, 211, 153, 0.25);
  border-color: var(--accent-green);
  color: #a7f3d0;
}

kbd.btn-hotel {
  background: #ffffff;
  color: #070b14;
  font-weight: 800;
  border-color: #ffffff;
}

kbd.dpad-icon {
  font-size: 0.95rem;
  color: var(--accent-cyan);
}

.footer-brand {
  font-size: 0.78rem;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-notification {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--accent-cyan);
  color: #ffffff;
  padding: 0.65rem 1.6rem;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 200;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
