@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;900&family=Rajdhani:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
  /* Cores Cyberpunk/Futuristas */
  --primary: #00f0ff;
  --primary-glow: rgba(0, 240, 255, 0.5);
  --secondary: #ff00ff;
  --secondary-glow: rgba(255, 0, 255, 0.5);
  --accent: #00ff88;
  --accent-glow: rgba(0, 255, 136, 0.5);
  --neon-blue: #00d4ff;
  --neon-pink: #ff006e;
  --neon-purple: #8b5cf6;
  --success: #00ff88;
  --danger: #ff0055;
  --warning: #ffaa00;
  
  /* Backgrounds */
  --bg-dark: #000000;
  --bg-overlay: rgba(0, 10, 20, 0.95);
  --bg-card: rgba(10, 15, 35, 0.8);
  --bg-card-hover: rgba(15, 25, 50, 0.9);
  
  /* Textos */
  --text: #ffffff;
  --text-secondary: #8b9dc3;
  --text-glow: rgba(0, 240, 255, 0.8);
  
  /* Glass/Holográfico */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(0, 240, 255, 0.3);
  --hologram-gradient: linear-gradient(135deg, rgba(0,240,255,0.1), rgba(255,0,255,0.1));
  
  /* Sombras e Glows */
  --shadow-glow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow);
  --shadow-neon: 0 0 10px var(--primary), 0 0 20px var(--primary), 0 0 30px var(--primary);
  --text-shadow-neon: 0 0 10px currentColor, 0 0 20px currentColor;
}

body.light-mode {
  --bg-dark: #e8f0ff;
  --bg-overlay: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(240, 245, 255, 0.95);
  --text: #0a1929;
  --text-secondary: #475569;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 100, 200, 0.3);
  --primary: #0066ff;
  --secondary: #dd00ff;
  --accent: #00aa66;
  --shadow-glow: 0 4px 20px rgba(0, 100, 255, 0.2);
  --shadow-neon: 0 2px 10px rgba(0, 100, 255, 0.3);
}

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

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  transition: all 0.3s ease;
  overflow-x: hidden;
  position: relative;
  max-width: 100vw;
}

/* BACKGROUND FUTURISTA COM GRID ANIMADO */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridScroll 20s linear infinite;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

@keyframes gridScroll {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* PARTÍCULAS FLUTUANTES (DESABILITADO PARA PERFORMANCE) */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, rgba(0, 240, 255, 0.15), transparent),
    radial-gradient(1px 1px at 80% 70%, rgba(255, 0, 255, 0.15), transparent);
  background-size: 200% 200%;
  background-position: 50% 50%;
  pointer-events: none;
  z-index: 0;
  /* animation desabilitada para economia de memória */
}

@keyframes particleFloat {
  0%, 100% { 
    background-position: 0% 0%, 100% 100%;
  }
  50% { 
    background-position: 100% 100%, 0% 0%;
  }
}

/* SCAN LINES REMOVIDAS (OTIMIZAÇÃO) */

/* HEADER FUTURISTA */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 90px;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 2px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 240, 255, 0.1), inset 0 -1px 0 var(--primary);
  padding: 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  transition: all 0.3s ease;
  position: relative;
  min-width: 0;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--primary) 20%, 
    var(--secondary) 50%, 
    var(--accent) 80%, 
    transparent
  );
  animation: headerGlow 3s ease-in-out infinite;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 
    0 0 10px var(--primary-glow),
    0 0 20px var(--primary-glow),
    0 0 30px var(--primary-glow);
  animation: textGlow 2s ease-in-out infinite alternate;
}

/* Logo SVG */
.logo-svg {
  height: 70px;
  width: auto;
  max-width: 350px;
  display: block;
  filter: drop-shadow(0 0 8px var(--primary-glow)) 
          drop-shadow(0 0 15px var(--primary-glow));
  transition: all 0.3s ease;
}

.logo-svg:hover {
  filter: drop-shadow(0 0 15px var(--primary)) 
          drop-shadow(0 0 25px var(--primary-glow));
  transform: scale(1.02);
}

/* Textos do logo */
.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 700;
  fill: var(--text);
  letter-spacing: 2px;
}

