* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header Styles */
header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header h1 i {
  margin-right: 10px;
}

.subtitle {
  font-size: 1.1em;
  opacity: 0.9;
}

/* Connection Status */
.connection-status {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 15px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 10px;
  background-color: #4caf50;
  box-shadow: 0 0 10px #4caf50;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.btn-scan {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-scan:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Category Navigation */
.category-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.category-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1em;
  backdrop-filter: blur(5px);
}

.category-btn i {
  margin-right: 5px;
}

.category-btn.active {
  background: white;
  color: #667eea;
  border-color: white;
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Devices Grid */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.device-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
}

.device-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  border-color: #667eea;
}

.device-card.active {
  border-color: #667eea;
  background: #f8f9ff;
}

.device-icon {
  font-size: 2.5em;
  color: #667eea;
  margin-bottom: 10px;
}

.device-name {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.device-room {
  font-size: 0.85em;
  color: #666;
}

.device-status {
  margin-top: 10px;
  font-size: 0.8em;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-block;
}

.device-status.online {
  background: #4caf50;
  color: white;
}

.device-status.offline {
  background: #f44336;
  color: white;
}

/* Control Panel */
.control-panel {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  display: none;
}

.control-panel.show {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.panel-header h3 {
  color: #333;
}

.panel-header h3 i {
  color: #667eea;
  margin-right: 10px;
}

.close-panel {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #666;
  transition: color 0.3s;
}

.close-panel:hover {
  color: #f44336;
}

.placeholder-message {
  text-align: center;
  padding: 40px;
  color: #999;
}

.placeholder-message i {
  font-size: 3em;
  margin-bottom: 10px;
}

/* Control Content Styles */
.control-content {
  padding: 10px 0;
}

.power-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 1.2em;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 20px;
}

.power-btn:hover {
  transform: scale(1.05);
}

.control-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.control-btn {
  background: #f5f5f5;
  border: none;
  padding: 15px;
  border-radius: 10px;
  font-size: 1.2em;
  cursor: pointer;
  transition: all 0.3s;
}

.control-btn:hover {
  background: #e0e0e0;
}

.slider-container {
  margin: 20px 0;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: #666;
}

.slider {
  width: 100%;
  height: 5px;
  border-radius: 5px;
  background: #f0f0f0;
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
}

/* Add Device Button */
.add-device-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 1.1em;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
  z-index: 100;
}

.add-device-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.add-device-btn i {
  margin-right: 10px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal.show {
  display: block;
}

.modal-content {
  background: white;
  margin: 50px auto;
  padding: 30px;
  max-width: 500px;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #999;
  transition: color 0.3s;
}

.close:hover {
  color: #f44336;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #333;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s;
}

.submit-btn:hover {
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
  header h1 {
    font-size: 2em;
  }

  .category-nav {
    justify-content: center;
  }

  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .add-device-btn {
    bottom: 20px;
    right: 20px;
    padding: 12px 25px;
  }
}
