/* ========== GLOBAL LAYOUT / HEADER / SUMMARY / BUTTON / LOADING UI ========== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f3f4f8;
  color: #111827;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- HEADER ---------------- */
.page-header {
  padding: 16px 24px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
}

.page-subtitle {
  font-size: 12px;
  color: #6b7280;
}

/* 헤더 내부 정렬 */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.header-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 헤더 오른쪽 아이콘 */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  color: #4b5563;
  font-size: 14px;

  transition: background 0.15s ease, color 0.15s ease,
              box-shadow 0.15s ease, transform 0.08s ease;
}

.header-btn:hover {
  background: #e5e7eb;
  color: #111827;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.header-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.header-btn i {
  color: #374151 !important;
  pointer-events: none;
}

/* ---------------- BODY ---------------- */
.page-body {
  padding: 20px 24px 32px;
  flex: 1;
}

/* ---------------- SUMMARY GRID ---------------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-card .btn {
  flex: 1;                 /* 🔥 버튼을 가로로 넓게 늘림 */
  /* padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px; */
  display: flex;
  align-items: center;
  justify-content: center;  /* 아이콘 + 텍스트 가운데 정렬 */
  gap: 6px;                /* 아이콘 간격 */
  border: none;
  cursor: pointer;
  color: #ffffff;
}

.summary-card > div:last-child {
  width: 100%;
  display: flex;
  gap: 16px;               /* 두 버튼 사이 간격 */
}


.summary-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #ffffff;
}

.summary-icon.play { background: #22c55e; }
.summary-icon.stop { background: #ef4444; }
.summary-icon.master-play { background: #2563eb; }
.summary-icon.master-stop { background: #f97316; }

.summary-text-title {
  font-weight: 500;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.summary-text-value {
  font-size: 20px;
  font-weight: 600;
}

.summary-button-wrapper {
  width: 100%;
}

.summary-button-wrapper .summary-text-title {
  text-align: center;
  margin-bottom: 6px;
}

/* ---------------- BUTTONS ---------------- */
.btn {
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;

  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.18);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.25);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.btn-play-all {
  background: #22c55e;
  color: #ffffff;
}

.btn-stop-all {
  background: #ef4444;
  color: #ffffff;
}

/* 전체 제어 버튼 pending 상태 */
.summary-button-wrapper .btn.is-pending {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
  transform: none;
}

.summary-button-wrapper .btn.is-pending i {
  animation: spin 0.8s linear infinite;
}

/* ---------------- FOOTER ---------------- */
footer {
  padding: 16px 24px 20px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

footer span.brand {
  font-weight: 600;
  color: #111827;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------------- LOADING OVERLAY ---------------- */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-box {
  background: #ffffff;
  padding: 20px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.loading-box p {
  margin: 0;
  font-size: 14px;
  color: #4b5563;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

:root {
  /* 카드 폭만 변수로 빼두면 필요하면 나중에 조절 가능 */
  --device-card-width: 260px;
}

/* 가로 스크롤 영역 */
.device-row-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;

  margin-left: 0 !important;
  padding-left: 0 !important;
}

/* ✅ 카드 폭 고정 */
.device-row-scroll .device-card {
  flex: 0 0 var(--device-card-width);
  max-width: var(--device-card-width);
}

.btn-led-play {
  background: #facc15;      /* 따뜻한 LED 노란빛 */
  color: #111;
}
.btn-led-play:hover {
  background: #eab308;
}

.btn-led-stop {
  background: #4b5563;      /* LED 끄기 → 회색톤 */
  color: #fff;
}
.btn-led-stop:hover {
  background: #374151;
}
/* 🔥 작동/정지 요약 숫자 줄 공통 */
.summary-count-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* 숫자 + 단위는 "같은 크기" */
.count-number,
.count-unit {
  font-size: 15px;
}

/* 숫자만 Bold */
.count-number {
  font-weight: 700;
}

/* 단위는 보통 굵기 */
.count-unit {
  font-weight: 400;
}

/* 제목 + 숫자 + 단위를 한 줄로 */
.summary-line {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

/* 한 줄 안에서 쓰는 title은 margin-bottom 없애기 */
.summary-line .summary-text-title {
  margin-bottom: 0;
}

/* 숫자만 커스텀 */
.summary-count-number {
  font-size: 18px;    /* 제목보다 살짝 크게 */
  font-weight: 700;   /* Bold */
  color: #111827;     /* 진한 색 (원하는 색으로 변경 가능) */
}
