.layout {
  display: flex;
  min-height: 100vh;
  background-color: #f8fafc;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
}

.logo-text h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: white;
}

.logo-text span {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 400;
}

.sidebar-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: none;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-item-active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-left-color: #667eea;
}

.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.nav-label {
  font-weight: 500;
  font-size: 14px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background: white;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  color: #374151;
  transition: background-color 0.2s ease;
}

.menu-toggle:hover {
  background: #f3f4f6;
}

.header-title h1 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.header-title p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.header-actions {
  margin-left: auto;
}

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Desktop */
@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 280px;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .menu-toggle {
    display: none;
  }

  .sidebar-close {
    display: none;
  }
}

/* Tablet */
@media (max-width: 1023px) and (min-width: 768px) {
  .sidebar-overlay {
    display: block;
  }

  .sidebar-close {
    display: block;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .sidebar {
    width: 100%;
    max-width: 320px;
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-close {
    display: block;
  }

  .header {
    padding: 12px 16px;
  }

  .header-title h1 {
    font-size: 18px;
  }

  .header-title p {
    font-size: 12px;
  }

  .page-content {
    padding: 16px;
  }

  .logo-text h2 {
    font-size: 16px;
  }

  .nav-item {
    padding: 16px 24px;
  }

  .nav-label {
    font-size: 16px;
  }
  
  .connection-text {
    display: none;
  }
  
  .connection-status {
    padding: 6px 8px;
  }
}

/* =====================================================
   STATUS DE CONEXÃO
   ===================================================== */

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.connection-icon {
  width: 14px;
  height: 14px;
}

.connection-text {
  font-size: 12px;
}

.connection-connected {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.connection-disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.connection-error {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Animação de pulso para status offline */
.connection-disconnected,
.connection-error {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}
