/* ========================================
   社群分享區塊樣式 - 完整增強版 (模組化版本)
   ======================================== */

/* === 通用容器 === */
.social-share-wrapper {
    margin: 50px 0;
}

.social-module-group:not(:first-child) {
    margin-top: 25px;
}

/* === 標準版面 === */
.social-share-container {
    display: flex;
    align-items: center;
    gap: 0px;
    padding: 30px;
    background: #4a4a4a;
    border-radius: 8px;
    align-items: stretch;
    background: #333; /* Dark background matching mockup */
    border-radius: 0; /* Mockup looks square or slightly rounded, let's go with 0 or small radius if user wants, but usually full width blocks are square. User said "like this", image shows sharp edges or small radius. Let's keep 0 for now or small. */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 0;
    min-height: 220px; /* Reduced height */
}

.social-share-container:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* === 圖片區域 === */
.social-share-image {
    width: 46%; /* Reduced width slightly to give more room to content if needed, or keep 50% */
    min-width: 220px;
    margin: 0;
    padding: 0;
    display: flex;
    position: relative;
    background-color: #000; /* Background for letterboxing */
}

.social-share-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure full image is visible */
    border-radius: 0;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.3s ease;
}

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

/* === 內容區域 === */
.social-share-content {
    flex: 1;
    padding: 20px; /* Reduced padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Center align content */
    background: #333; /* Dark background */
    color: #fff; /* White text */
    box-shadow: none;
    border-radius: 0;
}
.social-share-title {
    margin: 0 0 10px; /* Reduced margin */
    font-size: 1.3rem; /* Slightly smaller font */
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.3;
}



.social-share-subtitle {
    margin: 0 0 15px; /* Reduced margin */
    color: #eee;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    opacity: 0.9;
}

/* === 按鈕包裝器 === */
.social-button-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Reduced gap */
    margin-top: 10px; /* Reduced margin */
    justify-content: center; /* Center buttons */
}

/* Horizontal Layout: No Wrap */
.social-button-wrapper.layout-horizontal {
    flex-wrap: nowrap !important; /* Force no wrap */
    overflow-x: auto; /* Allow scrolling if needed */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px; /* Space for scrollbar if it appears */
    justify-content: flex-start; /* Align start to prevent centering issues when scrolling */
}

/* Vertical Layout: Stacked & Centered */
.social-button-wrapper.layout-vertical {
    flex-direction: column;
    align-items: center; /* Center items horizontally */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.social-button-wrapper.layout-vertical .social-share-btn {
    width: auto; /* Natural width */
    min-width: 180px; /* Minimum width for consistency */
    justify-content: center;
    margin: 0;
}

/* === 基礎按鈕樣式 === */
.social-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Center content */
    gap: 5px; /* Reduced gap */
    padding: 6px 12px; /* Smaller padding */
    border-radius: 50px;
    text-decoration: none !important;
    color: #fff;
    font-weight: 500;
    font-size: 0.9rem; /* Slightly smaller font */
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: none;
    cursor: pointer;
    min-width: 100px; /* Reduced min-width */
}
.social-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
    opacity: 0.95;
}

.social-share-btn svg {
    width: 20px; /* Smaller icon */
    height: 20px;
    flex-shrink: 0;
}

/* === 平台專屬顏色 === */
.facebook-btn {
    background: #1877f2;
}

.facebook-btn:hover {
    background: #145dbf;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.google-news-btn {
    background: #4285f4;
}

.google-news-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.line-btn {
    background: #00b900;
}

.line-btn:hover {
    background: #009900;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 185, 0, 0.4);
}

.twitter-btn {
    background: #1da1f2;
}

.twitter-btn:hover {
    background: #0c85d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.4);
}

/* === 按鈕樣式變體 === */
/* 圓角樣式 */
.button-style-rounded .social-share-btn {
    border-radius: 25px;
    padding: 10px 25px; /* Adjusted padding */
}

/* 極簡樣式 */
.button-style-minimal .social-share-btn {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
}

.button-style-minimal .facebook-btn:hover {
    background: #1877f2;
    border-color: #1877f2;
}

.button-style-minimal .google-news-btn:hover {
    background: #4285f4;
    border-color: #4285f4;
}

.button-style-minimal .line-btn:hover {
    background: #00b900;
    border-color: #00b900;
}

.button-style-minimal .twitter-btn:hover {
    background: #1da1f2;
    border-color: #1da1f2;
}

/* === 嵌入內容樣式 === */
.social-button-wrapper iframe {
    max-width: 100% !important;
}

.social-button-wrapper .social-module-group:not(:first-child) {
    margin-top: 15px;
}

