/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-dark: #1a1a1a;
  --secondary-dark: #2c3e50;
  --accent-blue: rgba(58, 56, 165, 0.918);
  --accent-green: rgba(0, 255, 100, 0.6);
  --accent-yellow: rgba(255, 200, 0, 0.6);
  --accent-red: #F44336;
  --text-light: #ecf0f1;
  --text-muted: #bdc3c7;
  --card-bg: #798bbe;
  --bg-color: #858484;
  --online-color: #4CAF50;
  --offline-color: #F44336;
  --warning-color: #f4c136;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --neon-blue: 0 0 20px 5px rgba(58, 56, 165, 0.918);
  --neon-green: 0 0 20px 5px rgba(0, 255, 100, 0.6);
  --neon-yellow: 0 0 20px 5px rgba(255, 200, 0, 0.6);
  --neon-red: 0 0 20px 5px rgba(244, 67, 54, 0.6);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-color);
  color: var(--text-light);
  line-height: 1.6;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.header {
  background: var(--secondary-dark);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header h1 {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
  color: var(--text-light);
  text-align: left;
}

/* ===== AUTH SECTION ===== */
.auth-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-email {
  font-size: 0.875rem;
  opacity: 0.9;
}

.user-role {
  font-size: 0.75rem;
  color: var(--warning-color);
  background: rgba(244, 193, 54, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  align-self: flex-start;
}

/* ===== BUTTONS ===== */
.btn-login {
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  color: #000;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: var(--neon-yellow);
}

.btn-logout {
  background: transparent;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: rgba(244, 67, 54, 0.1);
  border-color: var(--accent-red);
}

.btn-control {
  background: var(--secondary-dark);
  color: var(--text-light);
  border: 2px solid transparent;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 60px;
}

.btn-control:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

.btn-control:active:not(:disabled) {
  transform: translateY(0);
}

.btn-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-control.active {
  background: var(--accent-blue);
  box-shadow: var(--neon-blue);
}

.btn-icon {
  font-size: 1.25rem;
}

/* ===== MAIN LAYOUT ===== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== DEVICE PANEL ===== */
.device-panel {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.device-panel:hover {
  transform: translateY(-4px);
}

.device-panel h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  color: var(--text-light);
  margin: 0;
}

.device-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.device-status.online {
  background: var(--online-color);
  box-shadow: 0 0 8px var(--online-color);
  animation: pulse 2s infinite;
}

.device-status.offline {
  background: var(--offline-color);
  box-shadow: 0 0 8px var(--offline-color);
}

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

/* ===== DEVICE INFO ===== */
.device-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-light);
}

/* ===== SENSOR PANELS ===== */
.sensor-panel {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.sensor-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
}

.sensor-panel h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.sensor-value {
  font-size: 3rem;
  font-weight: 300;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1rem 0;
}

.sensor-value .unit {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.sensor-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Sensor grid for device 2 */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.sensor-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

/* ===== CONTROL PANELS ===== */
.control-panel {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
}

.control-panel h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
}

.btn-mode {
  flex-direction: column;
  min-height: 80px;
  padding: 0.75rem;
}

.btn-mode .btn-icon {
  font-size: 1.5rem;
}

/* ===== STATUS INDICATORS ===== */
.status-indicator,
.control-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-top: 1rem;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.led-on {
  background: var(--online-color);
  box-shadow: 0 0 8px var(--online-color);
}

.led-off {
  background: var(--offline-color);
  box-shadow: 0 0 8px var(--offline-color);
}

/* ===== AUTH OVERLAY ===== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.auth-overlay.visible {
  display: flex;
}

.auth-modal {
  background: var(--secondary-dark);
  padding: 2.5rem;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--neon-yellow);
  animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-modal h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--warning-color);
}

.auth-modal p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .device-panel {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }
  
  .header h1 {
    font-size: 1.25rem;
  }
  
  .dashboard {
    padding: 0.75rem;
    gap: 1rem;
  }
  
  .device-panel {
    padding: 1rem;
    border-radius: 12px;
  }
  
  .sensor-value {
    font-size: 2.5rem;
  }
  
  .btn-control {
    padding: 0.875rem 1rem;
    min-height: 50px;
  }
  
  .btn-icon {
    font-size: 1.125rem;
  }
  
  .control-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .user-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .device-info {
    grid-template-columns: 1fr;
  }
  
  .sensor-grid {
    grid-template-columns: 1fr;
  }
  
  .control-grid {
    grid-template-columns: 1fr;
  }
  
  .btn-login {
    width: 100%;
    justify-content: center;
  }
  
  .auth-modal {
    padding: 1.5rem;
  }
}
/* ДОБАВИТЬ в конец файла styles.css */