.logo-text-rafa {
  fill: var(--text);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text-iot {
  fill: var(--primary);
  filter: drop-shadow(0 0 12px var(--primary)) drop-shadow(0 0 20px var(--primary-glow));
  animation: iotPulse 2s ease-in-out infinite;
}

/* Animações do ícone */
.logo-icon {
  animation: iconRotate 8s linear infinite;
  transform-origin: 25px 40px;
}

.logo-waves {
  animation: wavesPulse 2s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px);
    filter: drop-shadow(0 0 10px var(--primary-glow)) 
            drop-shadow(0 0 20px var(--primary-glow));
  }
  50% {
    transform: translateY(-5px);
    filter: drop-shadow(0 0 20px var(--primary)) 
            drop-shadow(0 0 30px var(--primary-glow));
  }
}

@keyframes textGlow {
  from { text-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-glow); }
  to { text-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow), 0 0 60px var(--primary-glow); }
}

@keyframes iotPulse {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 12px var(--primary)) drop-shadow(0 0 20px var(--primary-glow));
  }
  50% {
    opacity: 0.8;
    filter: drop-shadow(0 0 20px var(--primary)) drop-shadow(0 0 30px var(--primary-glow));
  }
}

@keyframes iconRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes wavesPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.3; }
}

.logo-highlight {
  color: var(--accent);
  text-shadow: 
    0 0 10px var(--accent-glow),
    0 0 20px var(--accent-glow),
    0 0 30px var(--accent-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}

#logoutBtn {
  margin-left: 0;
}

.theme-toggle {
  width: 50px;
  height: 50px;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    transparent,
    var(--primary),
    transparent 180deg
  );
  animation: themeRotate 3s linear infinite;
  opacity: 0;
}

.theme-toggle:hover::before {
  opacity: 1;
}

@keyframes themeRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.theme-toggle:hover {
  background: var(--primary);
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary-glow);
  border-color: var(--primary);
}

.btn {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  padding: 14px 28px;
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: var(--primary);
  color: var(--bg-dark);
  transform: translateY(-2px);
  box-shadow: 
    0 0 20px var(--primary),
    0 0 40px var(--primary-glow),
    0 10px 30px rgba(0, 0, 0, 0.5);
  border-color: var(--primary);
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: 2px solid var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
  animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
  0%, 100% { 
    box-shadow: 0 0 20px var(--primary-glow); 
  }
  50% { 
    box-shadow: 0 0 40px var(--primary-glow); 
  }
}

.btn-primary:hover {
  box-shadow: 
    0 0 40px var(--primary),
    0 15px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(-4px) scale(1.05);
}

.btn-secondary {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: var(--accent);
  border: 2px solid var(--accent);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
  animation: btnGlowSecondary 2s ease-in-out infinite;
}

@keyframes btnGlowSecondary {
  0%, 100% { 
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3); 
  }
  50% { 
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.4); 
  }
}

.btn-secondary:hover {
  box-shadow: 
    0 0 30px var(--accent),
    0 15px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(-4px) scale(1.05);
  border-color: var(--accent);
}

/* LAYOUT CENTRALIZADO */
.main-container {
  margin-top: 80px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 40px 40px;
  position: relative;
  z-index: 1;
}

.content {
  width: 100%;
  max-width: 1400px;
  transition: all 0.3s ease;
  animation: contentFadeIn 0.8s ease-out;
}

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

/* PLATFORM CARDS - DESIGN INOVADOR */
.platforms-hero {
  text-align: center;
  margin-bottom: 30px;
  padding-top: 20px;
}

.platforms-hero h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 56px;
  font-weight: 900;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px var(--primary-glow), 0 0 80px var(--secondary-glow);
  animation: titleGlow 3s ease-in-out infinite alternate;
  position: relative;
}

.platforms-hero h1::before {
  content: '◢◣';
  position: absolute;
  left: -60px;
  color: var(--primary);
  text-shadow: 0 0 20px var(--primary);
}

.platforms-hero h1::after {
  content: '◥◤';
  position: absolute;
  right: -60px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent);
}

@keyframes titleGlow {
  from { 
    filter: brightness(1) drop-shadow(0 0 20px var(--primary)); 
  }
  to { 
    filter: brightness(1.2) drop-shadow(0 0 40px var(--primary)) drop-shadow(0 0 60px var(--secondary)); 
  }
}

.platforms-hero p {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.8;
}

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 40px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1200px) {
  .platforms-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1199px) and (min-width: 768px) {
  .platforms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.platform-card-modern {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--glass-border);
  border-radius: 0;
  padding: 40px 30px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  clip-path: polygon(
    0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px)
  );
}

