/* ===================================
   EcShopCity Blog - 前台樣式表
   主色調：#9bdffd → #4bade1 漸變
   =================================== */

/* 變數定義 */
:root {
    --primary-gradient: linear-gradient(135deg, #9bdffd 0%, #4bade1 100%);
    --primary-light: #9bdffd;
    --primary-dark: #4bade1;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-light: #f0f5f9;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(75,173,225,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* 基礎重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

/* 文字樣式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 進度條 */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--primary-gradient);
    width: 0;
    z-index: 9999;
    transition: width 0.3s ease;
}

/* 導航欄 */
.site-header {
    background: var(--primary-gradient);
    box-shadow: 0 2px 10px rgba(75,173,225,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.navbar-brand .logo {
    display: flex;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-text {
    background: white;
    color: var(--primary-dark);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-right: 0.5rem;
}

.logo-blog {
    color: white;
}

/* 導航選單 */
.navbar-menu {
    flex: 1;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: white;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: white;
}

.nav-link:hover::after {
    width: 100%;
}

/* 下拉選單 */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    list-style: none;
    margin-top: 0.5rem;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.dropdown-menu li a:hover {
    background: var(--bg-light);
    color: var(--primary-dark);
    padding-left: 2rem;
}

/* 搜尋框 */
.search-form {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50px;
    padding: 0.25rem;
    transition: all 0.3s ease;
}

.search-form:focus-within {
    background: rgba(255,255,255,0.3);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.search-input {
    background: none;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    width: 200px;
    transition: width 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input:focus {
    outline: none;
    width: 250px;
}

.search-btn {
    background: none;
    border: none;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.search-btn:hover {
    transform: scale(1.1);
}

/* Hero 區域 */
.hero {
    background: var(--primary-gradient);
    color: white;
    padding: 5rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveGrid 20s linear infinite;
}

@keyframes moveGrid {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* 主要內容區域 */
.site-main {
    min-height: calc(100vh - 300px);
    padding: 3rem 0;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* 文章卡片 */
.articles-grid {
    display: grid;
    gap: 1.5rem;
}

.post-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.post-card:hover::before {
    transform: translateX(0);
}

.post-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.post-card h2 a {
    color: var(--text-primary);
    display: block;
}

.post-card h2 a:hover {
    color: var(--primary-dark);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.excerpt {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--primary-dark);
    font-weight: 500;
    transition: all 0.2s ease;
}

.read-more:hover {
    gap: 0.5rem;
}

/* 側邊欄 */
.sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar-widget {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bg-light);
}

.categories-list,
.recent-posts {
    list-style: none;
}

.categories-list li,
.recent-posts li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-light);
}

.categories-list li:last-child,
.recent-posts li:last-child {
    border-bottom: none;
}

.categories-list a,
.recent-posts a {
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.categories-list a:hover,
.recent-posts a:hover {
    color: var(--primary-dark);
    padding-left: 0.5rem;
}

/* 單篇文章頁面 */
.single-post {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
}

.post-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary-dark);
}

.post-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content h2,
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

.post-content blockquote {
    border-left: 4px solid var(--primary-dark);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-muted);
}

.post-content code {
    background: var(--bg-light);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.post-content pre {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* 分享按鈕 */
.post-share {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.share-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
}

.share-facebook {
    background: #1877f2;
    color: white;
}

.share-twitter {
    background: #1da1f2;
    color: white;
}

.share-linkedin {
    background: #0077b5;
    color: white;
}

.share-copy {
    background: var(--bg-light);
    color: var(--text-primary);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 相關文章 */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.related-post-item {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.related-post-item:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

.related-post-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.related-post-item .date {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 分頁 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination a {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.pagination a:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
}

.pagination .current {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.pagination .prev,
.pagination .next {
    padding: 0 1.5rem;
}

/* 頁腳 */
.site-footer {
    background: var(--bg-light);
    margin-top: 5rem;
}

.footer-widgets {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-widget h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.footer-widget p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--primary-dark);
}

/* 電子報表單 */
.newsletter-form {
    display: flex;
    margin-top: 1rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 0.875rem;
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary-dark);
}

.newsletter-form button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-form button:hover {
    box-shadow: var(--shadow-md);
}

.footer-bottom {
    padding: 1.5rem 0;
    background: white;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 返回頂部按鈕 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* 行動版選單 */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.navbar-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-dark);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .navbar-toggle {
        display: block;
    }
    
    .navbar-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: white;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease;
        z-index: 1001;
        overflow-y: auto;
    }
    
    .navbar-menu.active {
        left: 0;
    }
    
    .navbar-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 2rem;
        gap: 0;
    }
    
    .nav-link {
        color: var(--text-primary);
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .navbar-search {
        display: none;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .single-post {
        padding: 1.5rem;
    }
    
    .post-title {
        font-size: 1.75rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .post-card {
        padding: 1.5rem;
    }
    
    .share-buttons {
        flex-wrap: wrap;
    }
    
    .share-btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 140px;
    }
}

/* 列印樣式 */
@media print {
    .site-header,
    .site-footer,
    .sidebar,
    .post-share,
    .related-posts,
    .back-to-top {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .single-post {
        box-shadow: none;
        padding: 0;
    }
}
