/* ================================================
   PAPER ENHANCEMENTS STYLES
   Abstract panel, PDF button, Citation overlay
   ================================================ */

/* ================================================
   ABSTRACT PANEL
   ================================================ */

.abstract-panel {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-light);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.abstract-authors {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.abstract-text {
    margin-top: 4px;
}

.abstract-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
}

/* ================================================
   PDF BUTTON
   ================================================ */

.pdf-btn {
    display: none; /* shown only when a URL is available */
    background: #10B981;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
}

.pdf-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.pdf-btn:active {
    transform: translateY(0);
}

/* ================================================
   CITATION OVERLAY — BACKDROP
   ================================================ */

.citation-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.citation-overlay.show {
    display: flex;
}

/* ================================================
   CITATION CARD — MAIN CONTAINER
   ================================================ */

.citation-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 95%;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* ================================================
   CITATION HEADER
   ================================================ */

.citation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-gray);
    flex-shrink: 0;
}

.citation-paper-info {
    flex: 1;
    padding-right: 16px;
    min-width: 0;
}

.citation-paper-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}

.citation-paper-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.citation-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.citation-close-btn:hover {
    color: var(--text-primary);
    background: var(--border-light);
}

/* ================================================
   CITATION TABS
   ================================================ */

.citation-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
    flex-shrink: 0;
}

.citation-tab {
    padding: 12px 24px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s, border-bottom-color 0.2s;
    white-space: nowrap;
}

.citation-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.citation-tab:hover {
    color: var(--primary-dark);
}

.citation-tab-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: var(--border-light);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 20px;
    text-align: center;
}

.citation-tab.active .citation-tab-badge {
    background: var(--primary-bg);
    color: var(--primary);
}

/* ================================================
   CITATION BODY
   ================================================ */

.citation-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* ================================================
   CITATION ITEM
   ================================================ */

.citation-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.citation-item:last-child {
    border-bottom: none;
}

.citation-item-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.citation-item-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.citation-item-title a:hover {
    color: var(--primary);
}

.citation-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.citation-search-btn {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s, color 0.2s;
}

.citation-search-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* ================================================
   CITATION EMPTY / LOADING STATES
   ================================================ */

.citation-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 14px;
    line-height: 1.6;
}

.citation-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

/* Spinner keyframes (used by citation-loading inline SVG) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   RESPONSIVE — 768px and below
   ================================================ */

@media (max-width: 768px) {
    .citation-overlay {
        padding: 20px 12px;
    }

    .citation-card {
        width: 100%;
        max-height: calc(100vh - 40px);
    }

    .citation-header {
        padding: 16px;
    }

    .citation-paper-info h3 {
        font-size: 15px;
    }

    .citation-body {
        padding: 12px 16px;
    }

    .citation-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ================================================
   RESPONSIVE — 480px and below
   ================================================ */

@media (max-width: 480px) {
    .citation-header {
        flex-direction: column;
        gap: 12px;
    }

    .citation-paper-info {
        padding-right: 0;
    }

    .citation-close-btn {
        align-self: flex-end;
    }

    .citation-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}
