/* ========================================================
   CondoSignage - Stili Web App Monitor (1920x1080 Responsive)
   ======================================================== */

:root {
  --bg-main: #0a0e17;
  --bg-card: #131b2e;
  --bg-card-urgent: #261118;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-urgent: #ef4444;
  --accent-warning: #f59e0b;
  --accent-success: #10b981;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(19, 27, 46, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
}

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

body, html {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.1vw; /* Responsive scaling for 16:9 displays */
}

/* Container Generale Kiosk */
#kiosk-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #17223b 0%, #0a0e17 80%);
}

/* Orologio Fisso in Sovrimpressione (Top-Right) */
#top-clock-widget {
  position: absolute;
  top: 2.5vh;
  right: 3vw;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0.8vh 1.8vw;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

.clock-time {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.05rem;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-blue);
  text-transform: capitalize;
  margin-top: 0.2rem;
}

/* Badge Offline Discreto (Bottom-Left) */
#offline-badge {
  position: absolute;
  bottom: 2.5vh;
  left: 3vw;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6vh 1.2vw;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 2rem;
  font-size: 0.95rem;
  color: #fca5a5;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 0.7rem;
  height: 0.7rem;
  background-color: var(--accent-urgent);
  border-radius: 50%;
  animation: pulse-red 1.8s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--accent-urgent); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ========================================================
   1. SCHERMATA DI PAIRING (Stile Smart TV)
   ======================================================== */
.screen-fullscreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

.pairing-card {
  max-width: 55vw;
  width: 100%;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2.5rem;
  padding: 6vh 4vw;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.8s ease-out;
}

.pairing-icon {
  font-size: 4.5rem;
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pairing-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03rem;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pairing-instructions {
  font-size: 1.4rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 3.5vh;
}

.pin-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--accent-cyan);
  border-radius: 1.8rem;
  padding: 2vh 3.5vw;
  box-shadow: 0 0 35px rgba(6, 182, 212, 0.35);
  margin-bottom: 3.5vh;
}

.pin-code {
  font-size: 5.5rem;
  font-weight: 900;
  letter-spacing: 1.2rem;
  color: #ffffff;
  font-family: monospace;
}

.pairing-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-size: 1.2rem;
  color: var(--accent-cyan);
}

.pairing-status-box.text-success {
  color: var(--accent-success);
  font-weight: 700;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================================
   2. PLAYER DEL PALINSESTO A SCHERMO INTERO
   ======================================================== */
#player-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

.slide-slot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vh 8vw;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scheda Avviso Condominiale */
.notice-card {
  width: 100%;
  max-width: 82vw;
  min-height: 65vh;
  background: var(--bg-card);
  border-radius: 2.5rem;
  padding: 6vh 5vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.notice-card.notice-urgent {
  background: radial-gradient(circle at top right, #3f1118 0%, #1f0b10 100%);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.25);
}

.notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3vh;
}

.notice-badge {
  font-size: 1.3rem;
  font-weight: 800;
  padding: 0.6vh 1.4vw;
  border-radius: 2rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

.notice-urgent .notice-badge {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.6);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.notice-target {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
}

.notice-title {
  font-size: 3.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 3vh;
  color: #ffffff;
}

.notice-body {
  font-size: 2.1rem;
  line-height: 1.6;
  color: #cbd5e1;
  flex-grow: 1;
  word-break: break-word;
}

.notice-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2.5vh;
  margin-top: 3vh;
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* Scheda Pubblicità (Media Fullscreen) */
.ad-card {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2rem;
}

.ad-media-image, .ad-media-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 1.5rem;
}

.ad-tag {
  position: absolute;
  bottom: 2vh;
  right: 2vw;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.4vh 1vw;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: #cbd5e1;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.ad-text-fallback {
  text-align: center;
  padding: 6vh 6vw;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 2rem;
  border: 1px solid var(--border-subtle);
  width: 80%;
}

.ad-title {
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-top: 2vh;
}

.ad-subtitle {
  font-size: 1.8rem;
  color: var(--text-secondary);
  margin-top: 1.5vh;
}

/* ========================================================
   3. SCHERMATA DI FALLBACK ELEGANTE (Senza nome stabilimento)
   ======================================================== */
.fallback-card {
  text-align: center;
  max-width: 60vw;
  padding: 6vh 4vw;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: fadeIn 1s ease-out;
}

.fallback-icon {
  font-size: 5rem;
  margin-bottom: 2vh;
  display: inline-block;
  opacity: 0.85;
}

.fallback-title {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.02rem;
  margin-bottom: 2vh;
  color: #ffffff;
}

.fallback-subtitle {
  font-size: 1.6rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Utility Classi Transizione */
.hidden {
  display: none !important;
}

.fade-in {
  opacity: 1 !important;
}

.fade-out {
  opacity: 0 !important;
}

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