@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --text-light: #f8f9fa;
  --text-dark: #e9ecef;
  --accent: #00e5ff;
  --accent-hover: #00b8d4;
  --danger: #ff1744;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-color: #000; /* Fallback */
}

/* YouTube Video Background - Scaled to cover screen */
.video-background {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw; /* 100 * 9 / 16 */
  min-height: 100vh;
  min-width: 177.77vh; /* 100 * 16 / 9 */
  transform: translate(-50%, -50%);
  z-index: -2;
  pointer-events: none;
}
.video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 15, 40, 0.2); /* Much lighter so the video is clearly visible */
  z-index: -1;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-panel:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.2);
}

h1, h2, h3 {
  color: #fff;
  font-weight: 600;
  margin-top: 0;
  letter-spacing: 0.5px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: -webkit-linear-gradient(45deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  text-align: center;
  transition: all 0.3s ease;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.4);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.6);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 23, 68, 0.4);
}
.btn-danger:hover {
  background: #d50000;
  transform: scale(1.05);
}

.btn-success {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-success:hover {
  background: rgba(255,255,255,0.25);
}

input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%;
  padding: 14px 16px;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  transition: all 0.3s;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

select option {
  background: #001e3c;
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

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

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

/* Beautiful iOS style toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(26px);
}

.timer-inputs {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.9em;
  color: var(--text-dark);
}
.timer-inputs input[type="time"] {
  padding: 8px 12px;
  width: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  position: relative;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 5px;
  opacity: 0.6;
  transition: opacity 0.3s;
  color: var(--accent);
}
.icon-btn:hover {
  opacity: 1;
}

/* Neon glow for relay states */
.relay-on {
  box-shadow: 0 0 15px rgba(0, 255, 100, 0.3) !important;
  border-color: rgba(0, 255, 100, 0.4) !important;
}
.relay-off {
  box-shadow: 0 0 15px rgba(255, 20, 60, 0.3) !important;
  border-color: rgba(255, 20, 60, 0.4) !important;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(0,0,0,0.3);
  padding: 5px 12px;
  border-radius: 20px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online {
  background-color: #00ff64;
  box-shadow: 0 0 10px #00ff64;
}
.status-dot.offline {
  background-color: #ff143c;
  box-shadow: 0 0 10px #ff143c;
}

.temp-display {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
  line-height: 1;
}

.logout-global {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(255, 23, 68, 0.6);
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    text-align: center;
    padding-top: 40px;
  }
  .top-titles h1 {
    font-size: 2rem;
  }
  .top-stats {
    margin-top: 15px;
    text-align: center !important;
  }
  .logout-global {
    padding: 8px 16px;
    font-size: 0.85rem;
    top: 15px;
    right: 15px;
  }
  .temp-display {
    font-size: 3rem;
  }
  .glass-panel {
    padding: 20px 15px;
  }
}

/* Minimalist login */
.login-container {
  max-width: 420px;
  margin: 15vh auto;
  text-align: center;
}
.login-container p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 30px;
}
