/* 美觀的影片清單樣式 - 無動畫版本 */

/* 自訂字體與重置 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #333;
  line-height: 1.6;
}

/* 頁面佈局 */
header, main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 標題區域 */
.header {
  padding: 40px 20px 20px;
  text-align: center;
}

.header h1 {
  font-size: 3.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 工具列 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  padding: 25px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 搜尋表單 */
.search-form {
  display: flex;
  gap: 12px;
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
}

.search-input {
  flex: 1;
  padding: 16px 24px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  font-weight: 500;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
  background: rgba(255, 255, 255, 1);
}

.search-input::placeholder {
  color: #666;
  font-weight: 400;
}

/* 按鈕樣式 */
.btn {
  padding: 16px 28px;
  border: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 搜尋計數 */
.search-count {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* 影片網格 */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
  margin-top: 40px;
  padding: 20px 0;
}

/* 影片卡片 */
.video-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.video-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
  opacity: 0;
}

.video-card:hover::before {
  opacity: 1;
}

.video-card:hover {
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
    width: 100%;
    height: 320px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    /* padding: 20px; ← 把這行移除 */
    padding: 0; /* 確保圖片不被 padding 影響 */
}
.video-thumbnail img {
    max-height: 100%;
    height: auto;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}



.video-thumbnail:hover img {
  filter: brightness(1.05) contrast(1.05);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.thumbnail-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #ddd, #f0f0f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: #999;
  z-index: 1;
}

/* 影片資訊 */
.video-info {
  padding: 25px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.video-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #2d3436;
  line-height: 1.4;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  font-size: 0.9rem;
  color: #636e72;
  margin-bottom: 20px;
  line-height: 1.6;
  flex-grow: 1;
  font-weight: 400;
}

.video-meta br {
  margin-bottom: 4px;
}

/* 影片操作按鈕 */
.video-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.action-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  overflow: hidden;
}

.action-btn:disabled {
  background: #b2bec3;
  cursor: not-allowed;
  opacity: 0.6;
}

.fav-btn {
  background: linear-gradient(45deg, #e17055, #d63031);
  color: white;
  box-shadow: 0 4px 15px rgba(225, 112, 85, 0.3);
}

.fav-btn.active {
  background: linear-gradient(45deg, #d63031, #c0392b);
  box-shadow: 0 6px 20px rgba(214, 48, 49, 0.4);
}

.fav-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(225, 112, 85, 0.4);
}

.play-btn {
  background: linear-gradient(45deg, #00b894, #00a085);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.play-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
  background: linear-gradient(45deg, #00a085, #008f75);
}

/* 搜尋資訊樣式 */
.search-info {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.search-term {
  font-size: 16px;
  margin-bottom: 8px;
  color: #667eea;
}

.search-hint {
  font-size: 14px;
  color: #888;
  opacity: 0.8;
}

.search-suggestion {
  margin-top: 12px;
  font-size: 14px;
  color: #888;
  font-style: italic;
}

.hint-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #667eea;
}

.hint-items div {
  margin: 4px 0;
  padding-left: 8px;
}

mark {
  background: rgba(255, 235, 59, 0.8) !important;
  color: #000 !important;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 600;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2.5rem;
  }
  
  .toolbar {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
  }
  
  .search-form {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }
  
  .video-thumbnail {
    height: 250px;
    padding: 15px;
  }
  
  .video-info {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 20px;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .video-thumbnail {
    height: 200px;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 12px;
  }
  
  .action-btn {
    font-size: 14px;
    padding: 12px 16px;
  }
}

/* 滾動條美化 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 影片播放模態視窗 */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 0;
  min-height: 300px;
}

.modal-body video {
  width: 100%;
  height: auto;
  display: block;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #666;
  background: #f8f9fa;
}

.video-placeholder p {
  margin: 10px 0;
  font-size: 1.1rem;
}

/* 毛玻璃效果 */
.toolbar,
.video-card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.video-modal video {
    outline: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.video-modal video:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .video-modal video {
        max-width: 95%;
        max-height: 80%;
    }
}

/* 播放按鈕樣式增強 */
.play-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.play-btn:active {
    transform: translateY(0);
}

.play-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.series-link {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
}

.series-link:hover {
    color: #2980b9;
}

.actor-link {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
}

.actor-link:hover {
    color: #2980b9;
}
/* select 一致 btn-primary 風格 */
select.btn-primary {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin: 0 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    height: 40px;
    line-height: 40px;
    text-align-last: center;
}

/* option 內黑字 */
select.btn-primary option {
    color: black;
}

/* select-wrapper 讓 select 看起來跟按鈕一樣 */
.select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: 999px;
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    height: 40px;
    line-height: 40px;
    margin: 0 5px;
    position: relative;
}

.select-wrapper select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.select-wrapper::after {
    content: "▼";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 12px;
    color: white;
}
#sortSelect {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

#sortSelect option:checked {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-secondary:disabled {
    background-color: #6c757d;
    opacity: 0.5;
    cursor: not-allowed;
}

#sortPreview {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #007bff;
    word-wrap: break-word;
}

/* 提示樣式 */
.sort-hint {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}
/* 延遲載入圖片樣式 */
.lazy-load {
    transition: opacity 0.3s ease;
    opacity: 0.7;
}

.lazy-load.loaded {
    opacity: 1;
}

.lazy-load:not(.loaded) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-skeleton 1.5s infinite;
}

@keyframes loading-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 載入中的圖片樣式 */
.video-thumbnail {
    position: relative;
    overflow: hidden;
}

.video-thumbnail img.lazy-load:not(.loaded) {
    filter: blur(2px);
}