/* /static/css/encyclopedia.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fef7ed;
    line-height: 1.6;
    color: #333; 
}

/* --- header --- */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #f59e0b;
    text-decoration: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #f59e0b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.logout-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.logout-btn:hover {
    background: #dc2626;
}

/* --- main --- */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    color: #1f2937;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 18px;
    color: #6b7280;
}

/* --- search-filter --- */
.search-filter-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#searchInput {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 20px;
    outline: none;
}

#searchInput:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap; 
    gap: 10px;
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: transparent;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap; 
}

.filter-btn:hover:not(.active) { 
    background: #f3f4f6;
    border-color: #a1a1aa; 
}

.filter-btn.active {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
    cursor: default; 
}

/* --- article-grid --- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3열 고정, 각 열이 1fr씩 */
  gap: 25px;
  width: 100%; /* 그리드 컨테이너가 부모 폭에 맞게 줄어듦 */
  max-width: 1200px; /* 필요시 최대 넓이 제한 */
  margin: 0 auto; /* 가운데 정렬 */
}

.article-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%; /* 각 그리드 셀 내부에서 카드가 꽉 채움 */
    min-height: 350px; /* 높이는 필요하면 고정 */
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); 
}

.article-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.article-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-category {
    display: inline-block;
    background: #fef7ed;
    color: #f59e0b;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    align-self: flex-start;
}

.article-title {
    font-size: 20px;
    color: #1f2937;
    margin-bottom: 10px;
    line-height: 1.3;
}

.article-summary {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 15px; 
    flex-grow: 1; 
    overflow: hidden;
    text-overflow: ellipsis; 
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical;
}

/* --- pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-bottom: 30px;
    flex-wrap: wrap;
    gap: 8px;
}

.page-link {
    display: block;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    text-decoration: none;
    color: #374151;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
    font-weight: 500;
}

.page-link:hover:not(.active):not(.disabled) {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #1f2937;
}

.page-link.active {
    background-color: #f59e0b;
    color: white;
    border-color: #f59e0b;
    font-weight: bold;
    cursor: default;
    box-shadow: 0 2px 5px rgba(245, 158, 11, 0.3);
}

.page-link.disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.first-last-page-link {
    background-color: #ffdd99;
    color: white;
    border-color: #ffdd99;
    font-weight: bold;
}

.first-last-page-link:hover:not(.active):not(.disabled) {
    background-color: #ffbb33; 
    border-color: #ffbb33;
    color: white;
}

.nav-page-link {
    background-color: #ff9933; 
    color: white;
    border-color: #ff9933;
    font-weight: bold;
}


.nav-page-link:hover:not(.active):not(.disabled) {
    background-color: #ff6600;
    border-color: #ff6600;
    color: white;
}

.article-grid > p {
    grid-column: 1 / -1;
    text-align: center;
    color: #6b7280;
    font-size: 1.2em;
    padding: 40px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}