:root {
  --primary-color: #1e40af;
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.92);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --accent-color: #ef4444;
  --accent-gold: #f59e0b;
  --header-height: 62px;
  --ticker-duration: 140s;
}

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

body, html {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#playerRoot {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Top Company / Brand Header Bar */
.company-header {
  height: var(--header-height);
  width: 100%;
  background: linear-gradient(90deg, var(--primary-color) 0%, #0f172a 100%);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.company-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.company-logo {
  height: 44px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
}

.company-titles {
  display: flex;
  flex-direction: column;
}

.company-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.15;
}

.company-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}

.company-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.screen-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.screen-credit {
  font-size: 0.56rem;
  color: rgba(226, 232, 240, 0.68);
  font-weight: 500;
  letter-spacing: 0.3px;
  padding-right: 4px;
}

.floating-screen-meta {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  background: rgba(15, 23, 42, 0.65);
  padding: 5px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

/* Zone Container */
#zoneContainer {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
}

/* Generic Zone Placement */
.tv-zone {
  position: absolute;
  overflow: hidden;
  background-color: transparent;
  transition: all 0.3s ease;
}

/* Media Zone & Carousel */
.zone-media-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  pointer-events: none;
}

.media-item.active {
  opacity: 1;
  pointer-events: auto;
}

/* Standard Website Carousel Controls */
.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  opacity: 0.25;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}

.zone-media-wrapper:hover .carousel-nav-btn {
  opacity: 0.9;
}

.carousel-nav-btn:hover {
  opacity: 1 !important;
  background: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
  left: 16px;
}

.carousel-next {
  right: 16px;
}

.carousel-bottom-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 40;
  backdrop-filter: blur(6px);
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.zone-media-wrapper:hover .carousel-bottom-bar {
  opacity: 1;
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

.carousel-dot.active {
  width: 26px;
  border-radius: 10px;
  background: #3b82f6;
}

.carousel-pause-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  margin-left: 4px;
}

/* Composite / Sidebar Zone */
.zone-sidebar-wrapper {
  width: 100%;
  height: 100%;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border-left: 2px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow: hidden;
}

.zone-sidebar-horizontal {
  flex-direction: row !important;
  border-left: none;
  border-bottom: 2px solid var(--panel-border);
}

