/* ============================================================
   夸克视频站 - 全局样式（前台 + 后台共用）
   ============================================================ */

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

/* hidden 属性必须始终生效（防止被下方 display 规则覆盖） */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: #000;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- 前台：抖音式视频流 ---------------- */

.feed {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.feed-column {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 460px;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

@media (min-width: 768px) {
  .feed {
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #000 100%);
  }
  .feed-column {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
  }
}

.slides {
  height: 100%;
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.slide {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

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

.slide-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.38) 0%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0) 65%,
    rgba(0, 0, 0, 0.66) 100%
  );
}

.slide-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  pointer-events: none;
  z-index: 3;
}

/* 顶栏 */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 14px 10px;
  color: #fff;
  pointer-events: none;
}

.site-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.topbar .round-btn {
  pointer-events: auto;
}

.round-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s;
}

.round-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

.round-btn svg {
  width: 20px;
  height: 20px;
}

/* 公告 */
.notice {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* 右侧控制 */
.side-controls {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.page-idx {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 页脚 */
.footer {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  padding: 0 12px;
}

/* ---------------- 弹窗 ---------------- */

.popup-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}

.popup-card {
  width: 100%;
  max-width: 340px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: bounce-in 0.3s ease-out;
}

@keyframes bounce-in {
  0% {
    transform: scale(0.88);
    opacity: 0;
  }
  55% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.popup-head {
  position: relative;
  padding: 22px 20px 20px;
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  color: #fff;
  border-radius: 18px 18px 0 0;
}

.popup-head h3 {
  font-size: 20px;
  font-weight: 700;
  padding-right: 30px;
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-body {
  padding: 18px 20px 22px;
}

.popup-body .popup-content {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.link-box svg {
  flex-shrink: 0;
  color: #9ca3af;
}

.link-box span {
  flex: 1;
  font-size: 12px;
  color: #6b7280;
  word-break: break-all;
  line-height: 1.5;
}

.copy-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px 0;
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(219, 39, 119, 0.35);
  transition: opacity 0.2s, transform 0.1s;
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.open-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  padding: 11px 0;
  border-radius: 12px;
  border: 1px solid #c4b5fd;
  color: #7c3aed;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: #faf5ff;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(60px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  max-width: 86vw;
  text-align: center;
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------------- 加载失败 ---------------- */

.load-error {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0b0b12;
  color: #fff;
}

.load-error p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
}

.load-error button {
  border: none;
  border-radius: 999px;
  padding: 10px 28px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ============================================================
   后台
   ============================================================ */

.admin-body {
  background: #f3f4f6;
  color: #1f2937;
  min-height: 100%;
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-header .inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 {
  font-size: 17px;
  font-weight: 700;
}

.admin-header .logout {
  border: none;
  background: none;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.tabs {
  display: flex;
  gap: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
  margin-bottom: 20px;
}

.tabs button {
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.tabs button.active {
  background: #7c3aed;
  color: #fff;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
}

.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  font-size: 14px;
  color: #1f2937;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.field .hint {
  margin-top: 5px;
  font-size: 12px;
  color: #9ca3af;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff;
}

.btn-ghost {
  background: #f3f4f6;
  color: #374151;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* 开关 */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d1d5db;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.switch.on {
  background: #7c3aed;
}

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.2s;
}

.switch.on .knob {
  left: 23px;
}

/* 视频列表 */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.video-thumb {
  width: 84px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}

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

.video-info {
  flex: 1;
  min-width: 0;
}

.video-info .t {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-info .s {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: #e5e7eb;
}

.icon-btn.danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e1b4b, #4c1d95, #831843);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 30px 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-card .logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 14px;
}

.login-card h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
}

.login-card .sub {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 22px;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
}

.login-card input[type="password"]:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  max-height: 90vh;
  overflow-y: auto;
  animation: bounce-in 0.25s ease-out;
}

.modal-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

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

.modal-actions .btn {
  flex: 1;
}

.empty-tip {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 30px 0;
}

@media (max-width: 520px) {
  .tabs {
    width: 100%;
  }
  .tabs button {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
    font-size: 13px;
  }
}