.platform-card-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  filter: blur(20px);
}

.platform-card-modern::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  background-size: 300% 300%;
  opacity: 0;
  z-index: -1;
  animation: borderGlow 3s ease infinite;
  filter: blur(10px);
}

@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.platform-card-modern:hover::before {
  opacity: 0.15;
}

.platform-card-modern:hover::after {
  opacity: 1;
}

.platform-card-modern:hover {
  transform: translateY(-15px) scale(1.03);
  box-shadow: 
    0 0 40px var(--primary-glow),
    0 20px 50px rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
}

.platform-card-content {
  position: relative;
  z-index: 1;
}

.platform-icon-large {
  font-size: 80px;
  margin-bottom: 20px;
  display: inline-block;
  animation: iconFloat 3s ease-in-out infinite, iconRotate 10s linear infinite;
  filter: drop-shadow(0 0 20px var(--primary)) drop-shadow(0 0 40px var(--secondary));
  position: relative;
}

.platform-icon-large::after {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  z-index: -1;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
}

@keyframes iconRotate {
  0% { filter: drop-shadow(0 0 20px var(--primary)) drop-shadow(0 0 40px var(--secondary)) hue-rotate(0deg); }
  100% { filter: drop-shadow(0 0 20px var(--primary)) drop-shadow(0 0 40px var(--secondary)) hue-rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.platform-card-modern h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px var(--primary-glow);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.platform-card-modern p {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.platform-card-modern .btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}

/* DASHBOARD GRID (para dispositivos) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 0;
  align-items: start;
}

/* CARD HOLOGRÁFICO (SEM ROTAÇÃO) */
.device-card-container {
  height: 150px;
  max-height: 150px;
  transition: all 0.3s ease;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.device-card {
  position: relative;
  width: 100%;
  height: 150px;
  max-height: 150px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 0;
  padding: 0;
}

.device-card.expanded {
  height: auto;
  max-height: none;
}

.device-card-container.expanded {
  height: auto;
  max-height: none;
  z-index: 10;
  position: relative;
}

/* Cards com 4+ switches (layout 2x2) */
.device-card-container.multi-switch:not(.expanded) {
  height: 190px;
  max-height: 190px;
}

.device-card.multi-switch:not(.expanded) {
  height: 190px;
  max-height: 190px;
}

.device-card-container:hover .device-card:not(.expanded) {
  transform: translateY(-5px);
  box-shadow: 
    0 0 40px var(--primary-glow),
    0 20px 50px rgba(0, 0, 0, 0.4);
}

.card-front, .card-back {
  position: relative;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 0;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.4s ease;
  clip-path: polygon(
    0 8px, 8px 0, calc(100% - 8px) 0, 100% 8px,
    100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px)
  );
  overflow: hidden;
}

.card-front::before, .card-back::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 240, 255, 0.1) 0%,
    transparent 50%,
    rgba(255, 0, 255, 0.1) 100%
  );
  pointer-events: none;
}

.card-front::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--primary-glow) 90deg,
    transparent 180deg
  );
  animation: cardScan 4s linear infinite;
  opacity: 0;
}

.device-card-container:hover .card-front::after {
  opacity: 0.3;
}

@keyframes cardScan {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.card-front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-back {
  display: none; /* Desabilitar verso do card */
}

/* CARD EXPANDIDO (substitui rotação) */
.card-expanded {
  padding: 0 10px 10px 10px;
  animation: expandIn 0.3s ease;
  overflow: hidden;
  margin: 0;
}

@keyframes expandIn {
  from {
    opacity: 0;
    max-height: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
    padding-bottom: 10px;
  }
}

.device-card-container:hover .card-front {
  box-shadow: 
    0 0 40px var(--primary-glow),
    0 20px 50px rgba(0, 0, 0, 0.4);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0;
}

.device-icon {
  font-size: 28px;
  animation: deviceIconFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 10px var(--primary)) drop-shadow(0 0 20px var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

@keyframes deviceIconFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(-5deg); }
  75% { transform: translateY(-5px) rotate(5deg); }
}

.device-status-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  animation: statusPulse 1.5s ease-in-out infinite;
  position: relative;
}

.device-status-indicator::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: statusRing 1.5s ease-out infinite;
}

@keyframes statusPulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 1;
  }
  50% { 
    transform: scale(1.2); 
    opacity: 0.8;
  }
}

