/* ============================================
   DEVICES LIST SCREEN
   Frosted glass overlay (like menu/conversations),
   centered title, same menu pattern.
   ============================================ */

.devices-screen {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: rgba(247, 247, 245, 0.88);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-radius: var(--frame-radius);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
}

.devices-screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Header: back | title | menu — aligned with home logo-row ---- */

.devices-header {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Same vertical band as .logo-row: logo is 30px tall, menu 24px centers with 3px inset */
  min-height: 30px;
  margin-top: max(30px, env(safe-area-inset-top, 0px));
  padding: 0 var(--side-padding);
}

.devices-back {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.devices-back:hover {
  background: rgba(0, 0, 0, 0.05);
}

.devices-header-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  color: #1A1A1A;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

/* Menu: uses .menu-btn from home.css (same icon, same rules) */

/* ---- Tabs ---- */

.devices-tabs {
  flex-shrink: 0;
  display: flex;
  margin: 0 var(--side-padding);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.devices-tab {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  line-height: 24px;
  color: rgba(26, 26, 26, 0.45);
  position: relative;
  cursor: pointer;
  transition: color 0.2s ease;
}

.devices-tab.active {
  color: #1A1A1A;
}

.devices-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background-color 0.2s ease;
}

.devices-tab.active::after {
  background: #1A1A1A;
}

/* ---- Filter ---- */

.devices-filter-bar {
  flex-shrink: 0;
  padding: 16px var(--side-padding) 4px;
}

.devices-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 100px;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease;
}

.devices-filter-btn:hover {
  background: rgba(0, 0, 0, 0.07);
}

.devices-filter-btn svg {
  width: 18px;
  height: 18px;
  color: #1A1A1A;
  stroke-width: 2;
}

.devices-filter-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 13px;
  color: #1A1A1A;
  line-height: 20px;
  letter-spacing: 0.1px;
}

/* ---- Scrollable Content ---- */

.devices-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px var(--side-padding) 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.devices-content::-webkit-scrollbar {
  display: none;
}

/* ---- Category ---- */

.device-category {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-category-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  color: #1A1A1A;
  line-height: normal;
  letter-spacing: -0.1px;
}

/* ---- Device Card — glassmorphism ---- */

.device-card {
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-left-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.device-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 60%);
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.device-card:hover {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.device-card:hover::before {
  opacity: 0.7;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .device-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }
}

/* ---- Left: icon + info ---- */

.device-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.device-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: #1A1A1A;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}

.device-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.device-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.device-name {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  color: #1A1A1A;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-check-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #00c37f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-check-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Orange alert badge — next to device name when there is a warning */
.device-alert-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff9500;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  margin-left: 5px;
}

.device-status {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.5);
  line-height: normal;
}

/* ---- Right: signal + chevron ---- */

.device-card-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.device-signal {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.device-signal-bar {
  width: 3px;
  border-radius: 1px;
  background: #00c37f;
}

.device-signal-bar:nth-child(1) { height: 4px; }
.device-signal-bar:nth-child(2) { height: 7px; }
.device-signal-bar:nth-child(3) { height: 10px; }
.device-signal-bar:nth-child(4) { height: 13px; }
.device-signal-bar:nth-child(5) { height: 16px; }

.device-signal--weak .device-signal-bar:nth-child(3),
.device-signal--weak .device-signal-bar:nth-child(4),
.device-signal--weak .device-signal-bar:nth-child(5) {
  background: rgba(0, 0, 0, 0.1);
}

.device-signal--offline .device-signal-bar {
  background: rgba(0, 0, 0, 0.1);
}

.device-chevron {
  width: 20px;
  height: 20px;
  color: #1A1A1A;
  opacity: 0.35;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-chevron svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}
