/**
 * LoveiMag 愛分享 - 主要樣式表
 */

/* CSS 變數 */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    --primary-rgb: 0, 123, 255;
    --font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 基礎設定 */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
    overflow-x: hidden;
}

.main-content {
    margin-top: 76px; /* 導航欄高度 */
    min-height: calc(100vh - 76px);
}

/* 通用樣式 */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), rgba(var(--primary-rgb), 0.5));
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

/* 按鈕樣式 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

/* 導航欄樣式 */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color) !important;
}

/* 主橫幅樣式 */
.hero-section {
    position: relative;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
}

.hero-slide {
    position: relative;
    height: 100vh;
    min-height: 600px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
}

/* 橫幅濾鏡樣式改由 dynamic-css.php 動態生成 */
/* 此處僅保留基本定位，透明度由後台設定控制 */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    /* background 由動態 CSS 控制 */
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-btn {
    font-size: 1.1rem;
    padding: 12px 30px;
    box-shadow: var(--box-shadow);
}

.default-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    position: relative;
}

.default-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-badge .badge {
    font-size: 0.9rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.hero-features {
    max-width: 600px;
    margin: 0 auto;
}

.feature-item {
    color: white;
    padding: 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-align: center;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.feature-item i {
    display: block;
    color: white;
}

.feature-item div {
    font-size: 0.9rem;
    font-weight: 500;
}

.hero-actions {
    margin-top: 2rem;
}

.hero-scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
}

.scroll-indicator {
    animation: bounce 2s infinite;
    cursor: pointer;
}

.scroll-indicator i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.scroll-indicator small {
    font-size: 0.8rem;
    opacity: 0.8;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Swiper 輪播樣式 - 優化版 */
.hero-swiper {
    position: relative;
    overflow: hidden;
}

.hero-swiper .swiper-button-next,
.hero-swiper .swiper-button-prev {
    color: white;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-top: -30px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hero-swiper .swiper-button-next:hover,
.hero-swiper .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.hero-swiper .swiper-button-next:after,
.hero-swiper .swiper-button-prev:after {
    font-size: 22px;
    font-weight: bold;
}

.hero-swiper .swiper-pagination {
    bottom: 30px !important;
}

.hero-swiper .swiper-pagination-bullet {
    width: 40px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
    margin: 0 4px;
    transition: all 0.3s ease;
}

.hero-swiper .swiper-pagination-bullet-active {
    background: white;
    width: 60px;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

/* 橫幅內容動畫 */
.hero-content {
    animation: fadeInUp 1s ease-out;
}

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

/* 響應式優化 */
@media (max-width: 768px) {
    .hero-swiper .swiper-button-next,
    .hero-swiper .swiper-button-prev {
        width: 45px;
        height: 45px;
        margin-top: -22.5px;
    }
    
    .hero-swiper .swiper-button-next:after,
    .hero-swiper .swiper-button-prev:after {
        font-size: 18px;
    }
    
    .hero-swiper .swiper-pagination-bullet {
        width: 30px;
        height: 4px;
    }
    
    .hero-swiper .swiper-pagination-bullet-active {
        width: 45px;
    }
}

/* 影片播放器樣式 */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 比例 */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: #000;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--border-radius);
}

.video-player-section {
    background: #f8f9fa;
}

.video-info {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.video-title {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.video-meta .badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
}

.video-description {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1.5rem;
}

.video-actions {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.share-buttons .btn {
    margin-bottom: 0.5rem;
}

/* 相關影片樣式 */
.related-videos {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.related-video-item {
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.related-video-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-thumbnail:hover .video-overlay {
    opacity: 1;
}

.video-play-btn {
    color: white;
    font-size: 2rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.video-play-btn:hover {
    color: white;
    transform: scale(1.2);
}

/* 影片卡片樣式優化 */
.video-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    height: 100%;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.video-thumbnail-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* 服務項目樣式 */
.service-card {
    background: white;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.service-icon {
    color: var(--primary-color);
    transition: var(--transition);
}

.service-card:hover .service-icon {
    transform: scale(1.1);
    color: var(--info-color);
}

.service-title {
    font-weight: 600;
    color: var(--dark-color);
}

.service-description {
    color: var(--secondary-color);
    line-height: 1.8;
}

/* 案例作品樣式 */
.portfolio-card {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    background: white;
}

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.portfolio-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
}

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

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.1) 0%,
        rgba(0,0,0,0.3) 50%,
        rgba(0,0,0,0.8) 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transition: var(--transition);
    padding: 2rem;
}

.portfolio-card:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-card:hover .portfolio-image {
    transform: scale(1.05);
}

.portfolio-content {
    text-align: center;
    color: white;
    transform: translateY(20px);
    transition: var(--transition);
}

.portfolio-card:hover .portfolio-content {
    transform: translateY(0);
}

.portfolio-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.portfolio-category {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.portfolio-actions .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Masonry 佈局 */
.masonry-grid {
    column-count: 3;
    column-gap: 1.5rem;
}

.masonry-grid .portfolio-card {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

@media (max-width: 991px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (max-width: 575px) {
    .masonry-grid {
        column-count: 1;
    }
}

/* 影片樣式 */
.video-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.video-thumbnail-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
}

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

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

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

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

.video-play-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.video-play-btn:hover {
    background: white;
    transform: scale(1.1);
}

.instagram-play-btn {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.instagram-play-btn:hover {
    transform: scale(1.1);
}

.instagram-play-btn small {
    font-size: 0.7rem;
    margin-top: -5px;
}

.video-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.video-info {
    padding: 1.5rem;
}

.video-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.video-category {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.video-description {
    color: var(--secondary-color);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.video-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* 篩選按鈕 */
.filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 8px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 25px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 頁尾樣式 */
.footer {
    background: var(--dark-color) !important;
}

.footer h5 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.footer h6 {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color) !important;
    padding-left: 5px;
}

.social-links .btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.contact-info .fas {
    width: 20px;
    text-align: center;
}

/* 聯絡表單樣式 */
.contact-form {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Toast 通知樣式 */
.toast {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.toast-header {
    background: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* 載入動畫 */
.loading {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* 響應式設計 */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 991px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .service-card {
        padding: 2rem 1.5rem;
    }
    
    .contact-form {
        padding: 2rem;
    }
}

@media (max-width: 767px) {
    .main-content {
        margin-top: 56px;
    }
    
    .hero-section {
        height: 80vh;
        min-height: 500px;
    }
    
    .hero-slide {
        height: 80vh;
        min-height: 500px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .service-card {
        padding: 2rem 1rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .filter-buttons {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 確保手機版導航菜單可以正常點擊 */
    .navbar-collapse {
        background: white;
        padding: 1rem 0;
        border-radius: var(--border-radius);
        margin-top: 0.5rem;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 1029;
        position: relative;
    }
    
    .navbar-nav {
        width: 100%;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0.5rem;
        display: block;
        width: calc(100% - 1rem);
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.2);
    }
    
    .navbar-nav .nav-item {
        width: 100%;
    }
    
    /* 確保案例卡片在手機版可以點擊 */
    .portfolio-image-wrapper {
        cursor: pointer !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(var(--primary-rgb), 0.2);
    }
    
    .portfolio-card {
        margin-bottom: 1rem;
        touch-action: manipulation;
    }
    
    /* 隱藏所有 overlay 效果在手機模式下，但保留點擊功能 */
    .video-overlay,
    .portfolio-overlay,
    .service-overlay {
        display: none !important;
    }
    
    /* 為手機版添加視覺反饋 */
    .portfolio-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

@media (max-width: 575px) {
    .hero-content {
        padding: 0 1rem;
    }
    
    .service-card,
    .contact-form {
        padding: 1.5rem;
    }
    
    .btn-back-to-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-color: #f8f9fa;
        --light-color: #343a40;
    }
}

/* 列印樣式 */
@media print {
    .navbar,
    .footer,
    .btn-back-to-top,
    .video-overlay,
    .portfolio-overlay,
    .service-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}