@keyframes statusRing {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.device-status-indicator.online {
  background: var(--success);
  box-shadow: 
    0 0 10px var(--success),
    0 0 20px var(--accent-glow),
    0 0 30px var(--accent-glow);
  color: var(--success);
}

.device-status-indicator.offline {
  background: var(--danger);
  box-shadow: 
    0 0 10px var(--danger),
    0 0 20px rgba(255, 0, 85, 0.5);
  color: var(--danger);
}

.device-info h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px var(--text-glow);
}

.device-meta {
  display: flex;
  gap: 15px;
  font-size: 11px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.device-actions {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.quick-action {
  flex: 1;
  padding: 3px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.05), rgba(0, 240, 255, 0.1));
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  font-family: 'Rajdhani', sans-serif;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  pointer-events: auto;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  contain: layout style paint;
  isolation: isolate;
  box-shadow: 0 2px 8px rgba(0, 240, 255, 0.15);
}

/* Ícones dos botões usando pseudo-elemento */
.button-icon {
  font-size: 20px;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 100%;
  height: 100%;
  vertical-align: middle;
}

.button-icon::before {
  display: block;
  text-align: center;
}

/* Botão Toggle - Estados */
.btn-toggle-device[data-state="off"] .button-icon::before {
  content: '⚡';
}

.btn-toggle-device[data-state="on"] .button-icon::before {
  content: '⭕';
}

.btn-toggle-device[data-state="offline"] .button-icon::before {
  content: '❌';
}

/* Botão Expandir - Estados */
.btn-expand-card[data-expanded="false"] .button-icon::before {
  content: '⚙️';
}

.btn-expand-card[data-expanded="true"] .button-icon::before {
  content: '✖️';
}

.quick-action::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  z-index: -1;
  pointer-events: none;
  opacity: 0.2;
}

.quick-action:hover::before {
  width: 200%;
  height: 200%;
}

@keyframes buttonPulse {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(0, 240, 255, 0.15); 
  }
  50% { 
    box-shadow: 0 2px 10px rgba(0, 240, 255, 0.22); 
  }
}

.quick-action:hover {
  color: var(--bg-dark);
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--primary-glow);
  border-color: var(--primary);
  animation: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.quick-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--danger);
  color: var(--danger);
}

.quick-action:disabled:hover {
  transform: none;
  box-shadow: none;
}

.quick-action:active,
.quick-action:focus {
  background: transparent !important;
  outline: none !important;
  box-shadow: 0 0 15px var(--primary-glow) !important;
  transform: none !important;
  font-size: inherit !important;
}

.quick-action:active::before,
.quick-action:focus::before {
  width: 200%;
  height: 200%;
}

/* Prevenir zoom no emoji ao clicar */
.quick-action:active *,
.quick-action:focus * {
  transform: none !important;
  font-size: inherit !important;
}

/* TOOLTIP PARA BOTÕES */
.button-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.95);
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  border: 1px solid var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.button-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.95);
}

.quick-action:hover .button-tooltip,
.quick-action:focus .button-tooltip {
  opacity: 1;
}

.loading {
  text-align: center;
  padding: 60px 40px;
  color: var(--primary);
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 3px;
  animation: loadingPulse 1.5s ease-in-out infinite;
  text-shadow: 0 0 20px var(--primary);
  word-break: break-word;
}

@media (max-width: 768px) {
  .loading {
    padding: 40px 20px;
    font-size: 16px;
    letter-spacing: 2px;
  }
}

@media (max-width: 480px) {
  .loading {
    padding: 30px 15px;
    font-size: 14px;
    letter-spacing: 1px;
  }
}

@keyframes loadingPulse {
  0%, 100% { 
    opacity: 0.5; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.05);
  }
}

.error {
  background: rgba(255, 0, 85, 0.1);
  border: 2px solid var(--danger);
  color: var(--danger);
  padding: 25px;
  border-radius: 0;
  margin-top: 20px;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.3);
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

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

/* MODAL CONTROLE AVANÇADO */
.control-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.3s ease;
}

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

.control-modal.active { display: flex; }

