/* ==========================================================================
   Research Library Styles - Premium Apple/Stripe/Notion/Nature Feel
   ========================================================================== */

/* Variables and Reset handled by styles.css, but we can override or add specific ones */
:root {
    --glass-bg: rgba(20, 20, 25, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --accent-blue: #3881FC;
    --accent-glow: rgba(56, 129, 252, 0.4);
    --text-main: #f5f5f7;
    --text-muted: #86868b;
    --panel-transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

body {
    background-color: #000;
    color: var(--text-main);
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.research-hero {
    position: relative;
    height: 100vh;
    min-height: 800px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-align: center;
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 10;
    margin-bottom: 4rem;
}

.glitch-title {
    font-size: clamp(4rem, 8vw, 8rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
    background: linear-gradient(180deg, #fff 0%, #a1a1a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Animated Stats
   -------------------------------------------------------------------------- */
.stats-container {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--glass-bg);
    padding: 2rem 4rem;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number, .stat-plus {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-plus {
    color: var(--accent-blue);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Search & Filter Section
   -------------------------------------------------------------------------- */
.search-section {
    position: sticky;
    top: 80px; /* Below navbar */
    z-index: 100;
    padding: 1.5rem 2rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.search-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

#paper-search {
    width: 100%;
    max-width: 600px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

#paper-search:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px var(--accent-glow);
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.filter-label {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.filter-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   Categories & Explorer Section
   -------------------------------------------------------------------------- */
.explorer-section {
    padding: 6rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    min-height: 800px;
}

/* Grid Layout for Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    transition: var(--panel-transition);
}

.categories-grid.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: scale(0.95);
}

.category-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 4rem 3rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--panel-transition);
    backdrop-filter: blur(10px);
}

.category-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

.category-panel:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.category-panel:hover::before {
    opacity: 1;
}

.panel-content {
    position: relative;
    z-index: 1;
}

.panel-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.panel-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Split Explorer Layout */
.explorer-layout {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 6rem;
    left: 2rem;
    right: 2rem;
    transition: var(--panel-transition);
    transform: translateY(20px);
}

.explorer-layout.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(0);
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
}

.back-btn:hover {
    text-decoration: underline;
}

.explorer-split {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    height: 700px;
}

/* Sidebar List */
.paper-list-sidebar {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

#active-category-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.paper-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.paper-item {
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: 1px solid transparent;
}

.paper-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.paper-item.active {
    background: rgba(56, 129, 252, 0.1);
    border-color: var(--accent-blue);
}

.paper-item h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #fff;
    line-height: 1.3;
}

.paper-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Preview Panel */
.paper-preview-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    position: relative;
}

.empty-state {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.preview-content {
    animation: fadeIn 0.4s ease;
}

.preview-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.preview-cover {
    width: 150px;
    height: 200px;
    background: #222;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.preview-meta {
    flex: 1;
}

.preview-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.preview-authors {
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.preview-journal {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: #F70C34;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-abstract h3 {
    margin-bottom: 1rem;
}

.preview-abstract p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Timeline Section
   -------------------------------------------------------------------------- */
.timeline-section {
    padding: 8rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.timeline-section h2 {
    font-size: 3rem;
    margin-bottom: 4rem;
}

.timeline-container {
    position: relative;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--accent-blue), transparent);
    transform: translateX(-50%);
}

.timeline-event {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.timeline-event.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-event:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-year {
    width: 45%;
    font-size: 4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.1);
    text-align: right;
}

.timeline-event:nth-child(even) .timeline-year {
    text-align: left;
}

.timeline-content {
    width: 45%;
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    text-align: left;
    position: relative;
}

.timeline-content::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    transform: translateY(-50%);
}

.timeline-event:nth-child(odd) .timeline-content::after {
    left: -10px;
    box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-event:nth-child(even) .timeline-content::after {
    right: -10px;
    box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-content h4 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.timeline-content p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Visualization Section
   -------------------------------------------------------------------------- */
.visualization-section {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.vis-header {
    margin-bottom: 3rem;
}

.vis-header h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.vis-header p {
    color: var(--text-muted);
}

.svg-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

#oxygen-svg {
    width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   PDF Modal
   -------------------------------------------------------------------------- */
.pdf-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pdf-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.pdf-modal-content {
    background: #111;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.pdf-modal-overlay.active .pdf-modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    flex: 1;
    display: flex;
    width: 100%;
    height: 100%;
}

.modal-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-sidebar {
    width: 350px;
    background: #1a1a1a;
    padding: 2rem;
    border-left: 1px solid var(--glass-border);
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
    .explorer-split {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .paper-list-sidebar {
        height: 300px;
    }
    .timeline-event, .timeline-event:nth-child(even) {
        flex-direction: column;
        text-align: center;
    }
    .timeline-year, .timeline-content {
        width: 100%;
        text-align: center !important;
    }
    .timeline-line { left: 20px; }
    .timeline-event:nth-child(odd) .timeline-content::after,
    .timeline-event:nth-child(even) .timeline-content::after {
        left: -40px;
    }

    .modal-content {
        flex-direction: column;
    }
    .modal-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
}