/* Стили для главной страницы */
.welcome-section {
  text-align: center;
  padding: 40px 20px;
  margin-top: 30px;
}

.devices-menu {
  max-width: 800px;
  margin: 0 auto;
}

.device-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.device-card {
  background: white;
  border-radius: 12px;
  padding: 30px 25px;
  text-decoration: none;
  color: #333;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 2px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.device-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: #4CAF50;
  background-color: #f9fff9;
}

.device-icon {
  font-size: 48px;
  margin-bottom: 20px;
  width: 80px;
  height: 80px;
  background: #f5f5f5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.device-card:hover .device-icon {
  background: #e8f5e9;
}

.device-card h3 {
  margin: 0 0 10px 0;
  color: #2c3e50;
  font-size: 1.5em;
}

.device-card p {
  color: #666;
  margin: 0;
  line-height: 1.5;
  font-size: 0.95em;
}

/* Кнопка назад в заголовке */
.header-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.btn-back {
  background: #6c757d;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9em;
  transition: background 0.3s;
}

.btn-back:hover {
  background: #5a6268;
}

.btn-logout {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.3s;
}

.btn-logout:hover {
  background: #c82333;
}

/* Подсказки для неавторизованных */
.hint {
  color: #6c757d;
  font-size: 0.9em;
  margin-top: 15px;
  text-align: center;
  font-style: italic;
}
/* ДОБАВИТЬ в конец файла styles.css - Стили для device1.html */

/* Новая цветовая схема для устройства 1 */
body[class*="device"] .header {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Панели устройства */
.device-panel {
  background: white;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8eaf6;
  transition: transform 0.3s, box-shadow 0.3s;
}

.device-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Заголовки панелей */
.device-panel h2 {
  color: #1a237e;
  border-bottom: 2px solid #e8eaf6;
  padding-bottom: 12px;
  margin-bottom: 20px;
  font-size: 1.4em;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Информация об устройстве */
.device-info {
  background: #f5f7ff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #d1d9ff;
}

.info-item:last-child {
  border-bottom: none;
}

.info-item .label {
  color: #3949ab;
  font-weight: 500;
}

.info-item .value {
  color: #1a237e;
  font-weight: 600;
}

/* Температурный датчик */
.sensor-panel {
  background: linear-gradient(135deg, #e8eaf6 0%, #f5f7ff 100%);
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  border: 2px solid #c5cae9;
}

.sensor-value {
  font-size: 3.5em;
  font-weight: 700;
  color: #1a237e;
  margin: 15px 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 5px;
}

.unit {
  font-size: 0.5em;
  color: #5c6bc0;
}

.sensor-meta {
  color: #5c6bc0;
  font-size: 0.9em;
}

/* Кнопка LED - новый дизайн */
.btn-control {
  background: linear-gradient(135deg, #3949ab 0%, #283593 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 18px 30px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  box-shadow: 0 6px 15px rgba(57, 73, 171, 0.3);
}

.btn-control:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(57, 73, 171, 0.4);
  background: linear-gradient(135deg, #303f9f 0%, #1a237e 100%);
}

.btn-control.active {
  background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
}

.btn-control:disabled {
  background: #b0b0b0;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Индикатор LED */
.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 15px;
  background: #f5f7ff;
  border-radius: 10px;
  font-weight: 500;
}

.indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.led-on {
  background: #4CAF50;
  box-shadow: 0 0 10px #4CAF50;
}

.led-off {
  background: #f44336;
  box-shadow: 0 0 10px #f44336;
}

/* Статус устройства */
.device-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.device-status.online {
  background: #4CAF50;
  box-shadow: 0 0 8px #4CAF50;
}

.device-status.offline {
  background: #f44336;
  box-shadow: 0 0 8px #f44336;
}