/* Resources 頁面通用樣式 */

/* 容器寬度限制 */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 頁面標題區域 */
.page-header {
    background: #f8fafc;
    color: #1e293b;
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

[data-theme="dark"] .page-header {
    background: var(--secondary-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.page-header-content {
    position: relative;
}

.back-link {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem;
}

[data-theme="dark"] .back-link {
    color: var(--text-color);
    opacity: 0.8;
}

.back-link:hover {
    color: #2563eb;
    transform: translateX(-4px);
}

[data-theme="dark"] .back-link:hover {
    color: var(--primary-color);
    opacity: 1;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: #1e293b;
}

[data-theme="dark"] .page-header h1 {
    color: var(--text-color);
}

.page-subtitle {
    font-size: 1.1rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

[data-theme="dark"] .page-subtitle {
    color: var(--text-color);
    opacity: 0.8;
}

/* 三欄布局 */
.publications-content,
.documentation-content {
    padding: 2rem 1rem;
    background: white;
    min-height: 60vh;
}

[data-theme="dark"] .publications-content,
[data-theme="dark"] .documentation-content {
    background: var(--primary-bg);
}

.publications-layout,
.documentation-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* 側邊欄樣式 */
.sidebar {
    position: sticky;
    top: 6rem;
    height: fit-content;
}

.sidebar-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

[data-theme="dark"] .sidebar-section {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #2563eb;
}

[data-theme="dark"] .sidebar-title {
    color: var(--text-color);
    border-bottom-color: var(--primary-color);
}

/* 側邊欄連結 */
.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-links li {
    margin-bottom: 0.25rem;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

[data-theme="dark"] .sidebar-links a {
    color: var(--text-color);
    opacity: 0.8;
}

.sidebar-links a:hover {
    background: white;
    color: #2563eb;
}

[data-theme="dark"] .sidebar-links a:hover {
    background: var(--hover-color);
    color: var(--primary-color);
    opacity: 1;
}

.sidebar-links a.active {
    background: white;
    color: #2563eb;
    font-weight: 600;
}

[data-theme="dark"] .sidebar-links a.active {
    background: var(--hover-color);
    color: var(--primary-color);
    opacity: 1;
}

.sidebar-links a i {
    width: 18px;
    text-align: center;
}

/* 主要內容區域 */
.publications-main,
.documentation-main {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

[data-theme="dark"] .publications-main,
[data-theme="dark"] .documentation-main {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* 工具列樣式 */
.publications-toolbar,
.documentation-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: white;
    color: #1e293b;
}

[data-theme="dark"] .search-box input {
    background: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.search-box input:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
}

[data-theme="dark"] .search-box input:focus {
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--hover-color);
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .publications-layout,
    .documentation-layout {
        grid-template-columns: 250px 1fr 250px;
        gap: 1.5rem;
    }
}

@media (max-width: 968px) {
    .publications-layout,
    .documentation-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .publications-main,
    .documentation-main {
        order: 1;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 2rem 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .publications-toolbar,
    .documentation-toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
}
