/* =========================================================
   RESEARCH LIBRARY — PAGE-SPECIFIC STYLES
========================================================= */

/* =========================
   STATS
========================= */

.stats {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 17px 20px;

    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 190px;
}

.stat-icon {
    width: 37px;
    height: 37px;
    background: #eff6ff;
    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 2px;
}

.stat-card strong {
    font-size: 21px;
}


/* =========================
   LIBRARY CONTROLS
========================= */

.library-controls {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 10px;
}


/* =========================
   LIBRARY SECTION
========================= */

.library-section {
    margin-top: 10px;
}

.paper-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


/* =========================
   PAPER CARDS
========================= */

.paper-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.paper-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.paper-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 25px;
}

.paper-info {
    min-width: 0;
    flex: 1;
}

.paper-title {
    margin: 0 0 7px;
    color: var(--text-heading);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.paper-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.meta-item {
    color: #64748b;
}

.meta-dot {
    color: #cbd5e1;
}

.paper-bottom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 11px;
}

.keyword-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.keyword {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 5px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.keyword-more {
    background: #f1f5f9;
    color: #64748b;
    cursor: default;
}

.paper-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: rgb(255, 255, 255);
    border-radius: 6px;
    cursor: pointer;
    color: #3a3d43;
    font-size: 17px;
    transition: 0.2s;
}

.icon-button:hover {
    background: #017efb;
    color: var(--text);
}

.icon-button.delete:hover {
    color: var(--danger);
    border-color: #ff0000;
    background: #ff7373;
}

.matrix-add-button {
    width: 38px;
    height: 38px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.matrix-add-button:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.matrix-add-button.matrix-added {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.matrix-add-button.matrix-added:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
}

.status-reading {
    background: #fff7ed;
    color: #c2410c;
}

.status-read {
    background: #f0fdf4;
    color: #15803d;
}

.status-important {
    background: #fefce8;
    color: #a16207;
}

.status-not-relevant {
    background: #fef2f2;
    color: #b91c1c;
}


/* =========================
   PAPER FORM
========================= */

#paperForm {
    padding: 22px 24px;
}


/* =========================
   DETAILS MODAL
========================= */

.details-modal {
    max-width: 760px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.details-label {
    color: var(--primary);
    text-transform: uppercase;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.details-content {
    padding: 22px 24px;
}

.details-section {
    padding: 20px 0;
    border-bottom: 1px solid #edf0f3;
}

.details-section:first-child {
    padding-top: 0;
}

.details-section:last-child {
    border-bottom: none;
}

.details-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 30px;
}

.detail-row {
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f5;
}

.detail-grid .detail-row:nth-last-child(-n+2) {
    border-bottom: none;
}

.detail-row > span {
    display: block;
    color: #6b7280;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.detail-row strong {
    display: block;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.details-text {
    margin: 0;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.doi-value {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px !important;
    color: #374151;
}

#detailsKeywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.no-data {
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}

.paper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 18px;
}

.paper-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    background: #eff6ff;
    text-decoration: underline;
    text-underline-offset: 2px;
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    transition: 0.2s;
}

.paper-link:hover {
    background: #dbeafe;
}

.no-link {
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
}

.details-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 17px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {
    .paper-main {
        flex-direction: column;
        gap: 14px;
    }

    .paper-actions {
        align-self: flex-start;
    }

    .stats {
        flex-direction: column;
    }

    .stat-card {
        width: 100%;
    }

    .library-controls {
        flex-direction: column;
    }
}

@media (max-width: 700px) {
    .details-modal {
        max-height: 95vh;
    }
}

@media (max-width: 650px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid .detail-row {
        border-bottom: 1px solid #f1f3f5;
    }
}

