/* TV端样式 - 遥控器友好设计 */

:root {
  --primary-color: #4A90E2;
  --success-color: #2ECC71;
  --danger-color: #E74C3C;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --text-light: #ffffff;
  --text-muted: #a0a0a0;
  --focus-ring: 0 0 0 4px rgba(74, 144, 226, 0.6);
  --focus-scale: 1.05;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  overflow: hidden;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.logo {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 二维码区域 */
.qr-container {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.qr-code {
  width: 300px;
  height: 300px;
  margin: 0 auto 1.5rem;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code canvas {
  width: 100% !important;
  height: 100% !important;
}

.qr-hint {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* 连接信息 */
.connection-info {
  margin-top: 2rem;
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted);
}

.connection-info p {
  margin: 0.5rem 0;
}

#local-url {
  color: var(--primary-color);
  font-weight: bold;
}

#room-id {
  color: var(--success-color);
  font-weight: bold;
  font-size: 1.5rem;
  letter-spacing: 2px;
}

/* 状态栏 */
.status-bar {
  margin-top: 2rem;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-radius: 50px;
  font-size: 1.1rem;
}

#connection-status {
  color: var(--text-muted);
}

#connection-status.connected {
  color: var(--success-color);
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  padding: 3rem;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.modal-content p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.2rem;
}

.modal-actions {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

/* 按钮样式 */
.btn {
  padding: 1rem 2.5rem;
  font-size: 1.2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #357ABD;
  transform: scale(var(--focus-scale));
  box-shadow: var(--focus-ring);
  outline: none;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #5a6268;
  transform: scale(var(--focus-scale));
  box-shadow: var(--focus-ring);
  outline: none;
}

/* 投屏状态 */
#casting-state {
  position: relative;
  padding: 0;
}

#remote-video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: black;
}

/* 控制菜单 */
.control-menu {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  background: rgba(0, 0, 0, 0.7);
  padding: 1.5rem 2.5rem;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  transition: opacity 0.3s ease;
}

.control-menu.hidden {
  opacity: 0;
  pointer-events: none;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 2px solid transparent;
  color: white;
  padding: 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 80px;
}

.control-btn .icon {
  font-size: 2rem;
}

.control-btn span:last-child {
  font-size: 0.9rem;
}

.control-btn:hover,
.control-btn:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: scale(var(--focus-scale));
  box-shadow: var(--focus-ring);
  outline: none;
}

/* 状态胶囊 */
.status-capsule {
  position: absolute;
  top: 30px;
  right: 30px;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.status-capsule.hidden {
  opacity: 0;
}

#cast-duration,
#signal-strength {
  color: white;
}

/* 工具类 */
.hidden {
  display: none !important;
}

/* 遥控器焦点样式增强 */
*:focus {
  outline: none;
}

button:focus-visible {
  box-shadow: var(--focus-ring);
  transform: scale(var(--focus-scale));
}

/* 华为TV适配 */
@media screen and (device-width: 3840px) {
  .qr-code {
    width: 400px;
    height: 400px;
  }
  
  .logo {
    font-size: 4rem;
  }
}

/* 加载动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
