/* ===== Local Font Integration ===== */
@font-face {
  font-family: 'LocalInter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/inter.woff2') format('woff2');
}

:root {
  --light-bg-rgb: 255, 255, 255;
  --dark-bg-rgb: 15, 23, 42;
  --card-alpha: 0.35;
  --font-family: 'LocalInter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  height: 100%;
  width: 100%;
}

body {
  font-family: var(--font-family);
  background-size: cover;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button:hover {
  background: var(--control-bg);
}

div p {
  opacity: 0.85;
}

#slider {
  position: absolute;
  left: 15px;
  top: 15px;
  z-index: 10;
}

#slider svg {
  width: 36px;
  height: 36px;
  transition: transform 0.2s ease;
}

#slider:hover svg {
  transform: scale(1.1);
}

.theme-aware-icon {
  filter: invert(0) brightness(1);
  transition: filter 0.3s ease;
}

.dark .theme-aware-icon {
  filter: invert(1) brightness(1.2);
}

#sliderRange {
  display: none;
  position: absolute;
  border: none;
  top: 19px;
  left: 60px;
  filter: invert(0.8);
}

.light, .card {
  background-color: rgba(var(--light-bg-rgb), var(--card-alpha));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: black;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.card {
  border-radius: 10px;
  padding: 2rem 1rem;
  margin: 1rem auto;
  font-size: 1.1em;
  width: 65%;
  text-align: center;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  transition: all 0.2s;
}

.card:hover {
  transition: all 0.1s;
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(206, 140, 210, 0.2);
}

/* Status Title & Labels */
.card h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem 0;
  letter-spacing: -0.02em;
}

.card h3 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

#status {
  font-weight: 700;
  transition: color 0.3s ease;
}

.awake {
  color: #059669;
}

.dark .awake {
  color: #34d399;
}

.sleeping {
  color: #64748b;
}

.error {
  color: #ef4444;
}

#additional-info {
  font-size: 1rem;
  color: inherit;
  opacity: 0.85;
  margin: 0.75rem 0 1.25rem 0;
  line-height: 1.6;
}

/* Device Chips Component */
.device-chips-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 1.5rem 0 1rem 0;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 0.92rem;
  font-weight: 500;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: all 0.25s ease;
}

.dark .device-chip {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.device-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}



.device-chip .device-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.device-chip .device-svg-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  vertical-align: middle;
}

.device-chip .device-name {
  font-weight: 600;
}

.device-chip .device-app {
  opacity: 0.8;
  font-size: 0.85rem;
}

/* Transition Animations for SSE Live Updates */
.status-fade-in {
  animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0.3; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

#last-updated {
  font-size: 0.82rem;
  opacity: 0.75;
  margin-top: 1.25rem;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 20px;
  box-sizing: border-box;
}

/* Media Queries */
@media (max-width: 1250px) {
  .card { width: 70%; }
}

@media (max-width: 750px) {
  body { touch-action: pan-y; }
  .card { width: 85%; padding: 2rem 1.25rem; }
}

@media (max-width: 500px) {
  .card { width: 92%; padding: 1.75rem 1rem; }
  .card h1 { font-size: 1.8rem; }
  .card h3 { font-size: 1.15rem; }
}

/* Device Modal Dialog */
.device-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-modal-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  padding: 24px 28px;
  width: 90%;
  max-width: 440px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeIn 0.25s ease;
}

.dark .device-modal-card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.device-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 12px;
}

.dark .device-modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.device-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-device-icon {
  display: inline-flex;
  align-items: center;
}

.device-modal-svg-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.device-modal-close {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.device-modal-close:hover {
  opacity: 1;
}

.modal-info-item {
  margin-bottom: 14px;
  font-size: 0.95rem;
  text-align: left;
}

.modal-info-label {
  display: block;
  font-size: 0.8rem;
  opacity: 0.65;
  margin-bottom: 4px;
}

.modal-info-value.app-name {
  font-weight: 600;
  word-break: break-word;
  color: #059669;
}

.dark .modal-info-value.app-name {
  color: #34d399;
}

.modal-app-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 150px;
  overflow-y: auto;
}

.modal-app-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(100, 116, 139, 0.16);
  word-break: break-word;
}

.modal-app-list li span {
  flex: 0 0 auto;
  opacity: 0.7;
  white-space: nowrap;
}