.control-content {
  background: var(--bg-overlay);
  border: 2px solid var(--glass-border);
  border-radius: 0;
  padding: 40px;
  max-width: 550px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  clip-path: polygon(
    0 15px, 15px 0, calc(100% - 15px) 0, 100% 15px,
    100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0 calc(100% - 15px)
  );
  box-shadow: 
    0 0 40px var(--primary-glow),
    0 0 80px var(--secondary-glow),
    0 20px 60px rgba(0, 0, 0, 0.8);
  animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.control-content::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  background-size: 300% 300%;
  animation: borderGlow 3s ease infinite;
  z-index: -1;
  filter: blur(10px);
}

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

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--glass-border);
}

.control-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.control-close {
  width: 45px;
  height: 45px;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
}

.control-close:hover {
  background: var(--danger);
  color: white;
  transform: rotate(180deg) scale(1.1);
  border-color: var(--danger);
  box-shadow: 0 0 20px var(--danger);
}

.slider-control {
  margin-bottom: 30px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.slider-label span:first-child {
  color: var(--text);
}

.slider-label span:last-child {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 0;
  background: var(--glass-bg);
  outline: none;
  border: 1px solid var(--glass-border);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 2px solid var(--bg-dark);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary-glow);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 2px solid var(--bg-dark);
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary-glow);
}

.presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 25px;
}

.preset-btn {
  padding: 20px 15px;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  position: relative;
  overflow: hidden;
}

.preset-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.preset-btn:hover::before {
  opacity: 0.2;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 0 20px var(--primary-glow);
}

.preset-btn div:first-child {
  font-size: 32px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 10px var(--primary));
}

/* Overlay para popup */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9998;
  backdrop-filter: blur(10px);
  animation: modalFadeIn 0.3s ease;
}

.popup-overlay.active {
  display: block;
}

/* Container do iframe popup */
.popup-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 1200px;
  height: 95vh;
  background: var(--bg-dark);
  border: 3px solid var(--glass-border);
  border-radius: 0;
  box-shadow: 
    0 0 40px var(--primary-glow),
    0 0 80px var(--secondary-glow),
    0 20px 80px rgba(0, 0, 0, 0.8);
  z-index: 9999;
  overflow: hidden;
  animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  clip-path: polygon(
    0 20px, 20px 0, calc(100% - 20px) 0, 100% 20px,
    100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px)
  );
}

.popup-container.active {
  display: block;
}

.popup-container::before {
  content: '';
  position: absolute;
  inset: -3px;
  background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  background-size: 300% 300%;
  animation: borderGlow 3s ease infinite;
  z-index: -1;
}

.popup-header {
  background: var(--bg-overlay);
  border-bottom: 2px solid var(--glass-border);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  position: relative;
}

.popup-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--primary) 20%, 
    var(--secondary) 50%, 
    var(--accent) 80%, 
    transparent
  );
}

.popup-header h3 {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.popup-close {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  color: var(--text);
  width: 45px;
  height: 45px;
  border-radius: 0;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
}

.popup-close:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 0 20px var(--danger);
}

.popup-iframe {
  width: 100%;
  height: calc(100% - 50px);
  border: none;
}

.popup-body {
  height: calc(85vh - 80px);
  overflow: hidden;
  background: var(--bg-dark);
}

.popup-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-dark);
}

/* Reset adicional para mobile */
@media (max-width: 480px) {
  .popup-overlay.active {
    position: fixed;
    overflow: hidden;
  }
}

/* ===============================================
   SCROLLBAR CUSTOMIZADA FUTURÍSTICA
   =============================================== */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-left: 1px solid var(--glass-border);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 0;
  border: 2px solid var(--bg-dark);
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--secondary), var(--accent));
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-dark);
}

/* ===============================================
   PULSOS DE DADOS (Decorativos IoT)
   =============================================== */
@keyframes dataPulse {
  0%, 100% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.device-card.online::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: dataPulse 2s ease infinite;
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
}

/* ===============================================
   EFEITO DE CONEXÃO (Borda Rotativa)
   =============================================== */
@keyframes connectionPulse {
  0%, 100% {
    box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent-glow);
  }
}

.platform-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, transparent, var(--primary), transparent);
  z-index: -2;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: borderRotate 8s linear infinite;
}

.platform-card:hover::before {
  opacity: 0.5;
}

/* ===============================================
   RESPONSIVIDADE
   =============================================== */

/* Desktop grande */
@media (max-width: 1400px) {
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* Desktop médio e Laptop */
@media (max-width: 1200px) {
  .platforms-hero h1 {
    font-size: 42px;
  }
  
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  .header {
    height: 80px;
  }
  
  .main-container {
    margin-top: 80px;
  }
}

/* Tablet landscape */
@media (max-width: 1024px) {
  .platforms-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
  }
  
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
  }
  
  .platforms-hero h1 {
    font-size: 38px;
  }
  
  .platform-card {
    padding: 30px 25px;
  }
}

