/* css/publications.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* --- 1. BIẾN MÀU SẮC --- */
:root {
    --font-main: 'Plus Jakarta Sans', sans-serif;

    /* Light Mode */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text-main: #334155;
    --text-title: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #10b981; /* Emerald Green (Light Mode) */
    --accent-bg: rgba(16, 185, 129, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    
    /* Scrollbar Colors */
    --scroll-thumb: #cbd5e1;
    --scroll-track: transparent;
}

[data-theme="dark"] {
    /* Dark Mode - Đổi sang màu Indigo #6366f1 */
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --text-main: #f8fafc;
    --text-title: #ffffff;
    --text-muted: #94a3b8;
    --border: rgba(255,255,255,0.1);
    --accent: #6366f1; 
    --accent-bg: rgba(99, 102, 241, 0.15);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    
    /* Scrollbar Colors Dark */
    --scroll-thumb: #475569;
}

/* --- 2. GLOBAL RESET & FONT --- */
body { 
    background: var(--bg-body); 
    color: var(--text-main); 
    font-family: var(--font-main); 
    margin: 0; 
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* Ép dùng 1 font duy nhất */
h1, h2, h3, div, span, p, input, button, a { font-family: var(--font-main) !important; }

/* --- 3. CUSTOM SCROLLBAR (HIỆN ĐẠI) --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box; /* Tạo viền trong suốt giúp thanh cuộn nhìn mỏng hơn */
    transition: background-color 0.3s;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }

/* --- 4. FILTER BAR --- */
.search-wrapper {
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    border-radius: 20px;
    padding: 20px; margin-bottom: 40px;
    box-shadow: var(--shadow);
    display: flex; gap: 15px; flex-wrap: wrap;
    align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
}

.filter-group {
    flex: 1; min-width: 200px; position: relative;
    background: var(--bg-input); 
    border: 1px solid var(--border);
    border-radius: 50px; display: flex; align-items: center;
    padding: 10px 20px; transition: 0.2s;
}
.filter-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.filter-icon { color: var(--text-muted); margin-right: 12px; font-size: 1rem; }

.filter-input {
    background: transparent; border: none; 
    color: var(--text-main); width: 100%;
    outline: none; font-size: 0.95rem; padding: 2px 0;
}
.filter-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.filter-input::-webkit-outer-spin-button,
.filter-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.filter-input[type=number] { -moz-appearance: textfield; }

.loading-spinner {
    width: 24px; height: 24px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; display: none; margin-left: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 5. PUB LIST --- */
.pub-list { display: flex; flex-direction: column; gap: 20px; }

.pub-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 25px; position: relative;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; 
    display: flex; gap: 20px; box-shadow: var(--shadow);
}
.pub-item:hover { transform: translateY(-3px); border-color: var(--accent); }

/* Năm */
.pub-year-box {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 70px; height: 70px; 
    background: var(--accent-bg);
    border-radius: 12px; color: var(--accent); 
    border: 1px solid var(--accent-bg);
    flex-shrink: 0;
}
.py-num { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.py-label { font-size: 0.7rem; text-transform: uppercase; font-weight: 700; opacity: 0.8; }

/* Nội dung */
.pub-content { flex: 1; min-width: 0; /* Quan trọng để text-overflow hoạt động */ }

.pub-title {
    font-size: 1.2rem; font-weight: 700; color: var(--text-title); 
    margin-bottom: 8px; line-height: 1.4; display: block; 
    transition: color 0.3s;
    text-decoration: none;
    
    /* [CẮT DÒNG] Giới hạn tiêu đề 2 dòng */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pub-title:hover { color: var(--accent); }

.pub-journal {
    font-style: italic; color: var(--accent); font-weight: 600;
    font-size: 0.95rem; margin-bottom: 10px; display: inline-block;
    border-bottom: 1px dashed var(--border); padding-bottom: 2px;
    
    /* [CẮT DÒNG] Giới hạn 1 dòng */
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pub-authors { 
    color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px;
    
    /* [CẮT DÒNG] Giới hạn 1 dòng */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pub-desc { 
    font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; 
    border-left: 3px solid var(--border); padding-left: 15px; margin-bottom: 15px;
    
    /* [CẮT DÒNG] Giới hạn mô tả 3 dòng, quá sẽ hiện ... */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pub-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 15px; border-top: 1px solid var(--border); 
    font-size: 0.85rem; color: var(--text-muted);
}
.uploader { display: flex; align-items: center; gap: 8px; }

/* Avatar */
.u-avt { 
    width: 24px; height: 24px; border-radius: 50%; object-fit: cover; 
    border: 1px solid var(--border); background: var(--bg-input);
}

.empty-state {
    text-align: center; padding: 60px; border: 2px dashed var(--border);
    border-radius: 20px; color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .pub-item { flex-direction: column; }
    .pub-year-box { width: 100%; height: 50px; flex-direction: row; gap: 10px; }
    .search-wrapper { flex-direction: column; align-items: stretch; }
    .pub-footer { flex-direction: column; align-items: flex-start; gap: 10px; }
}