/* Modern CSS with Accessibility and RWD - Following Original Design */

/* CSS Reset and Base Styles */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #E8F3FF 0%, #F0F8FF 100%);
    min-height: 100vh;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: bold;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Top Navigation */
.top {
    background: linear-gradient(135deg, #E8F3FF 0%, #D2FFD2 100%);
    padding: 1rem 0;
    border-bottom: 2px solid #4A90E2;
}

.nav {
    text-align: right;
    padding-right: 20px;
}

.nav a {
    color: #2C5AA0;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav a:hover,
.nav a:focus {
    background: #4A90E2;
    color: #fff;
    text-decoration: none;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Main Layout */
.main {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23E8F3FF" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>') center repeat-y;
    min-height: calc(100vh - 200px);
}

.main2 {
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 1rem auto;
    max-width: 1200px;
    overflow: hidden;
}

/* Menu Styles */
.menu {
    background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
    border-right: 2px solid #DEE2E6;
    padding: 1rem;
    min-height: 600px;
}

.menu-nav {
    margin-bottom: 2rem;
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    margin-bottom: 0.5rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #2C5AA0;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 1px solid transparent;
}

.menu-link:hover,
.menu-link:focus {
    background: #4A90E2;
    color: #fff;
    text-decoration: none;
    outline: 2px solid #fff;
    outline-offset: 2px;
    transform: translateX(4px);
}

.menu-link i {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 1.5rem;
    display: none;
}

.menu-item:hover .submenu,
.menu-item:focus-within .submenu {
    display: block;
}

.submenu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.submenu a:hover,
.submenu a:focus {
    background: #E3F2FD;
    color: #1976D2;
    outline: 1px solid #1976D2;
}

/* Quick Links */
.quick-links {
    background: #F8F9FA;
    border: 1px solid #DEE2E6;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.quick-links h3 {
    margin: 0 0 1rem 0;
    color: #2C5AA0;
    font-size: 1rem;
    font-weight: 600;
}

.quick-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-links-list li {
    margin-bottom: 0.5rem;
}

.quick-links-list a {
    display: block;
    padding: 0.5rem;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.quick-links-list a:hover,
.quick-links-list a:focus {
    background: #E3F2FD;
    color: #1976D2;
    outline: 1px solid #1976D2;
}

/* Content Area */
.content {
    padding: 1.5rem;
    background: #fff;
}

.text {
    width: 100%;
}

/* News Blocks */
.news-list {
    margin-top: 1rem;
}

.news-item {
    border-bottom: 1px solid #E9ECEF;
    padding: 1.5rem 0;
    transition: all 0.3s ease;
}

.news-item:hover {
    background: #F8F9FA;
    border-radius: 6px;
    padding-left: 1rem;
    padding-right: 1rem;
}

.news-item h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.news-item h3 a {
    color: #2C5AA0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.news-item h3 a:hover,
.news-item h3 a:focus {
    color: #1976D2;
    text-decoration: underline;
    outline: 2px solid #1976D2;
    outline-offset: 2px;
}

.news-meta {
    color: #6C757D;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.news-excerpt {
    color: #495057;
    line-height: 1.6;
}

.news-content {
    margin-top: 1.5rem;
    line-height: 1.8;
}

.news-content h1,
.news-content h2,
.news-content h3,
.news-content h4,
.news-content h5,
.news-content h6 {
    color: #2C5AA0;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.news-content p {
    margin-bottom: 1rem;
}

.news-content ul,
.news-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.news-content a {
    color: #1976D2;
    text-decoration: underline;
}

.news-content a:hover,
.news-content a:focus {
    color: #0D47A1;
    outline: 2px solid #1976D2;
    outline-offset: 2px;
}

/* Groups Section */
.groups-section {
    margin-top: 2rem;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.group-item {
    background: #F8F9FA;
    border: 1px solid #DEE2E6;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.group-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.group-item h3 {
    margin: 0 0 0.75rem 0;
    color: #2C5AA0;
    font-size: 1.125rem;
    font-weight: 600;
}

.group-item p {
    margin: 0;
    color: #495057;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #4A90E2;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:hover,
.btn:focus {
    background: #357ABD;
    color: #fff;
    text-decoration: none;
    outline: 2px solid #fff;
    outline-offset: 2px;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #4A90E2;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #357ABD;
}

/* Navigation */
.news-navigation {
    margin-top: 2rem;
    text-align: center;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border: 1px solid #DEE2E6;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination a:hover,
.pagination a:focus {
    background: #4A90E2;
    color: #fff;
    border-color: #4A90E2;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.pagination .active {
    background: #4A90E2;
    color: #fff;
    border-color: #4A90E2;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #2C5AA0 0%, #1A365D 100%);
    color: #fff;
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer h3 {
    color: #fff;
    margin-bottom: 1rem;
}

.footer p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.footer a {
    color: #E3F2FD;
    text-decoration: underline;
}

.footer a:hover,
.footer a:focus {
    color: #fff;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main2 {
        margin: 0.5rem;
        border-radius: 0;
    }
    
    .menu {
        border-right: none;
        border-bottom: 2px solid #DEE2E6;
        min-height: auto;
    }
    
    .content {
        padding: 1rem;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .nav {
        text-align: center;
        padding: 0.5rem;
    }
    
    .nav a {
        display: inline-block;
        margin: 0.25rem;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    body {
        font-size: 0.8rem;
    }
    
    .menu-link {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .news-item {
        padding: 1rem 0;
    }
    
    .news-item h3 {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .menu-link,
    .nav a,
    .btn {
        border: 2px solid currentColor;
    }
    
    .news-item {
        border: 1px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Focus Management */
*:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .menu,
    .nav,
    .footer {
        display: none;
    }
    
    .content {
        width: 100%;
        padding: 0;
    }
    
    .news-item {
        break-inside: avoid;
        border-bottom: 1px solid #000;
    }
}