/* Widgets inside Sidebar */
.widget-card {
  background: rgba(31, 41, 55, 0.78);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Clock Widget */
.widget-clock {
  text-align: center;
  flex-shrink: 0;
}

.clock-time {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  line-height: 1.05;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.clock-date {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 4px;
}

/* Weather Widget */
.widget-weather {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.weather-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.weather-temp {
  font-size: 2.3rem;
  font-weight: 700;
  color: #fff;
}

.weather-details {
  text-align: right;
}

.weather-city {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.weather-cond {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.weather-feels {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 2px;
}

/* Announcements / Informes Widget (Supports Fixed Image + Text) */
.widget-announcements {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.widget-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-gold);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.announcement-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  justify-content: center;
}

.announcement-img-wrapper {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.announcement-fixed-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* Streaming TV & Radio in Announcements Space */
.announcement-stream-wrapper {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
}

.ann-stream-iframe,
.ann-stream-video {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  object-fit: contain;
  background: #000;
}

.radio-stream-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: radial-gradient(circle at center, rgba(30, 64, 175, 0.38) 0%, rgba(15, 23, 42, 0.92) 100%);
  text-align: center;
}

.radio-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.radio-equalizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 30px;
}

.eq-bar {
  width: 5px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  border-radius: 3px;
  animation: eqBounce 0.9s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 12px; animation-delay: 0.0s; }
.eq-bar:nth-child(2) { height: 26px; animation-delay: 0.2s; }
.eq-bar:nth-child(3) { height: 18px; animation-delay: 0.4s; }
.eq-bar:nth-child(4) { height: 28px; animation-delay: 0.15s; }
.eq-bar:nth-child(5) { height: 14px; animation-delay: 0.35s; }

.radio-equalizer.paused .eq-bar {
  animation-play-state: paused;
  height: 6px !important;
}

@keyframes eqBounce {
  0% { transform: scaleY(0.35); }
  100% { transform: scaleY(1.05); }
}

.announcement-body {
  font-size: var(--ann-font-size, 20px);
  font-family: var(--ann-font-family, 'Roboto', sans-serif);
  line-height: 1.38;
  color: #e5e7eb;
  white-space: pre-line;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* Queue Call (Clinic Ticket) in Sidebar */
.widget-queue {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.45), rgba(17, 24, 39, 0.95));
  border: 2px solid rgba(59, 130, 246, 0.55);
  min-height: 0;
}

.queue-current-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
}

.queue-badge {
  display: inline-block;
  padding: 4px 12px;
  background-color: var(--accent-color);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.queue-ticket-num {
  font-size: 3.6rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
  letter-spacing: 2px;
}

.queue-location {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 6px;
}

.queue-service-tag {
  font-size: 0.9rem;
  color: #60a5fa;
  font-weight: 600;
  margin-top: 2px;
}

.queue-patient {
  font-size: 1rem;
  color: #f3f4f6;
  font-weight: 600;
  margin-top: 4px;
}

.queue-history-box {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 8px;
  margin-top: 6px;
  text-align: left;
}

.queue-history-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.queue-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.qh-num {
  font-weight: 800;
  color: #fbbf24;
}

.qh-loc {
  color: #cbd5e1;
  font-size: 0.8rem;
}

/* Footer / Ticker Zone */
.zone-ticker-wrapper {
  width: 100%;
  height: 100%;
  background: #0f172a;
  border-top: 2px solid var(--panel-border);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.ticker-label {
  background: var(--accent-color);
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0 18px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  letter-spacing: 1px;
  z-index: 10;
  box-shadow: 4px 0 10px rgba(0,0,0,0.5);
}

.ticker-marquee {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  height: 100%;
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  font-size: var(--rss-font-size, 22px);
  font-family: var(--rss-font-family, 'Titillium Web', sans-serif);
  line-height: 1.15;
  font-weight: 500;
  color: #f3f4f6;
  animation: marquee-anim var(--ticker-duration, 140s) linear infinite;
  padding-left: 100%;
}

@keyframes marquee-anim {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

.ticker-item {
  display: inline-block;
  margin-right: 42px;
}

.ticker-separator {
  color: var(--accent-gold);
  margin-right: 42px;
}

/* Big Fullscreen Queue Alert Popup */
#queuePopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

#queuePopup.show {
  display: flex;
}

.popup-card {
  background: #1e293b;
  border: 4px solid #3b82f6;
  border-radius: 24px;
  padding: 40px 64px;
  text-align: center;
  box-shadow: 0 0 60px rgba(59, 130, 246, 0.8);
  animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

@keyframes scaleUp {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-tag {
  font-size: 1.7rem;
  font-weight: 800;
  color: #ef4444;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.popup-number {
  font-size: 7.5rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
  line-height: 1.1;
  margin: 15px 0;
}

.popup-dest {
  font-size: 3.2rem;
  font-weight: 700;
  color: #ffffff;
}

.popup-patient {
  font-size: 1.8rem;
  color: #93c5fd;
  margin-top: 10px;
}

/* Floating Action Buttons */
.floating-action-btn {
  position: fixed;
  bottom: 16px;
  z-index: 9500;
  background: rgba(30, 64, 175, 0.88);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
}

.floating-action-btn:hover {
  transform: scale(1.05);
  background: #2563eb;
}

/* Discreet Audio Toggle Button (Bottom Right) */
.audio-toggle-btn {
  position: fixed;
  bottom: 10px;
  right: 14px;
  z-index: 9500;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(248, 250, 252, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 5px 11px;
  border-radius: 16px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.52;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.audio-toggle-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.95);
}

.audio-toggle-btn.unmuted {
  border-color: rgba(16, 185, 129, 0.65);
  color: #a7f3d0;
}

.left-btn {
  left: 16px;
  padding: 6px 13px;
  font-size: 0.76rem;
  opacity: 0.65;
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(59, 130, 246, 0.5);
}

.left-btn:hover {
  opacity: 1;
}

/* Quick Queue Launcher Drawer on TV Consultório */
.queue-drawer {
  position: fixed;
  top: 0;
  left: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  background: #0f172a;
  border-right: 2px solid #3b82f6;
  z-index: 9800;
  box-shadow: 10px 0 30px rgba(0,0,0,0.7);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
}

.queue-drawer.open {
  left: 0;
}

.drawer-header {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.05rem;
  color: #fff;
}

.drawer-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  cursor: pointer;
}

.drawer-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-section {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px;
}

.drawer-section h4 {
  font-size: 0.9rem;
  color: #60a5fa;
  margin-bottom: 10px;
}

.drawer-form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-input {
  width: 100%;
  padding: 8px 12px;
  background: #0b1329;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
}

.drawer-btn {
  padding: 9px 14px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  color: #fff;
}

.btn-blue { background: #2563eb; }
.btn-green { background: #10b981; }
.btn-amber { background: #d97706; }
.btn-gray { background: #475569; }

.drawer-feedback {
  font-size: 0.85rem;
  color: #34d399;
  font-weight: 700;
  margin-top: 6px;
}

.waiting-list-mini {
  margin-top: 10px;
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.waiting-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b1329;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* Offline Banner */
#offlineBanner {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9000;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 6px;
}
