/* ============================================================
   browse.css — Styles for the Browse / Search Papers page
   ============================================================ */

/* ─── Search Header ────────────────────────────────────────── */
.browse-header {
    text-align: center;
    padding: 80px 24px 40px;
    background:
        linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(43, 45, 66, 0.85) 50%, rgba(58, 61, 92, 0.8) 100%),
        url('book-unsplash.jpg') center / cover no-repeat;
    color: #fff;
}

.browse-header h1 {
    font-size: 2.4rem;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.browse-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    margin-bottom: 28px;
}

.search-bar {
    display: flex;
    max-width: 640px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.search-bar input {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    border: none;
    outline: none;
}

.btn-search {
    padding: 14px 28px;
    background: linear-gradient(135deg, #ef8354, #e06e3a);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-search:hover {
    background: linear-gradient(135deg, #e06e3a, #c85c2e);
}

/* ─── Category Bar ─────────────────────────────────────────── */
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 20px 24px;
    background: linear-gradient(180deg, #f4f6fb, #fafafa);
    border-bottom: 1px solid #e0e4ef;
}

.cat-chip {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #d0d5e4;
    background: #fff;
    font-size: 0.88rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-chip:hover {
    border-color: #ef8354;
    color: #ef8354;
}

.cat-chip.active {
    background: #ef8354;
    color: #fff;
    border-color: #ef8354;
}

/* ─── Main Content ─────────────────────────────────────────── */
.browse-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 48px 64px;
}

.browse-status {
    text-align: center;
    padding: 16px 0;
    color: #888;
}

.browse-status p {
    font-size: 1.05rem;
}

.browse-status .spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e0e4ef;
    border-top-color: #ef8354;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Results Grid ─────────────────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.paper-card {
    background: #fff;
    border: 1px solid #e0e4ef;
    border-radius: 14px;
    padding: 24px;
    transition: box-shadow 0.3s, border-color 0.3s, transform 0.3s;
}

.paper-card:hover {
    border-color: #c0c5d8;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.paper-card-body {
    display: flex;
    gap: 28px;
}

.paper-card-left {
    flex: 3;
    min-width: 0;
}

.paper-card-middle {
    flex: 4;
    min-width: 0;
}

.paper-card-right {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    text-align: right;
    gap: 16px;
}

.paper-card-header {
    margin-bottom: 14px;
}

.paper-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2b2d42;
    line-height: 1.4;
    margin-bottom: 8px;
}

.paper-card-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f4ff;
    color: #5568a8;
    white-space: nowrap;
}

.paper-card-authors {
    font-size: 0.9rem;
    color: #555;
    margin-top: 4px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.paper-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Source badges (arXiv, Semantic Scholar, etc.) */
.paper-source-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--badge-color, #888) 12%, white);
    color: var(--badge-color, #888);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.citation-count {
    font-size: 0.8rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Source stats bar above results */
.source-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: #f8f9fc;
    border: 1px solid #e8ecf4;
    border-radius: 10px;
    font-size: 0.85rem;
}

.source-stats-label {
    color: #888;
    font-weight: 500;
}

.source-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    background: color-mix(in srgb, var(--chip-color, #888) 10%, white);
    color: var(--chip-color, #888);
    font-weight: 500;
}

.source-stat-chip strong {
    font-weight: 700;
    color: var(--chip-color, #888);
}

/* No-PDF badge in search results */
.no-pdf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    white-space: nowrap;
}

.no-pdf-badge svg {
    flex-shrink: 0;
}

/* Button style for papers without PDF */
.btn-import.btn-no-pdf {
    background: #f5f5f5;
    color: #777;
    border-color: #ddd;
}

.btn-import.btn-no-pdf:hover {
    background: #eee;
    color: #555;
}

.paper-card-abstract {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.paper-card-footer {
    display: none;
}

.paper-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #888;
}

.paper-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-import {
    padding: 10px 24px;
    background: linear-gradient(135deg, #ef8354, #e06e3a);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(239, 131, 84, 0.25);
}

.btn-import:hover {
    background: linear-gradient(135deg, #e06e3a, #c85c2e);
    box-shadow: 0 4px 12px rgba(239, 131, 84, 0.35);
    transform: translateY(-1px);
}

.btn-import:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-import.imported {
    background: #43aa8b;
}

/* ─── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 36px;
}

.btn-page {
    padding: 10px 22px;
    background: #fff;
    border: 1px solid #d0d5e4;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    border-color: #ef8354;
    color: #ef8354;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.9rem;
    color: #888;
}

/* ─── Error state ──────────────────────────────────────────── */
.browse-error {
    text-align: center;
    padding: 32px;
    color: #c0392b;
}

.browse-error button {
    margin-top: 12px;
    padding: 8px 20px;
    background: #ef8354;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .browse-header {
        padding: 64px 16px 32px;
    }

    .browse-header h1 {
        font-size: 1.7rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .btn-search {
        padding: 12px;
    }

    .paper-card {
        padding: 18px;
    }

    .paper-card-header {
        flex-direction: column;
        gap: 8px;
    }

    .paper-card-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}
