/* =========================================
   Video — 特斯拉车机视频站样式 v2
   深色主题 · 大按钮触控优化 · iframe嵌入平台
   ========================================= */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-card: #222222;
  --bg-hover: #2a2a2a;
  --text-primary: #e8e8e8;
  --text-secondary: #888888;
  --accent: #e74c3c;
  --accent-hover: #c0392b;
  --border: #333333;
  --radius: 12px;
  --radius-small: 8px;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, "Helvetica Neue", "PingFang SC", sans-serif;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* ========== 顶部导航 ========== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.nas-config-btn {
  font-size: 15px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
}

.nas-config-btn:hover {
  background: var(--bg-hover);
}

/* ========== 标签页导航 ========== */
.tab-nav {
  display: flex;
  padding: 10px 16px;
  gap: 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-small);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 48px; /* 触控友好 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.tab:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========== 标签内容区 ========== */
.tab-content {
  display: none;
  padding: 16px 20px;
  min-height: calc(100vh - 130px);
}

.tab-content.active {
  display: block;
}

/* ========== NAS 状态 ========== */
.nas-status {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  line-height: 1.6;
}

.nas-status.connected {
  color: #27ae60;
}

.nas-status.error {
  color: var(--accent);
}

/* ========== 视频网格 ========== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.video-card:hover {
  transform: scale(1.03);
  background: var(--bg-hover);
}

.video-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-secondary);
}

.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card-info {
  padding: 10px 12px;
}

.video-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========== 平台说明区 ========== */
.platform-note {
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}

.platform-note p {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

/* ========== 快速链接网格 ========== */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 110px;
  color: var(--text-primary);
  text-align: center;
}

.quick-link:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.quick-link-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.quick-link-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.quick-link-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========== 平台工具栏 ========== */
.platform-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.platform-toolbar input {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  outline: none;
}

.platform-toolbar input:focus {
  border-color: var(--accent);
}

.platform-toolbar input::placeholder {
  color: var(--text-secondary);
}

/* ========== 收藏区 ========== */
.bili-favorites {
  margin-bottom: 20px;
}

.bili-favorites h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.fav-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 8px;
  min-height: 48px; /* 触控友好 */
}

.fav-card:hover {
  background: var(--bg-hover);
}

.fav-card-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.fav-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-card-delete {
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  min-width: 44px; /* 触控友好 */
  text-align: center;
}

.fav-card-delete:hover {
  color: var(--accent);
}

/* ========== iframe 嵌入区 ========== */
.site-embed {
  margin-top: 12px;
}

.embed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-small) var(--radius-small) 0 0;
  border: 1px solid var(--border);
}

.embed-title {
  font-size: 16px;
  font-weight: 600;
}

.site-embed iframe {
  width: 100%;
  height: calc(100vh - 260px);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-small) var(--radius-small);
  background: #000;
}

/* ========== 全屏播放器 ========== */
.fullscreen-player {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.player-close {
  padding: 12px 20px;
  font-size: 18px;
  color: var(--text-primary);
  cursor: pointer;
  background: rgba(0,0,0,0.5);
  text-align: right;
  z-index: 10;
  min-height: 48px;
}

.player-close:hover {
  color: var(--accent);
}

.player-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ========== 按钮样式 ========== */
.btn {
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  min-height: 48px; /* 触控友好 */
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-small {
  padding: 10px 16px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
  min-height: 44px;
}

.btn-small:hover {
  background: var(--bg-hover);
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  border: 1px solid var(--border);
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  font-size: 14px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  outline: none;
  min-height: 48px;
}

.form-group input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ========== 响应式 ========== */

/* 小屏（手机/平板） */
@media (max-width: 768px) {
  .tab {
    font-size: 13px;
    padding: 10px 4px;
  }
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .platform-toolbar {
    flex-wrap: wrap;
  }
  .platform-toolbar input {
    flex: 1 1 100%;
  }
}

/* 车机大屏 1920x1080 / 1280x720 */
@media (min-width: 1200px) {
  .tab {
    font-size: 18px;
    padding: 16px 12px;
  }
  .btn {
    padding: 16px 28px;
    font-size: 18px;
  }
  .platform-toolbar input {
    padding: 16px 20px;
    font-size: 18px;
  }
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .video-card-title {
    font-size: 16px;
  }
  .site-embed iframe {
    height: calc(100vh - 240px);
  }
  .quick-links {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .quick-link {
    min-height: 130px;
  }
  .quick-link-icon {
    font-size: 40px;
  }
  .quick-link-title {
    font-size: 17px;
  }
}

/* ========== Canvas 播放模式 (v3.2) ========== */
.canvas-video-element {
  background: #000;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.canvas-player-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(0,0,0,0.85);
  padding: 12px 20px;
  border-radius: 12px;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.canvas-player-time {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  min-width: 100px;
  text-align: center;
}

.canvas-player-hint {
  max-width: 600px;
  margin: 60px auto;
  padding: 32px;
  background: rgba(20,20,30,0.95);
  border-radius: 12px;
  color: var(--text);
}

.canvas-player-hint h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--accent);
}

.canvas-player-hint code {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #ffd9a3;
}

.canvas-player-hint a {
  color: var(--accent);
}
