/* Enhanced Knowledge Base Styles - v2.0 */

/* ベースリセット */
* {
    box-sizing: border-box;
}

/* CSS変数（カラーパレット） */
:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ダークモード */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --border-color: #334155;
        --border-light: #475569;
    }
}

/* メインレイアウト */
body { 
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 2rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-color);
    font-size: 16px;
}

/* ヘッダー */
.header {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    text-align: center;
}

.header h1 { 
    color: var(--text-primary); 
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin: 0;
    font-weight: 400;
}

/* 統計情報ボックス */
.stats {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stats strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* 検索・フィルタコンテナ */
.search-container {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.search-box input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.search-box button:hover {
    background: var(--text-secondary);
    transform: translateY(-1px);
}

.filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 記事カード（ランディングページ用） */
.article-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.article-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.article-card h2 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.article-card h2 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-card h2 a:hover {
    color: var(--primary-color);
}

.article-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.article-card .meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.article-card .summary {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* タグスタイル */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.tag:hover {
    background: var(--primary-dark);
}

/* 個別記事ページ */
.breadcrumb {
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--primary-dark);
}

.article-main {
    max-width: 800px;
    margin: 0 auto;
}

.article-full {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-md);
}

.article-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.article-header h1 {
    margin: 0 0 1rem 0;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.article-header .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.article-header .summary {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 1rem;
}

/* コンテンツスタイル */
.content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

.content h1 { font-size: 2rem; }
.content h2 { font-size: 1.75rem; }
.content h3 { font-size: 1.5rem; }
.content h4 { font-size: 1.25rem; }

.content p {
    margin-bottom: 1.5rem;
}

.content ul, .content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.content a:hover {
    color: var(--primary-dark);
}

.content code {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.content pre {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.content pre code {
    background: none;
    border: none;
    padding: 0;
}

.content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* No Results表示 */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* フッター */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer p {
    margin: 0.5rem 0;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    body {
        padding: 1.5rem;
    }
    
    .search-container {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .article-card {
        padding: 1.5rem;
    }
    
    .article-full {
        padding: 2rem;
    }
    
    .article-header h1 {
        font-size: 2rem;
    }
    
    .article-card .meta,
    .article-header .meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .search-box {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }
    
    .search-container {
        padding: 1rem;
    }
    
    .article-card {
        padding: 1rem;
    }
    
    .article-full {
        padding: 1.5rem;
    }
    
    .stats {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* 印刷スタイル */
@media print {
    body {
        max-width: none;
        padding: 0;
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
    
    .search-container,
    .stats,
    footer {
        display: none;
    }
    
    .article-card,
    .article-full {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }
    
    .article-card:hover,
    .article-full:hover {
        transform: none;
        box-shadow: none;
    }
    
    .tag {
        background: #f0f0f0;
        color: black;
        border: 1px solid #ccc;
    }
}

/* アニメーション */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* フォーカス・アクセシビリティ */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* スムーススクロール */
html {
    scroll-behavior: smooth;
}

/* セレクションスタイル */
::selection {
    background: var(--primary-color);
    color: white;
}

/* ローディング状態 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* スピナー */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}