/* CSS Reset & Variables */
:root {
    /* Colors - Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-bg: #eef2ff;
    --accent-text: #3730a3;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Instrument Sans', Georgia, Cambria, "Times New Roman", Times, serif;
    
    --sidebar-width: 400px;
    --header-height: 72px;
    --transition-speed: 0.2s;
}

[data-theme="dark"] {
    /* Colors - Dark Theme */
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --border-color: #2d3748;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #6b7280;
    
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-bg: #1e1b4b;
    --accent-text: #c7d2fe;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Master Layout */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Layout */
.sidebar-pane {
    width: var(--sidebar-width);
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.header-logo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.logo-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text span {
    color: var(--accent);
}

.subtitle-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 400;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.theme-toggle-btn svg {
    width: 16px;
    height: 16px;
}

[data-theme="dark"] .sun-icon {
    display: block;
}
[data-theme="dark"] .moon-icon {
    display: none;
}
body:not([data-theme="dark"]) .sun-icon {
    display: none;
}
body:not([data-theme="dark"]) .moon-icon {
    display: block;
}

/* Search Bar styling */
.search-box-container {
    position: relative;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 36px 10px 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: all var(--transition-speed);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
}

.clear-search-btn:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.clear-search-btn svg {
    width: 14px;
    height: 14px;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.reset-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.reset-link:hover {
    color: var(--accent-hover);
}

/* Abstracts Scrollable List */
.abstracts-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Abstract Item Cards */
.abstract-card {
    padding: 16px;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-speed);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.abstract-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.abstract-card.active {
    border-color: var(--accent);
    background-color: var(--accent-bg);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.card-id-badge {
    font-size: 10px;
    font-weight: 600;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.abstract-card.active .card-id-badge {
    background-color: var(--accent);
    color: white;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.abstract-card.active .card-title {
    color: var(--accent-text);
}

.card-authors {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.abstract-card.active .card-authors {
    color: var(--accent-text);
    opacity: 0.8;
}

/* Loading & Empty States */
.loading-state, .empty-results {
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 12px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-results svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.empty-results h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-results p {
    font-size: 12px;
}

/* Detail Pane (Right Side) */
.detail-pane {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.mobile-nav-bar {
    display: none;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.mobile-nav-title {
    margin-left: 20px;
    font-weight: 600;
    font-size: 14px;
}

.detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 40px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.metadata-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.detail-id-badge {
    background-color: var(--accent-bg);
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.detail-session-tag {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.detail-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Interactive Authors Section */
.detail-authors {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.authors-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
}

.authors-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.author-chip {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.author-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--accent-bg);
}

/* Abstract Content Section */
.detail-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.abstract-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
}

.abstract-prose {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap; /* Keeps paragraphs and empty lines */
}

/* Prose highlights for search term matching */
.highlight {
    background-color: rgba(253, 224, 71, 0.4);
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}

/* Empty State Detail Pane */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    max-width: 400px;
    margin: auto;
    gap: 16px;
}

.empty-illustration {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
        overflow: hidden;
    }
    
    .sidebar-pane {
        width: 100%;
        height: 100%;
        transition: transform var(--transition-speed) ease-in-out;
    }
    
    .detail-pane {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 20;
        background-color: var(--bg-primary);
        transform: translateX(100%);
        transition: transform var(--transition-speed) ease-in-out;
    }
    
    /* Toggle states for mobile view navigation */
    .app-wrapper.show-detail .sidebar-pane {
        transform: translateX(-100%);
    }
    
    .app-wrapper.show-detail .detail-pane {
        transform: translateX(0);
        display: flex;
    }
    
    .mobile-nav-bar {
        display: flex;
    }
    
    .detail-container {
        padding: 24px 20px;
    }
    
    .detail-title {
        font-size: 22px;
    }
}
