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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.page {
  display: none;
  width: 100%;
  min-height: 100vh;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  padding-top: 40px;
}

.page.active {
  display: flex;
}

/* PAGE DE CONNEXION */
.login-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.5s ease-in;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header i {
  font-size: 60px;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.login-header h1 {
  color: #1e3c72;
  font-size: 28px;
  font-weight: 600;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #2a5298;
  font-size: 18px;
}

.input-group input {
  width: 100%;
  padding: 15px 15px 15px 50px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: white;
}

.input-group input:focus {
  outline: none;
  border-color: #2a5298;
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.toggle-password {
  position: absolute;
  right: 15px;
  left: auto;
  cursor: pointer;
  color: #7e8ba3;
  transition: color 0.3s ease;
}

.toggle-password:hover {
  color: #2a5298;
}

.remember-me {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
}

.remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #2a5298;
}

.remember-me label {
  color: #555;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.btn-login {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(30, 60, 114, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.error-message {
  color: #d32f2f;
  font-size: 14px;
  margin-top: 15px;
  text-align: center;
  display: none;
}

.error-message.show {
  display: block;
  animation: shake 0.5s ease;
}

/* PAGE DE CONTRÔLE */
.control-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 25px;
  padding-bottom: 90px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  animation: fadeIn 0.5s ease-in;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.header-content i {
  font-size: 32px;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-content h1 {
  color: #1e3c72;
  font-size: 20px;
  font-weight: 600;
}

.temp-box {
  background: #dc143c;
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(220, 20, 60, 0.4);
  border: 2px solid #a01020;
}

.dht11-temp {
  color: #ffff00;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-logout {
  background: linear-gradient(135deg, #d32f2f, #c62828);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(211, 47, 47, 0.4);
}

/* STATUT DE LA PORTE */
.status-container {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(30, 60, 114, 0.1),
    rgba(42, 82, 152, 0.05)
  );
  border-radius: 12px;
}

.status-icon {
  font-size: 60px;
  margin-bottom: 10px;
}

.status-icon i {
  transition: all 0.3s ease;
}

.status-icon.open i {
  color: #4caf50;
  animation: pulse 2s infinite;
}

.status-icon.closed i {
  color: #f44336;
}

.status-icon.unknown i {
  color: #ff9800;
}

.status-text {
  font-size: 20px;
  font-weight: 600;
  color: #1e3c72;
}

/* BOUTONS DE CONTRÔLE */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 15px;
}

.btn-control {
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: white;
}

.btn-control i {
  font-size: 32px;
}

.btn-open {
  background: linear-gradient(135deg, #4caf50, #45a049);
}

.btn-open:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(76, 175, 80, 0.4);
}

.btn-close {
  background: linear-gradient(135deg, #f44336, #e53935);
}

.btn-close:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(244, 67, 54, 0.4);
}

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

.btn-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* MESSAGES D'ACTION */
.action-message {
  text-align: center;
  padding: 15px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  margin-top: 15px;
  display: none;
}

.action-message.show {
  display: block;
  animation: slideDown 0.3s ease;
}

.action-message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 2px solid #4caf50;
}

.action-message.error {
  background: #ffebee;
  color: #c62828;
  border: 2px solid #f44336;
}

.action-message.info {
  background: #e3f2fd;
  color: #1565c0;
  border: 2px solid #2196f3;
}

/* FENÊTRE D'ÉTAT DE SANTÉ RASPBERRY PI - STYLE TERMINAL */
.raspberry-health-container {
  position: fixed;
  bottom: 20px;
  left: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.3;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  display: none;
  animation: slideUp 0.3s ease;
  text-align: center;
}

#controlPage.active .raspberry-health-container {
  display: block;
}

.health-status {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: #00ff00;
}

.health-icon {
  margin-right: 6px;
  font-size: 12px;
}

.health-text {
  font-weight: normal;
}

.health-offline .health-icon {
  color: #888;
}

.health-offline .health-text {
  color: #888;
}

.health-online .health-icon {
  color: #00ff00;
}

.health-online .health-text {
  color: #00ff00;
}

.health-error .health-icon {
  color: #ff0000;
}

.health-error .health-text {
  color: #ff0000;
}

.health-metrics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  color: #00ff00;
}

.health-metric {
  white-space: nowrap;
}

.health-metric span {
  color: #0f0;
  font-weight: bold;
}

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

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* RESPONSIVE */
@media (max-width: 600px) {
  .login-container {
    padding: 25px;
  }

  .control-container {
    padding: 20px;
    padding-bottom: 120px;
  }

  .page {
    padding-top: 20px;
  }

  .control-header {
    margin-bottom: 12px;
  }

  .header-content i {
    font-size: 28px;
  }

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

  .temp-box {
    padding: 4px 8px;
  }

  .dht11-temp {
    font-size: 14px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-control {
    padding: 18px;
    font-size: 15px;
  }

  .btn-control i {
    font-size: 28px;
  }

  .status-container {
    padding: 15px;
    margin-bottom: 15px;
  }

  .status-icon {
    font-size: 50px;
    margin-bottom: 8px;
  }

  .status-text {
    font-size: 18px;
  }

  .raspberry-health-container {
    font-size: 10px;
    bottom: 15px;
  }

  .health-metrics {
    flex-direction: column;
    gap: 2px;
    align-items: center;
  }
}
