/* --- Global Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #007bff; /* 主藍色 */
    --secondary-color: #6c757d; /* 次要灰色 */
    --accent-color: #ffc107; /* 金色點綴 */
    --dark-bg: #212529; /* 深色背景 */
    --light-bg: #f8f9fa; /* 淺色背景 */
    --text-color: #343a40; /* 主要文字顏色 */
    --light-text-color: #6c757d; /* 淺色文字顏色 */
    --white: #fff;
    --border-color: #dee2e6;
}

body {
    font-family: 'Noto Sans TC', 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

a:hover {
    color: var(--accent-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

.section-padding {
    padding: 40px 0;
}

/* --- Header --- */
.header {
    background-color: var(--dark-bg);
    padding: 15px 0;
    color: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    display: flex;
    align-items: center;
}

.logo img {
    height: 66px; /* Adjust as needed */
    margin-right: 10px;
}

.logo:hover {
    color: var(--white); /* Prevent color change on hover */
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav li {
    margin-left: 30px;
}

.nav a {
    color: var(--white);
    font-weight: 500;
    font-size: 17px;
    padding-bottom: 5px;
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav a:hover::after,
.nav a.active::after {
    width: 100%;
}

/* --- Footer --- */
.footer {
    background-color: var(--dark-bg);
    color: var(--light-text-color);
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
    margin-top: 40px;
}

.footer .footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.footer .footer-nav li {
    margin: 0 15px;
}

.footer .footer-nav a {
    color: var(--light-text-color);
}

.footer .social-links a {
    color: var(--light-text-color);
    font-size: 20px;
    margin: 0 10px;
    display: inline-block;
    transition: color 0.3s ease;
}

.footer .social-links a:hover {
    color: var(--white);
}

.footer .copyright {
    margin-top: 20px;
}

/* --- Main Content Layout --- */
.main-content {
    padding-bottom: 0; /* Adjust as footer has margin-top */
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -10px;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

/* --- Hero Section (for index.htm) --- */
.hero-section {
    background: var(--dark-bg) url('../images/hero-bg.jpg') no-repeat center center/cover; /* Assume a background image */
    color: var(--white);
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden; /* For background pattern */
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Overlay for readability */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-content .subtitle {
    font-size: 18px;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.hero-content .headline {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-content .description {
    font-size: 18px;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-content .read-more-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 12px 30px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.hero-content .read-more-btn:hover {
    background-color: var(--accent-color);
}

/* --- News Grid / Card Layout (for index.htm, list.htm) --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.news-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.news-card-img {
    height: 200px;
    overflow: hidden;
}

.news-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.news-card-body {
    padding: 20px;
}

.news-card-category {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.news-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-card-title a {
    color: var(--text-color);
}

.news-card-title a:hover {
    color: var(--primary-color);
}

.news-card-meta {
    font-size: 13px;
    color: var(--light-text-color);
}

/* --- Article Page --- */
.article-page.section-padding {
    padding-top: 40px;
    padding-bottom: 40px;
}

.article-main {
    grid-column: span 2; /* Occupy 2.5 parts on a 3.5 part grid */
}
.sidebar {
    grid-column: span 1; /* Occupy 1 part on a 3.5 part grid */
}

.article-header {
    margin-bottom: 30px;
    text-align: center;
}

.article-header .title {
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
}

.article-header .meta {
    font-size: 15px;
    color: var(--light-text-color);
}

.article-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 17px;
    line-height: 1.8;
}

.article-content h1, .article-content h2, .article-content h3, .article-content h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--text-color);
}

.article-content p {
    margin-bottom: 20px;
}

.article-content img {
    margin: 25px 0;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.article-content blockquote {
    border-left: 5px solid var(--primary-color);
    padding: 15px 20px;
    margin: 25px 0;
    background-color: var(--light-bg);
    color: var(--secondary-color);
    font-style: italic;
}

.article-tags {
    margin-top: 30px;
    text-align: center;
}

.article-tags a {
    display: inline-block;
    background-color: #e9ecef;
    color: var(--secondary-color);
    padding: 5px 15px;
    border-radius: 20px;
    margin: 5px;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.article-tags a:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.sidebar {
    padding-left: 30px;
    /* Removed border-left for mobile first, will add back for desktop */
}

.main-content.article-page .container {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column for mobile */
    gap: 30px;
}

.sidebar .sidebar-widget {
    margin-bottom: 30px;
}

.sidebar .widget-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
}

.sidebar .widget-news-list {
    list-style: none;
    padding: 0;
}
.sidebar .widget-news-list li {
    margin-bottom: 15px;
}

.sidebar .widget-news-list a {
    color: var(--text-color);
    font-weight: 500;
}

.sidebar .widget-news-list a:hover {
    color: var(--primary-color);
}

.sidebar .widget-news-list .meta {
    font-size: 13px;
    color: var(--light-text-color);
}

.ad-banner {
    background-color: #f0f0f0;
    padding: 20px;
    text-align: center;
    border-radius: 5px;
    font-size: 16px;
    color: var(--secondary-color);
    border: 1px dashed var(--border-color);
}

/* --- List Page Header (for list.htm, lives.htm) --- */
.list-page-header {
    background-color: var(--dark-bg);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
}

.list-page-header h1 {
    font-size: 48px;
    font-weight: 700;
    margin: 0;
}

.list-page-header p {
    font-size: 18px;
    color: var(--light-text-color);
    margin-top: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Pagination (for list.htm, lives.htm) --- */
.pagination {
    margin-top: 40px;
    text-align: center;
}

.pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.pagination li {
    border-right: 1px solid var(--border-color);
}

.pagination li:last-child {
    border-right: none;
}

.pagination a, .pagination span {
    display: block;
    padding: 10px 15px;
    color: var(--primary-color);
    background-color: var(--white);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.pagination .current, .pagination .disabled {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 700;
    pointer-events: none; /* Disable click for current/disabled */
}

/* --- Breaking News Section (for index.htm) --- */
.breaking-news-section {
    background-color: var(--white);
    padding: 40px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.breaking-news-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.breaking-news-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 15px;
    position: relative;
}

.breaking-news-header h2::before,
.breaking-news-header h2::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.breaking-news-header h2::before {
    left: -60px;
}

.breaking-news-header h2::after {
    right: -60px;
}

.breaking-news-grid { /* Applies to index.htm's breaking news */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 20px 30px; /* Row gap, Column gap */
    max-width: 900px; /* Constrain width for better readability */
    margin: 0 auto;
}

.breaking-news-item { /* Applies to index.htm's breaking news */
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
}

.breaking-news-item:nth-last-child(-n+3) { /* Remove bottom border for the last row in index.htm */
    border-bottom: none;
}

.breaking-news-item-title { /* Applies to index.htm's breaking news */
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    line-height: 1.4;
}

.breaking-news-item-title a { /* Applies to index.htm's breaking news */
    color: var(--text-color);
    transition: color 0.3s ease;
}

.breaking-news-item-title a:hover { /* Applies to index.htm's breaking news */
    color: var(--primary-color);
}

.breaking-news-item-meta { /* Applies to index.htm's breaking news */
    font-size: 12px;
    color: var(--light-text-color);
}


/* --- Breaking News List Page Specific (for lives.htm) --- */
.breaking-news-list-page {
    background-color: var(--light-bg);
    padding-top: 0; /* list-page-header already has margin-bottom */
    padding-bottom: 40px;
}

.breaking-news-list-page .breaking-news-grid { /* Override width for full list page */
    max-width: 1200px; /* Full width for the list page grid */
    margin-top: 0;
}

/* Remove bottom border for the last row of the lives.htm grid */
.breaking-news-list-page .breaking-news-grid .breaking-news-item:nth-last-child(-n+3) {
    border-bottom: none;
}
/* Ensure pagination styles are applied correctly */
.breaking-news-list-page .pagination {
    margin-top: 40px;
}


/* --- Responsive Design --- */
@media (min-width: 992px) { /* Desktop specific styles */
    .main-content.article-page .container {
        grid-template-columns: 2.5fr 1fr; /* 2.5 parts for article, 1 part for sidebar */
    }
    .sidebar {
        border-left: 1px solid var(--border-color); /* Add border for desktop sidebar */
    }
}

@media (max-width: 991.98px) { /* Tablet and below */
    .nav {
        display: none; /* Hide navigation on small screens, consider a hamburger menu */
    }

    .header .container {
        justify-content: center;
    }

    .hero-content .headline {
        font-size: 36px;
    }

    .news-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .article-content {
        font-size: 16px;
    }

    .sidebar {
        padding-left: 0;
        border-left: none;
        margin-top: 40px;
    }

    /* Breaking News Section (index.htm) */
    .breaking-news-section .breaking-news-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
        max-width: 600px;
    }
    .breaking-news-section .breaking-news-item:nth-last-child(-n+2) { /* Adjust last row for 2 columns */
        border-bottom: none;
    }
    .breaking-news-section .breaking-news-item:nth-last-child(-n+3):not(:nth-last-child(-n+2)) {
         border-bottom: 1px dashed var(--border-color); /* Add back for old last row if it's not the new last row */
    }

    .breaking-news-header h2::before,
    .breaking-news-header h2::after {
        width: 20px;
    }
    .breaking-news-header h2::before { left: -40px; }
    .breaking-news-header h2::after { right: -40px; }

    /* Breaking News List Page (lives.htm) */
    .breaking-news-list-page .breaking-news-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
        gap: 20px;
    }
    .breaking-news-list-page .breaking-news-grid .breaking-news-item:nth-last-child(-n+2) {
        border-bottom: none;
    }
    .breaking-news-list-page .breaking-news-grid .breaking-news-item:not(:nth-last-child(-n+2)) {
        border-bottom: 1px dashed var(--border-color);
    }
}

@media (max-width: 767.98px) { /* Mobile and smaller */
    .logo {
        font-size: 24px;
    }
    .logo img {
        height: 35px;
    }

    .hero-section {
        padding: 60px 0;
    }

    .hero-content .headline {
        font-size: 30px;
    }

    .hero-content .description {
        font-size: 16px;
    }

    .section-title {
        font-size: 24px;
    }

    .footer .footer-nav ul {
        flex-direction: column;
        gap: 10px;
    }

    /* Breaking News Section (index.htm) */
    .breaking-news-header {
        flex-direction: column;
    }
    .breaking-news-header h2::before,
    .breaking-news-header h2::after {
        display: none; /* Hide lines on very small screens */
    }
    .breaking-news-section .breaking-news-grid {
        grid-template-columns: 1fr; /* 1 column on small screens */
        max-width: 400px;
    }
    .breaking-news-section .breaking-news-item {
        border-bottom: 1px dashed var(--border-color); /* Ensure all items have bottom border on 1 column layout */
    }
    .breaking-news-section .breaking-news-item:last-child {
        border-bottom: none; /* Remove border for the very last item */
    }

    /* Breaking News List Page (lives.htm) */
    .breaking-news-list-page .breaking-news-grid {
        grid-template-columns: 1fr; /* 1 column on small screens */
        gap: 15px;
    }
    .breaking-news-list-page .breaking-news-grid .breaking-news-item {
        border-bottom: 1px dashed var(--border-color);
    }
    .breaking-news-list-page .breaking-news-grid .breaking-news-item:last-child {
        border-bottom: none;
    }

    .list-page-header h1 {
        font-size: 36px;
    }
    .list-page-header p {
        font-size: 16px;
    }
}

@media (max-width: 575.98px) { /* Even smaller mobile */
    .container {
        padding: 0 10px;
    }

    .hero-section {
        padding: 40px 0;
    }

    .hero-content .headline {
        font-size: 26px;
    }

    .news-card-title {
        font-size: 18px;
    }

    .article-header .title {
        font-size: 30px;
    }

    .list-page-header h1 {
        font-size: 30px;
    }
}