/* === Google News 橫幅 === */
.gn-banner-container {
    display: flex;
    flex-wrap: wrap;
    max-width: 853px;
    margin: 25px auto 0;
    background-color: #e0eafd;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.gn-banner-container:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.gn-banner-left,
.gn-banner-right {
    flex: 1 1 100%;
}

.gn-banner-content {
    box-sizing: border-box;
    margin: 0 auto;
    align-items: center;
    display: flex;
    justify-content: center;
    height: 100%;
    padding: 15px;
}

.gn-banner-left .gn-banner-content a {
    font-size: 1.3rem;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.gn-banner-left .gn-banner-content a:hover {
    color: #4285f4;
}

.gn-banner-content a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    width: 100%;
}

.gn-banner-content img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gn-banner-right:hover .gn-banner-content img {
    transform: scale(1.05);
}

/* === 載入動畫 === */
@keyframes socialFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.social-share-wrapper {
    animation: socialFadeIn 0.6s ease;
}

/* === 按鈕點擊效果 === */
.social-share-btn:active {
    transform: translateY(0) scale(0.98);
}

/* === RWD === */
@media (max-width: 768px) {
    .social-share-container {
        flex-direction: column;
    }

    .social-share-image {
        width: 100%;
        height: auto; /* Allow height to adjust */
        min-height: 150px; /* Minimum height */
        max-height: 250px; /* Maximum height to prevent it from being too tall */
    }
    
    .social-share-content {
        padding: 15px 10px; /* Even smaller padding */
    }
    
    .social-share-title {
        font-size: 1.1rem; /* Smaller title */
        margin-bottom: 8px;
    }
    
    .social-share-subtitle {
        font-size: 0.85rem; /* Smaller subtitle */
        margin-bottom: 12px;
    }
    
    .social-share-btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 8px 20px;
        font-size: 0.9rem;
        margin-bottom: 0; /* Reset margin */
    }
    
    .social-button-wrapper {
        gap: 10px; /* Ensure gap is applied */
    }
    
    .gn-banner-container {
        margin: 20px 15px 0;
    }
    
    .gn-banner-left .gn-banner-content a {
        font-size: 1.1rem;
    }
}

@media (min-width: 768px) {
    .gn-banner-left,
    .gn-banner-right {
        flex: 1 1 50%;
    }
}

@media (max-width: 480px) {
    .social-share-wrapper {
        margin: 30px 0;
    }
    
    .social-share-container {
        padding: 20px 15px;
        border-radius: 6px;
    }
    
    .social-share-title {
        font-size: 18px;
    }
    
    .social-share-subtitle {
        font-size: 14px;
    }
    
    .social-share-btn {
        font-size: 14px;
        padding: 10px 20px;
        min-width: auto;
    }
    
    .social-share-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .gn-banner-left .gn-banner-content a {
        font-size: 1rem;
    }
}

/* === 深色模式支援 === */
@media (prefers-color-scheme: dark) {
    .social-share-container {
        background: #2a2a2a;
    }
    
    .gn-banner-container {
        background-color: #1a2332;
    }
    
    .gn-banner-left .gn-banner-content a {
        color: #e0e0e0;
    }
    
    .gn-banner-left .gn-banner-content a:hover {
        color: #6ba3f7;
    }
}

/* === 列印樣式 === */
@media print {
    .social-share-wrapper {
        display: none;
    }
}

/* === 無障礙改進 === */
.social-share-btn:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.social-share-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* === 動畫效果類別 === */
.social-animate-bounce {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === 特殊效果：漸層背景選項 === */
.social-share-container.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.social-share-container.gradient-bg-warm {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.social-share-container.gradient-bg-cool {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* === 新增按鈕樣式 === */

/* X (前 Twitter) - 黑色背景 */
.x-btn {
    background-color: #000000;
    color: #fff;
}
.x-btn:hover {
    background-color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: #000000;
}

/* Threads - 黑色背景 (與 X 類似，但圖示不同) */
.threads-btn {
    background-color: #000000;
    color: #fff;
}
.threads-btn:hover {
    background-color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: #000000;
}

/* Mix - 橘色背景 */
.mix-btn {
    background-color: #eb4924;
    color: #fff;
}
.mix-btn:hover {
    background-color: #ca3e1d;
    box-shadow: 0 4px 12px rgba(235, 73, 36, 0.4);
    border-color: #eb4924;
}

/* RWD 調整：手機版讓按鈕緊湊排列 */
@media (max-width: 768px) {
    .social-share-btn {
        flex: 1; /* 讓按鈕平均分配寬度 */
        min-width: auto; /* 取消最小寬度限制 */
        justify-content: center;
        padding: 8px 12px;
    }
    .social-share-btn span {
        display: none; /* 手機版隱藏文字，只顯示圖示，避免太擠 */
    }
    .social-button-wrapper {
        gap: 8px; /* 按鈕間距縮小 */
    }
}