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

:root {
    --primary: #0f1e36;       /* Deep Navy */
    --primary-light: #1d3557; /* Slate Blue */
    --accent: #2563eb;        /* Royal Blue */
    --accent-hover: #1d4ed8;  
    --secondary: #64748b;     /* Slate */
    --background: #f8fafc;    /* Clean Off-White */
    --surface: #ffffff;       /* Pure White */
    --border: #e2e8f0;        /* Light Grey */
    --text: #0f172a;          /* Charcoal */
    --text-muted: #475569;    /* Muted Slate */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* Navbar */
header {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 70px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #f8fafc;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    font-weight: 400;
    margin-top: -2px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 8px;
}

nav ul li a {
    color: #cbd5e1;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

nav ul li a:hover, nav ul li.active a {
    color: white;
    background-color: var(--primary-light);
    text-decoration: none;
}

/* Sub-Navbar (Quick Info, Login & Search) */
.sub-nav {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.sub-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-links a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-light);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.auth-links a:hover {
    background-color: #f1f5f9;
    text-decoration: none;
}

.quick-search-form {
    display: flex;
    gap: 6px;
}

.quick-search-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    width: 220px;
    outline: none;
    transition: var(--transition);
}

.quick-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-search-sm {
    background-color: var(--primary-light);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-search-sm:hover {
    background-color: var(--primary);
}

/* Main Content Area */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* Page Components */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.75px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Main Search Box */
.main-search-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 2.5rem;
    text-align: center;
}

.main-search-group {
    display: flex;
    max-width: 700px;
    margin: 0 auto;
    gap: 8px;
}

.main-search-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.main-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* Card Sections */
.grid-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .grid-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent);
}

.card-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    flex: 1;
}

.card-link {
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Browse View */
.browse-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .browse-container {
        grid-template-columns: 280px 1fr;
    }
}

.sidebar {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    height: fit-content;
}

.sidebar h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 6px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.category-link:hover, .category-item.active .category-link {
    background-color: #eff6ff;
    color: var(--accent);
    text-decoration: none;
}

.category-count {
    background-color: #e2e8f0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    transition: var(--transition);
}

.category-item.active .category-count {
    background-color: var(--accent);
    color: white;
}

/* Document Lists */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.file-item:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.file-category-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-bottom-left-radius: var(--radius-sm);
}

.file-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.25rem;
    max-width: 85%;
}

.file-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.file-meta-row {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--secondary);
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
    margin-top: 8px;
}

.file-abstract-preview {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

/* Document View Page */
.doc-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .doc-detail-grid {
        grid-template-columns: 1fr 350px;
    }
}

.doc-main {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.doc-main h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.doc-author-full {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.doc-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.doc-abstract {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: justify;
    line-height: 1.7;
}

.doc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.doc-meta-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.doc-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.doc-meta-table tr {
    border-bottom: 1px solid #f1f5f9;
}

.doc-meta-table tr:last-child {
    border-bottom: none;
}

.doc-meta-table td {
    padding: 10px 0;
}

.doc-meta-table td.label {
    font-weight: 600;
    color: var(--text-muted);
    width: 100px;
}

.doc-meta-table td.val {
    color: var(--text);
    word-break: break-all;
}

.btn-download {
    background-color: var(--accent);
    color: white;
    text-align: center;
    font-weight: 600;
    padding: 12px;
    border-radius: var(--radius-sm);
    display: block;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    width: 100%;
}

.btn-download:hover {
    background-color: var(--accent-hover);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
}

/* Login Page */
.login-card {
    max-width: 420px;
    margin: 4rem auto;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-submit {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    margin-top: 1rem;
}

.btn-submit:hover {
    background-color: var(--primary-light);
}

/* Admin Dashboard Layout */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.admin-sidebar-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.admin-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.admin-title-row h2 {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

.code-snippet-box {
    background-color: #0f172a;
    color: #38bdf8;
    font-family: 'Courier New', Courier, monospace;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.85rem;
    margin-top: 15px;
    border: 1px solid #334155;
    white-space: pre-wrap;
    word-break: break-all;
    position: relative;
    max-height: 400px;
    overflow-y: auto;
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #334155;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-copy:hover {
    background-color: #475569;
}

/* Alerts and Messages */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Footer styling */
footer {
    background-color: #f1f5f9;
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.footer-feeds {
    display: flex;
    gap: 15px;
    align-items: center;
}

.feed-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #b45309; /* RSS orange-brown */
    font-weight: 600;
}

.feed-link:hover {
    color: #d97706;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-text a {
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--border);
    margin-bottom: 1rem;
    display: block;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: var(--accent);
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Mobile Media Queries
   ========================================================================== */

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 12px;
        text-align: center;
    }
    
    .logo-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .logo-subtitle {
        margin-top: 2px;
    }
    
    nav ul {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    nav ul li a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .sub-nav-container {
        padding: 0.5rem 1rem;
        justify-content: center;
    }
    
    .quick-search-form {
        width: 100%;
        justify-content: center;
    }
    
    .quick-search-input {
        width: 100%;
        max-width: 300px;
    }
    
    main {
        padding: 1.5rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .main-search-card {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .main-search-group {
        flex-direction: column;
        width: 100%;
    }
    
    .main-search-input {
        width: 100%;
        padding: 10px 14px;
    }
    
    .btn-primary {
        width: 100%;
        padding: 12px;
    }
    
    #advanced-search-form div {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    #advanced-search-form .form-group {
        margin-bottom: 8px;
    }
    
    .file-item {
        padding: 1rem;
    }
    
    .file-title {
        font-size: 1rem;
        max-width: 100%;
    }
    
    .file-meta-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .doc-main {
        padding: 1.25rem;
    }
    
    .doc-main h2 {
        font-size: 1.3rem;
    }
    
    .doc-meta-card {
        padding: 1rem;
    }
}

