/* =============================================================================
   [sensor.css] 센서 연결 UI 스타일 (USB + BLE 통합)
   - 로테이션 홈 화면 하단의 연결 섹션
   - 연결 버튼 + 연결된 기기 카드 목록
   ============================================================================= */

/* ── 센서 섹션 컨테이너 ──────────────────────────────────── */
#sensor-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: #fafafa;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
}

/* ── 연결 버튼 행 (USB / BLE) ────────────────────────────── */
.sensor-connect-row {
  display: flex;
  gap: 8px;
}

.sensor-btn {
  flex: 1;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sensor-btn-connect {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: #fff;
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}
.sensor-btn-connect:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(33, 150, 243, 0.4);
}
.sensor-btn-connect:active {
  transform: translateY(0);
}

/* BLE 버튼은 보라색 계열로 구분 */
.sensor-btn-ble {
  background: linear-gradient(135deg, #7E57C2, #5E35B1);
  box-shadow: 0 2px 6px rgba(126, 87, 194, 0.3);
}
.sensor-btn-ble:hover {
  box-shadow: 0 3px 10px rgba(126, 87, 194, 0.4);
}

/* ── 연결 없음 안내 ──────────────────────────────────────── */
.sensor-empty {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: #999;
  font-weight: 700;
  background: #fff;
  border: 1.5px dashed #ddd;
  border-radius: 8px;
  line-height: 1.5;
}

/* ── 연결된 기기 목록 ────────────────────────────────────── */
.sensor-device-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sensor-device-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sensor-device-card.connected {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-color: #66bb6a;
}

.sensor-device-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.sensor-device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  flex-shrink: 0;
  animation: sensorPulse 1.8s ease-in-out infinite;
}

.sensor-device-name {
  flex: 1;
  font-size: 12px;
  font-weight: 800;
  color: #2e7d32;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sensor-device-disconnect {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 800;
  background: #fff;
  color: #666;
  border: 1.5px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.sensor-device-disconnect:hover {
  background: #f5f5f5;
  border-color: #999;
  color: #333;
}

/* ── 연결 상태 표시등 펄스 애니메이션 ────────────────────── */
@keyframes sensorPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.4); }
}

/* ── 미지원 브라우저 안내 ────────────────────────────────── */
.sensor-unsupported {
  padding: 12px;
  background: #fff3cd;
  border: 1.5px solid #ffc107;
  border-radius: 10px;
  font-size: 11px;
  color: #856404;
  text-align: center;
  font-weight: 700;
  line-height: 1.6;
}

/* ── 센서 미연결 시 HIT / START 버튼 비활성화 ─────────────
   rotation.js가 .sensor-required 클래스를 토글해 제어 */
.rot-hit-btn.sensor-required,
.rot-start-btn.sensor-required {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.6);
  pointer-events: none;
}

/* ── 센서 연결 안내 툴팁 (READY 화면 미연결 시) ──────────── */
.sensor-required-hint {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fff3cd;
  border: 1.5px dashed #ffc107;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #856404;
  text-align: center;
  line-height: 1.5;
}
.sensor-required-hint .sensor-link {
  color: #1976D2;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 900;
}

/* ── 타격 피드백 플래시 효과 (향후 CRITICAL 타격 시) ────── */
@keyframes sensorFlash {
  0%   { background: rgba(255, 59, 48, 0); }
  30%  { background: rgba(255, 59, 48, 0.25); }
  100% { background: rgba(255, 59, 48, 0); }
}
.sensor-flash-critical {
  animation: sensorFlash 0.35s ease-out;
}