@media (max-width: 768px) {
  .platforms-grid { 
    grid-template-columns: 1fr; 
  }
  
  .device-grid { 
    grid-template-columns: 1fr; 
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
  }
  
  .quick-actions { 
    flex-direction: column; 
    gap: 10px;
  }
  
  .presets { 
    grid-template-columns: repeat(2, 1fr); 
  }
  
  .platforms-hero h1 {
    font-size: 36px;
    letter-spacing: 2px;
  }
  
  .platforms-hero h1::before,
  .platforms-hero h1::after {
    font-size: 22px;
  }
  
  .platforms-hero p {
    font-size: 12px;
  }
  
  .control-content {
    width: 95%;
    height: 90vh;
    padding: 30px 20px;
  }
  
  /* Modal eWeLink otimizado para tablet */
  .popup-container {
    width: 100%;
    height: 100vh;
    max-width: 100%;
    clip-path: none;
    border: none;
    border-radius: 0;
  }
  
  .popup-container::before {
    display: none;
  }
  
  .popup-header {
    padding: 15px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--glass-border);
  }
  
  .popup-header::after {
    height: 1px;
  }
  
  .popup-header h3 {
    font-size: 16px;
  }
  
  .popup-close {
    width: 40px;
    height: 40px;
    clip-path: none;
    border-radius: 8px;
  }
  
  .popup-iframe {
    height: calc(100vh - 60px);
  }
  
  .popup-body {
    height: calc(100vh - 60px);
  }
  
  .grid-background {
    background-size: 40px 40px;
  }
  
  .header {
    height: 70px;
    padding: 0 15px;
  }
  
  .header-brand {
    flex-shrink: 1;
    min-width: 0;
  }
  
  .logo-svg {
    height: 55px;
    max-width: 280px;
  }
  
  .header-actions {
    flex-shrink: 0;
    gap: 10px;
  }
  
  .main-container {
    margin-top: 70px;
  }
  
  .platform-card {
    padding: 25px 20px;
  }
  
  .device-card-container {
    height: 280px;
  }
  
  .card-front,
  .card-back {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 5px;
  }
  
  /* Botões do sistema mais compactos */
  .btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
  }
  
  .btn-primary {
    padding: 10px 16px !important;
    font-size: 14px !important;
  }
  
  /* Títulos de página mais compactos */
  h1 {
    font-size: 22px !important;
  }
  
  h1 svg {
    width: 48px !important;
    height: 48px !important;
  }
  
  /* Tuya específico */
  .page-title-tuya {
    font-size: 20px !important;
  }
  
  .page-icon-tuya {
    width: 44px !important;
    height: 44px !important;
  }
  
  .tuya-header {
    margin-bottom: 15px !important;
    gap: 12px !important;
  }
  
  .filter-btn {
    padding: 6px !important;
    font-size: 11px !important;
  }
  
  .header {
    height: 60px;
    padding: 0 10px;
    width: 100%;
    min-width: 100%;
  }
  
  .header-brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 110px);
  }
  
  .logo-svg {
    height: 45px;
    max-width: 100%;
    width: auto;
  }
  
  .header-actions {
    flex-shrink: 0;
    gap: 8px;
    display: flex !important;
    min-width: 100px;
    justify-content: flex-end;
  }
  
  .theme-toggle {
    width: 42px;
    height: 42px;
    font-size: 18px;
    flex-shrink: 0;
    min-width: 42px;
  }
  
  #logoutBtn {
    margin-left: 0 !important;
    width: 42px;
    min-width: 42px;
  }
  
  .main-container {
    margin-top: 60px;
    padding: 15px;
  }
  
  .platforms-hero {
    padding: 20px 15px;
  }
  
  .platforms-hero h1 {
    font-size: 28px;
    letter-spacing: 1px;
    margin-bottom: 12px;
  }
  
  .platforms-hero h1::before,
  .platforms-hero h1::after {
    font-size: 18px;
    margin: 0 8px;
  }
  
  .platforms-hero p {
    font-size: 11px;
    letter-spacing: 1px;
  }
  
  .presets {
    grid-template-columns: 1fr;
  }
  
  .device-card-container {
    height: auto;
    min-height: 160px;
  }
  
  .device-card {
    min-height: 160px;
  }
  
  .device-card-container:hover .device-card {
    transform: rotateY(0deg) scale(1);
  }
  
  .card-front,
  .card-back {
    padding: 8px;
  }
  
  .device-icon {
    font-size: 22px;
    line-height: 1;
  }
  
  .device-header {
    gap: 4px;
  }
  
  .device-info h3 {
    font-size: 12px;
  }
  
  .quick-action {
    height: 26px;
    font-size: 14px;
  }
  
  /* Centralização extra para emojis no mobile */
  .device-icon {
    width: 32px;
    height: 32px;
  }
  
  .device-name {
    font-size: 16px;
  }
  
  .device-type {
    font-size: 11px;
  }
  
  .device-status {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .quick-action {
    padding: 10px;
    font-size: 10px;
  }
  
  .control-content {
    padding: 25px 15px;
  }
  
  .control-header h2 {
    font-size: 18px;
  }
  
  /* Modal eWeLink em tela cheia no mobile - OTIMIZADO */
  .popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
  }
  
  .popup-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    transform: none !important;
    border: none;
    clip-path: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }
  
  .popup-container::before {
    display: none;
  }
  
  .popup-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--glass-border);
    height: 50px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .popup-header::after {
    display: none;
  }
  
  .popup-header h3 {
    font-size: 13px;
    gap: 8px;
    letter-spacing: 0.5px;
    margin: 0;
  }
  
  .popup-close {
    width: 36px;
    height: 36px;
    font-size: 18px;
    clip-path: none;
    border-radius: 8px;
    background: rgba(255, 0, 85, 0.4);
    border-color: var(--danger);
    flex-shrink: 0;
  }
  
  .popup-body {
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100% - 50px);
    overflow: hidden;
  }
  
  .popup-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
  }
  
  .popup-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
  }
  
  /* Mobile: permitir scroll horizontal para conteúdo desktop */
  .popup-container.mobile-view .popup-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .popup-container.mobile-view .popup-iframe {
    min-width: 100%;
    width: 100%;
    height: 100%;
  }
  
  /* Prevenir scroll e overflow no fundo */
  body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
  }
  
  html.modal-open {
    overflow: hidden !important;
  }
  
  /* Desabilitar alguns efeitos pesados em mobile */
  .floating-particles {
    display: none;
  }
  
  .scan-lines {
    opacity: 0.3;
  }
  
  .grid-background {
    background-size: 30px 30px;
    animation: none;
  }
  
  /* Botões flutuantes em mobile */
  .float-btn {
    width: 56px;
    height: 56px;
  }
  
  .float-btn-avatar {
    width: 52px;
    height: 52px;
  }
  
  /* Ajustar posição para não sobrepor */
  .float-btn-agente,
  .float-btn-painel,
  .float-btn-dashboard {
    right: 16px !important;
  }
  
  .float-btn-agente {
    bottom: 16px !important;
  }
  
  .float-btn-painel {
    bottom: 86px !important;
  }
  
  .float-btn-dashboard {
    bottom: 156px !important;
  }
}

