/* ============================================
   影像实验室 - 全局样式
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #8b5cf6;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #252542;
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #2e2e4a;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo span { -webkit-text-fill-color: var(--text); }

.logo-domain {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  margin-left: 8px;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.nav-links { display: flex; gap: 24px; }

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover { color: var(--text); }

/* Hero */
.hero { text-align: center; padding: 60px 0 50px; }

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.85rem, 1.8vw, 1.1rem);
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding: 0 20px;
}

/* Video Grid - Masonry 瀑布流 */
.video-grid {
  position: relative;
  padding: 20px 0 60px;
}

.video-card {
  position: absolute;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--border);
  will-change: transform;
}

.video-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  border-color: var(--primary);
}

/* 缩略图严格按视频原始比例 */
.video-thumbnail {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}

.video-thumbnail img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transition: var(--transition);
}

.video-card:hover .video-thumbnail img { transform: scale(1.04); }

.play-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  background: rgba(99, 102, 241, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: var(--transition);
  z-index: 2;
}

.play-overlay::before {
  content: '';
  width: 0; height: 0;
  border-left: 18px solid white;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 4px;
}

.video-card:hover .play-overlay {
  background: rgba(255, 255, 255, 0.95);
  opacity: 1;
}

.video-card:hover .play-overlay::before {
  border-left-color: var(--primary);
}

.video-info { padding: 14px 16px 18px; }

.video-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; overflow-wrap: break-word; }

.video-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Detail Page */
.detail-header { padding: 20px 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: var(--transition);
}

.back-link:hover { color: var(--primary); }

.back-link::before { content: '\2190'; font-size: 1.2rem; }

/* Video Player - 严格按视频原始比例，零黑边 */
.video-player-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  /* 默认 16:9 */
  aspect-ratio: 16 / 9;
}

.video-player-container[data-ratio="16:9"] { aspect-ratio: 16 / 9; }
.video-player-container[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.video-player-container[data-ratio="1:1"] {
  aspect-ratio: 1 / 1;
  max-width: 700px;
  margin: 0 auto;
}
.video-player-container[data-ratio="3:4"] {
  aspect-ratio: 3 / 4;
  max-width: 640px;
  margin: 0 auto;
}
.video-player-container[data-ratio="9:16"] {
  aspect-ratio: 9 / 16;
  max-width: 420px;
  margin: 0 auto;
}

.video-player-container video,
.video-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

/* Detail Section */
.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
}

.detail-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 24px; }

.detail-table { width: 100%; border-collapse: collapse; }

.detail-table tr { border-bottom: 1px solid var(--border); }

.detail-table tr:last-child { border-bottom: none; }

.detail-table td { padding: 16px 0; vertical-align: top; }

.detail-table td:first-child {
  width: 140px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.detail-table td:last-child {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Solutions Grid */
.solutions-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
}

.solutions-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.solutions-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

.solutions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.solution-image {
  aspect-ratio: 16 / 10;
  background: var(--bg);
  overflow: hidden;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.solution-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.solution-image:hover img { transform: scale(1.05); }

.solution-text {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.solution-text p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* Nav Buttons */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid var(--border);
  cursor: pointer;
}

.nav-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.nav-btn.prev::before { content: '\2190'; }

.nav-btn.next::after { content: '\2192'; }

.nav-btn.home::before { content: '\2302'; }

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-btn:disabled:hover {
  background: var(--bg-card);
  border-color: var(--border);
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 50px 0 30px;
  margin-top: 60px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* 联系方式 - 主行（大号加粗） */
.contact-main {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 900px;
  padding: 0 20px;
}

/* 联系方式 - 副行（普通文案） */
.contact-sub {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 30px;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 700px;
  padding: 0 20px;
}

.footer-copy { color: var(--text-muted); font-size: 0.85rem; }

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Admin Styles */
.admin-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-header h1 { font-size: 1.5rem; }

.admin-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
}

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

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

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

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

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-small { padding: 6px 14px; font-size: 0.85rem; }

.btn-success { background: #16a34a; border-color: #16a34a; }

.btn-success:hover { background: #15803d; border-color: #15803d; }

/* Works List */
.works-list { display: flex; flex-direction: column; gap: 16px; }

.work-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.work-thumb {
  width: 160px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
}

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

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

.work-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }

.work-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-count { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; }

.work-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.upload-area:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }

.upload-area.has-file {
  border-style: solid;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.upload-area input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon { font-size: 2rem; margin-bottom: 8px; }

.upload-text { color: var(--text-secondary); font-size: 0.9rem; }

.upload-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

.upload-preview {
  margin-top: 12px;
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  display: none;
}

.upload-preview.active { display: inline-block; }

.upload-filename { color: var(--primary); font-size: 0.85rem; margin-top: 8px; word-break: break-all; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 { font-size: 1.2rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 24px; }

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

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Solution Items */
.solution-items { display: flex; flex-direction: column; gap: 16px; }

.solution-item-row {
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.solution-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.solution-item-header span { font-size: 0.85rem; color: var(--text-muted); }

.solution-item-row .upload-area { padding: 16px; margin-bottom: 12px; }

.solution-item-row .form-group { margin-bottom: 0; }

.solution-item-row .form-group input { padding: 10px 12px; font-size: 0.9rem; }

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Help Box */
.help-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.help-box h3 { font-size: 1rem; margin-bottom: 12px; }

.help-box ol {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
}

.help-box code {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--primary);
}

/* Status Messages */
.status-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.status-msg.active { display: block; }

.status-msg.success { background: rgba(22, 163, 74, 0.1); border: 1px solid rgba(22, 163, 74, 0.3); color: #4ade80; }

.status-msg.error { background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.3); color: #f87171; }

/* Responsive */
@media (max-width: 768px) {
  .video-grid { grid-template-columns: 1fr; gap: 20px; }
  .solutions-grid { grid-template-columns: 1fr; }
  .solution-image { border-right: none; }
  .form-row { grid-template-columns: 1fr; }
  .work-card { flex-direction: column; }
  .work-thumb { width: 100%; height: 160px; }
  .nav-buttons { flex-direction: column; }
  .nav-btn { justify-content: center; width: 100%; }
  .hero { padding: 40px 0 30px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
