@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #059669; /* Verde Esmeralda Premium */
    --primary-light: #34d399;
    --primary-dark: #064e3b;
    --accent: #10b981;
    --bg-main: #fcfdfd;
    --bg-body: #f8fafc;
    --text-main: #0f172a; /* Slate dark para mejor contraste */
    --text-muted: #64748b;
    --white: #ffffff;
    --surface: #ffffff;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 50px -12px rgba(0, 0, 0, 0.12);
    --radius-lg: 24px;
    --radius-md: 16px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header - Glassmorphism */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 65px;
    width: auto;
    object-fit: contain;
    transition: var(--transition);
}

.logo:hover img {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a:not(.btn-primary) {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:not(.btn-primary)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--white) !important;
    padding: 0.8rem 1.8rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 20px -5px rgba(5, 150, 105, 0.3);
}

.btn-primary:hover {
    background: var(--white);
    color: var(--primary) !important;
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(5, 150, 105, 0.4);
}

/* Hero Section */
.hero {
    padding: 1.5rem 0;
    background: var(--primary-dark);
    color: var(--white);
    position: relative;
    border-bottom: 4px solid var(--accent);
}

.hero h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.hero p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.search-container-top {
    background: var(--white);
    padding: 2rem 0;
    border-bottom: 1px solid #e2e8f0;
}

/* Search & Filters */
.explore-section {
    position: relative;
    padding: 2rem 0;
    z-index: 10;
}

.search-wrapper {
    background: var(--surface);
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-weight: 500;
}

.filters-bar {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.25rem 0 1.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.filters-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 0.5rem 1.2rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

/* Paper Cards Modern */
.papers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
    padding-bottom: 2rem; /* Reducido un poco porque ahora viene el botón */
}

.paper-item {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.paper-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg, transparent 60%, rgba(5, 150, 105, 0.02) 100%);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius-md);
    opacity: 0;
    transition: var(--transition);
}

.paper-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.paper-item:hover::before {
    opacity: 1;
}

.paper-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1rem;
}

.paper-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.paper-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.paper-desc {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* Paper Card Actions */
.paper-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* NUEVA SECCIÓN: Load More Container */
#loadMoreContainer {
    display: none; /* Se activa desde JS */
    text-align: center;
    padding: 2rem 0 4rem;
}

#loadMoreContainer .btn-primary {
    font-size: 1rem;
    padding: 1rem 3.5rem;
    letter-spacing: 0.02em;
}

/* Modal Pro Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 32px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalScaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-round {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition);
}

.modal-close-round:hover {
    transform: rotate(90deg);
    background: #f1f5f9;
}

.modal-scroll-area {
    overflow-y: auto;
    flex: 1;
}

.modal-header-hero {
    padding: 3.5rem 2.5rem 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, white 100%);
    border-bottom: 2px solid #f1f5f9;
}

.paper-badge-pro {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--primary-dark);
    color: white;
    border-radius: 99px;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.modal-paper-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.25;
    margin-top: 1rem;
}

.modal-body-content {
    padding: 2.5rem;
}

.modal-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1rem;
}

.modal-abstract-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #475569;
}

.modal-footer-info {
    padding: 2.5rem;
    background: #f8fafc;
    border-top: 2px solid #f1f5f9;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
}

.meta-value {
    font-weight: 700;
    color: var(--text-main);
}

.btn-download-pro {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 1.2rem;
    border-radius: 20px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: var(--transition);
}

.btn-download-pro:hover {
    background: var(--primary-dark);
    transform: translateY(-4px);
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    .nav-links { display: none; }
    
    .papers-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal-paper-title { font-size: 1.6rem; }
    
    .modal-meta-grid { grid-template-columns: 1fr; }

    #loadMoreContainer .btn-primary {
        width: 100%;
        padding: 1rem;
    }
}