/* 重置和基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: url('img/DSCN1126.JPG') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(60, 60, 60, 0.65); /* 更深的遮罩，讓背景更淡 */
    z-index: 0;
    pointer-events: none;
}

.main, .header, .nav, .container {
    position: relative;
    z-index: 1;
}

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

/* 標題區域 */
.header {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
    text-align: center;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 導航 */
.nav {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav .container {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.nav-btn {
    background: none;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: #667eea;
    color: white;
}

/* 主要內容區域 */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.content-section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 區段標題 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.section-header h2 {
    color: #333;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

/* 照片畫廊 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.gallery.list-view {
    grid-template-columns: 1fr;
}

.photo-item {
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* 照片載入佔位符 */
.photo-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e3e3e3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.error-placeholder {
    color: #e74c3c;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}



/* 影片網格 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.video-item {
    cursor: pointer;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: inherit;
}

/* 手機版防止長按另存 */
@media (max-width: 768px) {
    .video-thumbnail {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .video-thumbnail img {
        pointer-events: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-play-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}



/* 燈箱 */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin-bottom: 80px;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    touch-action: pan-y pinch-zoom;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
}

    .lightbox-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        font-size: 1.5rem;
        padding: 1rem;
        cursor: pointer;
        border-radius: 50%;
        transition: all 0.3s ease;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    .lightbox-nav:hover {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .lightbox-prev {
        left: -60px;
    }
    
    .lightbox-next {
        right: -60px;
    }
    
    /* 手機版箭頭按鈕優化 */
    @media (max-width: 768px) {
        .lightbox-nav {
            font-size: 1.2rem;
            padding: 0.8rem;
            background: rgba(0, 0, 0, 0.6);
        }
        
        .lightbox-prev {
            left: 10px;
        }
        
        .lightbox-next {
            right: 10px;
        }
    }

.lightbox-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 1.1rem;
}

/* 影片播放器模態框 */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

    .video-modal-content {
        position: relative;
        max-width: 90%;
        max-height: 90%;
        margin-bottom: 80px;
    }

.video-modal-content video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    position: relative;
    z-index: 1;
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1003;
}

.video-modal-nav-container {
    /* 移除，因為按鈕現在是絕對定位的 */
}

/* 影片模態框導航按鈕 */
.video-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.video-modal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.video-modal-prev {
    left: -60px;
}

.video-modal-next {
    right: -60px;
}

/* 頁腳 */
.footer {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    text-align: center;
    color: white;
    margin-top: 2rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .nav .container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* 手機版隱藏下載和選取功能 */
    #download-selected-photos,
    #download-selected-videos,
    #select-all-photos,
    #select-all-videos,
    .photo-checkbox,
    .video-checkbox,
    label[for="select-all-photos"],
    label[for="select-all-videos"] {
        display: none !important;
    }
    
    /* 隱藏包含下載按鈕和全選的整個容器 */
    .content-section > div:first-child {
        display: none !important;
    }
    

    
    /* 手機版另存圖片按鈕 */
    .save-image-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 1003;
        transition: all 0.3s ease;
    }
    
    .save-image-btn:hover {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1.1);
    }
    
    .lightbox-nav {
        font-size: 1.2rem;
        padding: 0.8rem;
        background: rgba(0, 0, 0, 0.6);
        top: auto;
        bottom: -60px;
        transform: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-close,
    .video-modal-close {
        top: -30px;
        font-size: 1.5rem;
    }
    
    /* 手機版影片導航按鈕 */
    .video-modal-nav {
        font-size: 1.2rem;
        padding: 0.8rem;
        background: rgba(0, 0, 0, 0.6);
        top: auto;
        bottom: -60px;
        transform: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-modal-prev {
        left: 20px;
    }
    
    .video-modal-next {
        right: 20px;
    }
    
    /* 手機版影片模態框內容 */
    .video-modal-content {
        position: relative;
        max-width: 90%;
        max-height: 90%;
        margin-bottom: 80px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .nav .container {
        flex-direction: row;
        gap: 0.5rem;
        justify-content: center;
    }
    body {
        background: url('img/DSCN1126.JPG') no-repeat top center, #222;
        background-size: 600px auto;
        background-position: top center;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }
    body::before {
        background: rgba(60, 60, 60, 0.75);
    }
    .video-thumbnail {
        height: 33vw;
        min-height: 80px;
        max-height: 150px;
    }
    .video-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: inherit;
        display: block;
    }
}

/* 載入動畫 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
} 