/* ===== BOTÕES FLUTUANTES ===== */
.float-btn {
  position: fixed;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: none;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--primary-glow);
  z-index: 9998;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: float-bounce 2s ease-in-out infinite;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.float-btn:active {
  cursor: grabbing;
}

.float-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 12px 32px var(--primary-glow), var(--shadow-neon);
  animation: none;
}

.float-btn:active {
  transform: scale(0.95);
}

.float-btn.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.5) translateY(20px);
}

/* Posicionamento dos botões */
.float-btn-back {
  bottom: 30px;
  left: 30px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.9), rgba(0, 136, 255, 0.9));
}

.float-btn-back:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 1), rgba(0, 136, 255, 1));
  transform: translateX(-5px) scale(1.05);
}

.float-btn-agente {
  bottom: 30px;
  right: 30px;
}

.float-btn-painel {
  bottom: 110px;
  right: 30px;
}

/* Avatar do agente */
.float-btn-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  position: relative;
  z-index: 2;
}

.float-btn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* SVG Casa Inteligente */
.float-btn-icon {
  width: 32px;
  height: 32px;
  color: white;
  position: relative;
  z-index: 2;
}

/* Efeito de pulso */
.float-btn-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  opacity: 0.6;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

/* Spinner pequeno para botões */
.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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