/* Shared portal UI components: device cards, modals */

.portal-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.portal-device-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: #fff;
}

.portal-device-card.is-inactive {
  background: #f9fafb;
}

.portal-device-card.is-inactive .portal-device-card-id,
.portal-device-card.is-inactive .portal-device-card-meta dd {
  color: #9ca3af;
}

.portal-device-card-title {
    display: block;
    font-size: 1rem;
    margin: 0 0 4px;
}

.portal-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.portal-badge-online {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.portal-badge-offline {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.portal-device-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.portal-device-card-id {
  font-size: 13px;
  word-break: break-all;
}

.portal-device-card-meta {
  display: grid;
  gap: 8px;
  margin: 0;
}

.portal-device-card-meta > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  font-size: 13px;
}

.portal-device-card-meta dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
}

.portal-device-card-meta dd {
  margin: 0;
  color: var(--text-color);
}

.portal-device-card-actions {
  display: flex;
  justify-content: flex-end;
}

.portal-bind-code-countdown {
  font-weight: 600;
}

.portal-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.portal-modal-overlay[aria-hidden="false"],
.portal-modal-overlay.is-open {
  display: flex;
}

.portal-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.portal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.portal-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #1f2328;
}

.portal-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  line-height: 1;
}

.portal-modal-close:hover {
  color: #1f2328;
}

.portal-modal-body {
  padding: 16px 24px;
}

.portal-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

body.portal-settings-modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .portal-device-grid {
    grid-template-columns: 1fr;
  }

  .portal-device-card-meta > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}