/* ==========================================================================
   reachhome.css - Unified Master Stylesheet
   Clean, Scaled-Down UI with Fixed 8px Border Radius
   Official BSU Brand Palette
   ========================================================================== */

/* --- 1. GLOBAL VARIABLES & RESET --- */
/* Design tokens live in reach-tokens.css, loaded by the page header BEFORE
   this file. The :root block that used to sit here was moved there.

   It came back once: a chrome edit was based on a staged copy of this file
   that predated the move, which silently re-declared all 17 tokens and
   shadowed reach-tokens.css - the contrast fix in the token sheet had no
   effect until this was removed again. Do not re-add it. */


*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    background-color: var(--page);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15px; 
    overflow-x: hidden;
}

.hidden { display: none !important; }
.hidden-dropdown { display: none !important; }
.mobile-only { display: none !important; }

/* --- 2. GLOBAL BUTTONS & FORMS --- */

.btn-primary, .auth-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background-color: var(--primary-color);
    color: #ffffff;
    border: 1px solid var(--secondary-color); 
    border-radius: var(--border-radius);
    padding: 12px 20px; 
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-primary:hover, .auth-submit-btn:hover {
    background-color: var(--secondary-color);
    color: #ffffff;
}

.adv-input, .auth-input {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--surface);
    border: 1px solid var(--border); 
    border-radius: var(--r-md);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.adv-input:focus, .auth-input:focus {
    outline: none;
    border-color: var(--brand);
    background-color: #fff;
    box-shadow: 0 0 0 3px var(--brand-tint-line);
}


/* --- 3. LAYOUT SCAFFOLDING --- */
.layout-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 70px); 
    background-color: var(--page);
}

.main-content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--page);
    border: none; 
        }

.dashboard-wrapper-padding {
    padding: 30px;
}


/* --- 4. HEADER --- */
.global-header {
    height: 70px; 
    width: 100%;
    background-color: var(--surface);
    padding: 0 20px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    box-sizing: border-box;
    border-top: 3px solid var(--brand);
    border-bottom: 1px solid var(--border);
}

.search-dark-overlay {
    position: fixed;
    /* inset:0 instead of 100vw/100vh - 100vw includes the scrollbar, so the
       overlay overhung the page and made it scroll sideways while open. */
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.search-dark-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.header-left-section {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 1; 
    min-width: 0;   
}

.global-menu-toggle {
    width: 40px; 
    height: 40px;
    margin: 0 15px 0 0; 
    flex-shrink: 0; 
    border-radius: var(--border-radius);
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-logo-wrapper {
    flex-shrink: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.header-logo-img {
    height: 45px; 
    max-width: 100%; 
    object-fit: contain;
    margin-left: 0;
}

.header-search-area {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    padding-right: 15px;
    align-items: center; 
}

.header-search-form {
    width: 100%;
    max-width: 350px;
    margin: 0; 
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.hidden-submit-btn { display: none !important; }

.main-search-input {
    width: 100%;
    height: 40px; 
    padding: 0 20px 0 40px;
    background-color: var(--surface-sunken); 
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    color: var(--text) !important; 
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.main-search-input::placeholder { color: var(--text-subtle) !important; }

.main-search-input:focus {
    background-color: var(--surface); 
    color: var(--text) !important; 
    border: 1px solid var(--brand); 
    outline: none;
    box-shadow: var(--focus-ring);
}

.search-icon-left {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
    pointer-events: none;
    transition: color 0.2s ease;
}

.main-search-input:focus ~ .search-icon-left { color: var(--brand); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-action-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0; 
    background-color: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.global-menu-toggle:hover, .header-action-btn:hover {
    background-color: var(--surface-sunken);
    color: var(--text);
}
.global-menu-toggle:focus-visible,
.header-action-btn:focus-visible,
.mini-nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.circle-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--accent); 
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.profile-dropdown-container { position: relative; }

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color); 
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); 
}

.profile-dropdown-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.profile-avatar {
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; 
    font-size: 1.2rem;
    margin: 0 auto 10px auto;
}

.profile-name { font-weight: 700; color: var(--text-main); font-size: 1rem; }
.profile-role { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin-top: 2px;}

.profile-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.profile-menu-link:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
}

.profile-menu-logout {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.profile-menu-icon { width: 20px; text-align: center; color: var(--text-muted); }
.profile-menu-link:hover .profile-menu-icon { color: var(--secondary-color); }
.profile-menu-divider { border-bottom: 1px solid var(--border-color); }


/* --- 5. SIDEBAR --- */
.sidebar {
    width: 80px;
    background-color: var(--surface);
    border: none; 
    padding: 15px 0;
    transition: width 0.3s ease;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.sidebar.expanded { width: 240px; }
.close-sidebar-btn { display: none; }

.mini-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.mini-nav-item {
    display: flex;
    align-items: center;
    justify-content: center; 
    height: 40px; 
    width: 40px;  
    margin: 0 auto; 
    color: var(--text-muted);
    text-decoration: none;
    font-weight: var(--fw-medium);
    font-size: 0.95rem;
    white-space: nowrap;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.mini-nav-item i {
    font-size: 1.1rem;
    width: 40px; 
    text-align: center;
    flex-shrink: 0;
}

.mini-nav-item span {
    margin-left: 5px;
    opacity: 0;
    display: none;
}

.sidebar.expanded .mini-nav-item,
.sidebar.active .mini-nav-item {
    width: calc(100% - 30px); 
    margin: 0 auto;
    justify-content: flex-start;
    padding-left: 15px; 
}

.sidebar.expanded .mini-nav-item span,
.sidebar.active .mini-nav-item span {
    display: block;
    opacity: 1;
}

.mini-nav-item:hover {
    background-color: var(--surface-sunken);
    color: var(--text);
}
.mini-nav-item.active {
    background-color: var(--brand-tint);
    color: var(--brand-ink);
    font-weight: var(--fw-semibold);
}
.mini-nav-item.active i { color: var(--brand); }


/* --- 6. FOOTER --- */
.global-footer {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none; 
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 60px;
    padding: 40px;
    text-align: center;
}

.footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
}

.footer-col h4 {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.footer-sub-brand { font-weight: 600; font-size: 0.95rem; margin-bottom: 10px; }
.footer-contact-info { font-size: 0.9rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px;}
.footer-icon { color: var(--accent-color); }

.footer-col ul { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.footer-link {
    color: #ffffff;
    text-decoration: none;
    padding: 4px 10px;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.footer-link:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
}

.footer-bottom-wrapper {
    background-color: var(--accent-color);
    padding: 15px 40px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 0.85rem;
    max-width: 1400px;
    margin: 0 auto;
}


/* --- 7. AUTHENTICATION MODAL --- */
.auth-modal-overlay {
    position: fixed;
    inset: 0;   /* not 100vw/100vh: 100vw includes the scrollbar */
    background-color: rgba(8, 33, 3, 0.85); 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-modal-wrapper {
    display: flex;
    width: 900px; 
    max-width: 95%;
    min-height: 550px; 
    max-height: 90vh;
    background-color: var(--surface);
    border-radius: var(--r-lg); 
    border: none; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); 
    overflow: hidden;
}

.auth-modal-left {
    flex: 1;
    background-image: url('../img/re.webp');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    color: white;
}

/* The Terms of Use dialog scrolls with .rx-dialog-scroll (reach-chrome.css). */

.auth-modal-right {
    flex: 1.2;
    padding: 40px 50px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.btn-close-modal-new {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none; 
    border-radius: var(--border-radius);
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-modal-new:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.auth-view-container { margin: auto 0; }
.auth-header { margin-bottom: 25px; }
.auth-title { color: var(--primary-color); font-size: 1.6rem; font-weight: 800; margin-bottom: 5px; line-height: 1; }
.auth-subtitle { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

.auth-form-group { margin-bottom: 15px; }
.auth-label { display: block; font-weight: 800; color: var(--text-muted); margin-bottom: 4px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

.password-wrapper { position: relative; width: 100%; }
.password-wrapper input { padding-right: 40px; }
.password-wrapper i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}
.password-wrapper i:hover { color: var(--primary-color); }
/* The eye is a keyboard control too (tabindex="0" in footer.php). */
.password-wrapper i:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); color: var(--brand); }

.auth-form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.auth-split-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.auth-col { flex: 1; min-width: calc(50% - 10px); }
@media (max-width: 480px) {
    .auth-split-row { flex-direction: column; gap: 12px; margin-bottom: 15px; }
    .auth-col { min-width: 100%; }
}

.auth-checkbox-group { display: flex; align-items: flex-start; gap: 8px; }
.auth-checkbox { margin-top: 3px; cursor: pointer; accent-color: var(--primary-color); }
.auth-checkbox-label { font-size: 0.85rem; color: var(--text-main); font-weight: 600; cursor: pointer; }

.auth-toggle-link, .auth-terms-link { color: var(--primary-color); font-weight: 800; cursor: pointer; text-decoration: none; border-bottom: 2px solid transparent; transition: all 0.2s; }
.auth-toggle-link:hover, .auth-terms-link:hover { color: var(--accent-dark); }

.auth-otp-input { text-align: center; font-size: 1.5rem; letter-spacing: 10px; font-weight: 800; color: var(--primary-color); }
.auth-footer-text { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }

/* Dialog stacking and look: "DIALOGS" in reach-chrome.css. */


/* --- 8. REPOSITORY CARDS (List & Grid Layouts) --- */

.repo-grid-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: row; 
    align-items: stretch; 
    width: 100% !important; 
    cursor: pointer;
    overflow: hidden;
}

.repo-grid-card:hover .repo-card-title { color: var(--accent-dark); }

.repo-card-thumbnail {
    width: 110px; 
    height: 150px; 
    flex-shrink: 0;
    background-color: var(--bg-color);
    border-right: 1px solid var(--border-color); 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.repo-card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.repo-card-no-cover {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.repo-card-content {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1; 
    width: 100%; 
    min-width: 0; 
}

.repo-card-title {
    font-size: 1.05rem; 
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease; 
}

.repo-card-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-card-stats {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.academic-list-top-border {
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

.academic-list-card {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.academic-list-card:hover { background-color: #f8fafc; }
.academic-list-card:hover .academic-list-title { color: var(--accent-dark); }

.academic-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
    gap: 15px; 
}

.academic-list-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.academic-list-badge {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.academic-list-meta {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.academic-list-abstract {
    color: var(--primary-color);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 8px;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.academic-list-author {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.academic-list-stats {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.8rem;
}

.academic-list-stats span { color: var(--accent-dark); }
.academic-list-stats .spacing { margin-left: 12px; color: var(--primary-color); }

.repo-grid-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; 
    gap: 25px;
    width: 100%;
}

.repo-list-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}


/* --- 9. PAGINATION CONTROLS --- */
.repo-pagination-wrapper {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.repo-page-btn {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--secondary-color); 
    border-radius: var(--border-radius);
    padding: 10px 18px; 
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.repo-page-btn:hover:not(:disabled) {
    background-color: var(--accent-color);
    color: var(--secondary-color);
}

.repo-page-btn:disabled {
    background-color: var(--bg-color);
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

.repo-page-current {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    min-width: 30px;
    text-align: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;   /* not 100vw/100vh: 100vw includes the scrollbar */
    background-color: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-search-toggle { display: none; }
.sidebar-mobile-logo { display: none; }


/* --- 10. DASHBOARD & CAROUSEL (THE RESTORED SECTION) --- */
.dashboard-panel {
    max-width: 1300px;
    margin: 0 auto;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color); 
    border-radius: var(--border-radius);
    padding: 30px 40px;
}

.dashboard-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-title {
    margin: 0;
    font-size: 1.6rem;
    color: var(--primary-color);
    font-weight: 800;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-clear-filters {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 18px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-clear-filters:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.sort-wrapper { display: flex; gap: 10px; align-items: center; }
.sort-label { font-weight: 800; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.sort-select-container { position: relative; }

.sort-select {
    appearance: none;
    padding: 10px 35px 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-family: 'Outfit', sans-serif;
    outline: none;
    background-color: var(--surface-color);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.sort-select:focus { border-color: var(--primary-color); }
.sort-select-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

/* View Toggle Buttons */
.app-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    background-color: var(--bg-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.app-btn:hover, .app-btn.active {
    background-color: var(--accent-color);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Featured Carousel */
.carousel-container {
    max-width: 1300px;
    margin: 0 auto 30px auto;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--secondary-color); 
    color: white;
    display: none;
    border: 1px solid var(--secondary-color);
}

.carousel-track { 
    display: flex; 
    transition: transform 0.5s ease-in-out; 
    height: auto; 
    min-height: 280px; 
    align-items: stretch;
}

.carousel-slide {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 120px;
    box-sizing: border-box;
}

.carousel-content-left {
    max-width: 65%;
    z-index: 2;
}

.carousel-content-right {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    z-index: 2;
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid transparent;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav-btn:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.carousel-nav-prev { left: 20px; }
.carousel-nav-next { right: 20px; }
.carousel-indicators-container { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 10; }

.carousel-dot {
    width: 10px; height: 10px; border-radius: 5px; 
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer; transition: background-color 0.2s ease;
}
.carousel-dot.active { background-color: var(--accent-color); }

.carousel-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: inline-block;
}

.carousel-title-link {
    font-size: 1.8rem; 
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    margin: 0 0 10px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.carousel-title-link:hover {
    color: var(--accent-color);
}

.carousel-meta { 
    font-size: 0.9rem; 
    color: #cbd5e1; 
    margin: 0; 
    font-weight: 500; 
}

.carousel-stat-modern {
    text-align: right;
    font-size: 0.8rem;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.carousel-stat-modern .stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-color); 
    display: block;
    margin-bottom: 2px;
}

/* Grid Loading Skeletons */
.skeleton-grid-card { background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--border-radius); height: 100%; display: flex; flex-direction: column; }
.skeleton-thumbnail { width: 100%; height: 150px; background-color: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.skeleton-content { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.skel-text { background: linear-gradient(110deg, #e2e8f0 8%, #f8fafc 18%, #e2e8f0 33%); background-size: 200% 100%; animation: 1.5s shine linear infinite; border-radius: 4px; }
@keyframes shine { to { background-position-x: -200%; } }


/* --- 11. DOCUMENT READER & SIDEBAR (detail.php) --- */

.reader-layout {
    display: flex;
    align-items: flex-start;
    gap: 30px; 
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

.main-reader-panel {
    flex: 1; 
    min-width: 0; 
    background-color: var(--surface-color);
    border-radius: var(--border-radius); 
    border: 1px solid var(--border-color); 
    overflow: hidden;
}

.related-panel {
    flex: 0 0 350px; 
    width: 350px;
    background-color: var(--surface-color);
    border-radius: var(--border-radius); 
    padding: 30px; 
    border: 1px solid var(--border-color); 
    box-sizing: border-box;
}

.related-title {
    margin: 0 0 20px 0; 
    font-size: 1.2rem; 
    color: var(--primary-color); 
    font-weight: 800; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 15px;
}

.related-card { display: flex; gap: 15px; margin-bottom: 20px; cursor: pointer; }
.related-card:hover .related-card-title { color: var(--accent-dark); }

.related-card-thumbnail {
    width: 70px;
    height: 95px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.related-card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.related-card-info { display: flex; flex-direction: column; justify-content: center; flex: 1; }

.related-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.related-card-author { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.related-card-bottom { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; }

.reader-header { padding: 40px; border-bottom: 1px solid var(--border-color); background-color: var(--surface-color); }
.reader-badges { display: flex; gap: 10px; margin-bottom: 15px; }
.reader-badge { padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; }
.badge-gray { background-color: var(--bg-color); color: var(--text-muted); }
.badge-green { background-color: rgba(32, 101, 10, 0.1); color: var(--primary-color); }

.reader-title-text { margin: 0 0 15px 0; font-size: 2.2rem; color: var(--primary-color); line-height: 1.2; font-weight: 800; }

.reader-meta-container { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px; }
.reader-author-text { margin: 0 0 5px 0; color: var(--text-main); font-weight: 800; font-size: 1.1rem; }
.reader-stats-text { margin: 0; color: var(--text-muted); font-size: 0.9rem; font-weight: 600; }
.reader-stats-text i { margin-left: 12px; }
.reader-stats-text i:first-child { margin-left: 0; }

.reader-tags { margin-top: 15px; font-size: 0.85rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.reader-tags a { color: var(--primary-color); text-decoration: none; font-weight: 700; }

.reader-abstract { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--border-color); }
.reader-abstract h3 { font-size: 1rem; color: var(--text-main); margin: 0 0 10px 0; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 800; }
.reader-abstract p { color: var(--text-main); line-height: 1.7; margin: 0; font-size: 1rem; }

.citation-box { margin-top: 30px; background-color: transparent; border: none; padding: 0; }
.citation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.citation-header h4 { margin: 0; color: var(--primary-color); font-size: 1rem; font-weight: 800; }

.btn-copy-citation { background-color: transparent; border: 1px solid var(--accent-dark); color: var(--text-main); padding: 6px 16px; border-radius: var(--border-radius); cursor: pointer; font-size: 0.85rem; font-weight: 800; display: flex; align-items: center; gap: 6px; transition: all 0.2s ease; }
.btn-copy-citation:hover { background-color: var(--accent-dark); color: #ffffff; }

.citation-text { margin: 0; color: var(--text-main); font-size: 0.95rem; line-height: 1.6; font-family: Georgia, serif; -webkit-user-select: none; -ms-user-select: none; user-select: none; }

.reader-viewer-area { background-color: var(--bg-color); padding: 20px; border-top: 1px solid var(--border-color); }

.reader-message-box { padding: 60px 20px; text-align: center; background-color: var(--surface-color); border-radius: var(--border-radius); border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; }
.reader-message-icon { font-size: 2.5rem; margin-bottom: 20px; }
.reader-message-box h3 { margin: 0 0 15px 0; color: var(--primary-color); font-size: 1.5rem; font-weight: 800; }
.reader-message-box p { color: var(--text-muted); margin: 0 0 30px 0; max-width: 500px; line-height: 1.6; font-size: 0.95rem; font-weight: 500; }

.custom-pdf-viewer { height: 850px; background-color: #e2e8f0; border-radius: var(--border-radius); border: 1px solid var(--border-color); overflow: hidden; display: flex; flex-direction: column; }
.pdf-toolbar { display: flex; justify-content: space-between; align-items: center; background-color: var(--surface-color); border-bottom: 1px solid var(--border-color); padding: 12px 20px; }
.pdf-controls { display: flex; gap: 10px; align-items: center; }
.pdf-page-info { font-size: 0.9rem; font-weight: 800; color: var(--text-muted); }

.pdf-btn { padding: 6px 12px; background-color: var(--bg-color); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 4px; cursor: pointer; transition: all 0.2s ease; }
.pdf-btn:hover { background-color: var(--border-color); }
.pdf-canvas-wrapper { flex: 1; overflow: auto; padding: 20px; display: flex; justify-content: center; background-color: #e2e8f0; }

.btn-doc-action { width: 100%; border: none; cursor: pointer; border-radius: var(--border-radius); padding: 12px 25px; font-size: 0.95rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; font-family: 'Outfit', sans-serif; }
.btn-doc-download { background-color: var(--primary-color); color: #ffffff; }
.btn-doc-download:hover { background-color: var(--secondary-color); }
.btn-doc-restricted { background-color: #dc2626; color: #ffffff; }
.btn-doc-restricted:hover { background-color: #b91c1c; }


/* --- 13. ADVANCED SEARCH (advanced-search.php) --- */

.filter-tags-container { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.filter-tag { background-color: var(--surface-sunken); border: 1px solid var(--border); color: var(--text); padding: 2px 10px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-bold); display: flex; align-items: center; gap: 8px; animation: fadeIn 0.3s ease; }
.filter-tag i { cursor: pointer; color: var(--text-muted); transition: color 0.2s; }
.filter-tag i:hover { color: #dc2626; }
.filter-tag-x { background: none; border: none; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; }

/* --- 14. SUBMISSION FORM (submit.php) --- */

/* Custom upload zones for submit.php */
.submit-section-title { font-size: var(--fs-lg); color: var(--text); margin: 0 0 var(--s-5) 0; font-weight: var(--fw-bold); display: flex; align-items: center; gap: var(--s-2); }
.submit-upload-zone { position: relative; border: 2px dashed var(--border); padding: 40px 20px; text-align: center; border-radius: var(--r-md); background-color: var(--surface-sunken); transition: all 0.3s ease; display: flex; flex-direction: column; align-items: center; gap: 15px; overflow: hidden; }
.submit-upload-zone.has-file, .submit-cover-zone.has-file { border-color: var(--brand); background-color: rgba(32, 101, 10, 0.03); border-style: solid; }
.file-name-display { margin-top: 10px; font-size: var(--fs-sm); color: var(--brand); font-weight: var(--fw-bold); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-remove-file { position: absolute; top: 10px; right: 10px; z-index: 20; display: none; background-color: #fee2e2; color: #dc2626; border: 1px solid #fecaca; padding: 4px 10px; border-radius: 4px; font-weight: var(--fw-bold); cursor: pointer; font-size: var(--fs-xs); transition: 0.2s; }
.btn-remove-file:hover { background-color: #fecaca; }

.submit-cover-zone { position: relative; border: 1px solid var(--border); padding: 15px; border-radius: var(--r-md); background-color: var(--surface-sunken); transition: all 0.3s; display: flex; align-items: center; gap: 15px; overflow: hidden; }

/* --- 15. NOTIFICATIONS (notifications.php) --- */

.notif-container { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background-color: var(--surface); }
.notif-empty-state { min-height: 450px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; color: var(--text-muted); }

.notif-item { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--border); display: flex; gap: var(--s-5); transition: background-color 0.2s ease; cursor: pointer; background-color: var(--surface); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background-color: var(--surface-hover); }
.notif-item.unread { background-color: rgba(32, 101, 10, 0.03); }
.notif-item.unread:hover { background-color: rgba(32, 101, 10, 0.06); }

.notif-icon { width: 45px; height: 45px; border-radius: var(--r-md); background-color: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.2rem; border: 1px solid var(--border); transition: all 0.2s ease; }
.notif-item.unread .notif-icon { background-color: var(--brand); color: #ffffff; border-color: var(--brand); }

.notif-content { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.notif-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 10px; }

.notif-title { margin: 0; font-size: var(--fs-md); color: var(--text); font-weight: var(--fw-bold); }
.notif-item.unread .notif-title { color: var(--brand); font-weight: var(--fw-bold); }

.notif-badge { font-size: var(--fs-xs); background-color: #dc2626; color: white; padding: 4px 8px; border-radius: var(--r-sm); margin-left: 8px; text-transform: uppercase; font-weight: var(--fw-bold); vertical-align: middle; letter-spacing: 0.5px; }

.notif-date { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; font-weight: normal; flex-shrink: 0; }

.notif-message { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.notif-item.unread .notif-message { color: var(--text); font-weight: var(--fw-semibold); }

/* --- 16. USER PROFILE (profile.php) --- */

.profile-header-wrapper { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; padding-bottom: 30px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; gap: 20px; }
.profile-user-info { display: flex; gap: clamp(15px, 3vw, 25px); align-items: center; flex: 1 1 min-content; min-width: 250px; }

.profile-avatar { width: clamp(70px, 15vw, 100px); height: clamp(70px, 15vw, 100px); background-color: var(--primary-color); border-radius: var(--border-radius); display: flex; align-items: center; justify-content: center; color: #ffffff; font-size: clamp(2rem, 5vw, 3rem); flex-shrink: 0; }
.profile-details { flex: 1; min-width: 0; }
.profile-details h1 { margin: 0 0 8px 0; font-size: clamp(1.5rem, 5vw, 2.2rem); color: var(--primary-color); font-weight: 800; line-height: 1.2; word-wrap: break-word; }
.profile-meta { display: flex; flex-wrap: wrap; gap: clamp(8px, 2vw, 15px); color: var(--text-muted); font-size: clamp(0.85rem, 3vw, 0.95rem); font-weight: 600; }
.profile-meta span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.profile-actions { display: flex; flex-direction: column; gap: 15px; flex: 1 1 200px; }
@media (min-width: 600px) {
    .profile-actions { align-items: flex-end; flex: 0 0 auto; }
}
.role-badge { background-color: var(--bg-color); color: var(--text-main); padding: 6px 16px; border-radius: 4px; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; border: 1px solid var(--border-color); align-self: flex-start; }
@media (min-width: 600px) {
    .role-badge { align-self: flex-end; }
}

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: clamp(10px, 3vw, 20px); margin-bottom: 40px; }
.metric-card { background-color: var(--bg-color); padding: clamp(15px, 4vw, 25px); border-radius: var(--border-radius); border: 1px solid var(--border-color); }
.metric-label { font-size: clamp(0.7rem, 2vw, 0.8rem); color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 800; margin-bottom: 8px; }
.metric-value { font-size: clamp(1.5rem, 5vw, 2.2rem); font-weight: 800; color: var(--primary-color); line-height: 1; }

.ledger-container { border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; background-color: var(--surface-color); }
.ledger-table { width: 100%; border-collapse: collapse; text-align: left; }
.ledger-table th { padding: 16px 20px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 800; color: var(--text-muted); background-color: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.ledger-table td { padding: 18px 20px; border-bottom: 1px solid var(--border-color); color: var(--text-main); font-weight: 600; transition: background-color 0.2s; }
.ledger-table tr:last-child td { border-bottom: none; }
.ledger-table tr:hover td { background-color: var(--bg-color); }

.status-badge { padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; display: inline-flex; align-items: center; gap: 4px; }
.status-archived { background-color: var(--bg-color); color: var(--text-muted); border: 1px solid var(--border-color); }
.status-published { background-color: rgba(32, 101, 10, 0.1); color: var(--primary-color); border: 1px solid var(--primary-color); }
.status-declined { background-color: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.status-pending { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }

.ledger-title-link { color: var(--primary-color); font-weight: 800; font-size: 1.05rem; display: block; margin-bottom: 4px; text-decoration: none; transition: color 0.2s; }
.ledger-title-link:hover { color: var(--accent-dark); }
.ledger-title-text { color: var(--text-muted); font-weight: 800; font-size: 1.05rem; display: block; margin-bottom: 4px; }
.ledger-title-text.strike { text-decoration: line-through; }

.pagination-bar { display: flex; justify-content: space-between; align-items: center; padding-top: 25px; margin-top: 5px; }
.pagination-info { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
.pagination-controls-group { display: flex; gap: 10px; }
.btn-page { padding: 8px 18px; border: 1px solid var(--border-color); background-color: var(--surface-color); color: var(--text-main); border-radius: var(--border-radius); cursor: pointer; font-size: 0.9rem; font-weight: 800; transition: all 0.2s; }
.btn-page:hover:not(:disabled) { background-color: var(--border-color); }
.btn-page:disabled { background-color: var(--bg-color); color: var(--text-muted); cursor: not-allowed; }



/* --- 18. LEGAL & POLICY PAGES (privacy.php, etc.) --- */

.policy-content { line-height: 1.8; color: var(--text); font-size: var(--fs-md); }
.policy-content h1, .policy-content h2, .policy-content h3 { color: var(--text); font-family: var(--font-title); font-weight: var(--fw-bold); margin-top: 1.5em; margin-bottom: 0.5em; }
/* The reset at the top of this file zeroes every margin and padding, so
   without these the policy text ran together as one block and list
   bullets hung outside the panel. */
.policy-content h3 { font-size: var(--fs-lg); margin-top: 1.2em; margin-bottom: 0.3em; }
.policy-content > :first-child { margin-top: 0; }
.policy-content p { margin: 0 0 0.9em; }
.policy-content ul, .policy-content ol { margin: 0 0 1em; padding-left: 1.5em; }
.policy-content ul { list-style: disc; }
.policy-content ol { list-style: decimal; }
.policy-content li { margin: 0.2em 0; padding-left: 0.2em; }
.policy-content a { color: var(--brand-ink); text-decoration: underline; overflow-wrap: anywhere; }
.policy-loading { text-align: center; padding: var(--s-8) var(--s-4); color: var(--text-muted); }
.policy-loading i { font-size: 2.5rem; margin-bottom: var(--s-3); color: var(--border-strong); }
.policy-loading h3 { margin: 0; color: var(--text); font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.policy-error { padding: 40px; color: #dc2626; font-weight: 800; text-align: center; }


/* ==========================================================================
   --- 19. RESPONSIVE BREAKPOINTS (MUST BE AT THE BOTTOM) --- 
   ========================================================================== */

@media (max-width: 1024px) {
    .global-header { padding: 0 10px; } 
    .global-menu-toggle { margin: 0 10px 0 0; }
    .header-search-area { padding-right: 10px; }

    .auth-modal-wrapper { flex-direction: column; height: auto; max-height: 90vh; }
    .auth-modal-left { display: none; }
    .auth-modal-right { padding: 20px 15px; }
    
    .reader-layout { flex-direction: column; }
    .related-panel { flex: none; width: 100%; }
}

@media (max-width: 900px) {
    .repo-grid-container { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    
    /* Header & Sidebar Mobile Overrides */
    .global-header { padding: 0 10px; position: relative; }
    .global-menu-toggle { margin: 0 5px 0 0; }
    .header-logo-img { height: 32px; margin-left: 0; }
    
    .sidebar { position: fixed; left: -100%; top: 0; height: 100vh; z-index: 2000; width: 240px; transition: left 0.3s ease; }
    .sidebar.active { left: 0; }
    .sidebar-mobile-logo { display: flex; align-items: center; padding: 20px 20px 30px 20px; }
    .sidebar-mobile-logo img { height: 35px; }
    .close-sidebar-btn { display: block; position: absolute; top: 15px; right: 15px; background: transparent; border: none; color: rgba(255, 255, 255, 0.7); font-size: 1.5rem; cursor: pointer; }
    
    /* Mobile Search Area */
    .mobile-search-toggle { display: flex; }
    .header-search-area { position: absolute; top: 100%; left: 0; width: 100%; background-color: var(--surface); padding: 10px 15px; display: none; z-index: 1000; border-bottom: 1px solid var(--border); justify-content: center; }
    .header-search-area.expanded-mobile { display: flex; }
    .header-search-form { max-width: 100%; }

    /* Dashboard & Layout Overrides */
    .dashboard-wrapper-padding { padding: 0; }
    .main-content-area { border-radius: 0; }
    
    .dashboard-panel {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 20px 15px;
        margin: 0;
    }
    
    .carousel-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        margin-bottom: 0;
    }
    
    .carousel-slide {
        padding: 35px 20px 60px 20px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 15px;
    }
    
    .carousel-content-left { max-width: 100%; }
    .carousel-content-right { width: 100%; justify-content: flex-start; }
    
    .carousel-title-link { font-size: 1.4rem; }
    
    .carousel-stat-modern {
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .carousel-stat-modern .stat-num { margin-bottom: 0; font-size: 1.4rem; }
    
    .carousel-nav-btn {
        width: 32px;
        height: 32px;
        background-color: rgba(8, 33, 3, 0.6);
    }
    .carousel-nav-prev { left: 10px; }
    .carousel-nav-next { right: 10px; }
    
    /* Academic List Text Scaling */
    .academic-list-card { padding: 12px 0; }
    .academic-list-title { font-size: 0.95rem; }
    .academic-list-badge { font-size: 0.75rem; }
    .academic-list-meta { font-size: 0.75rem; margin-bottom: 4px; }
    .academic-list-abstract { font-size: 0.8rem; margin-bottom: 6px; line-height: 1.3; }
    .academic-list-author { font-size: 0.75rem; margin-bottom: 4px; }
    .academic-list-stats { font-size: 0.75rem; }
    .academic-list-stats .spacing { margin-left: 8px; }

    .footer-bottom { flex-direction: column; gap: 10px; }
    .feedback-grid { grid-template-columns: 1fr; }
    
    .notif-item { padding: var(--s-4); gap: var(--s-3); }
    .notif-icon { width: 32px; height: 32px; font-size: 1rem; border-radius: var(--r-sm); }
    .notif-header { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .dashboard-toolbar { flex-direction: column; align-items: flex-start; }
    .toolbar-actions { width: 100%; justify-content: space-between; }
    .sort-wrapper { width: 100%; justify-content: space-between; }
    
    .repo-grid-card { flex-direction: column; }
    .repo-card-thumbnail { width: 100%; height: 180px; border-right: none; border-bottom: 1px solid var(--border-color); }
    
    .academic-list-title { font-size: 0.9rem; line-height: 1.2; }
    .academic-list-badge { font-size: 0.7rem; }
    .academic-list-meta { font-size: 0.7rem; }
    .academic-list-abstract { font-size: 0.75rem; }
    .academic-list-author { font-size: 0.7rem; }
    .academic-list-stats { font-size: 0.7rem; }
    
    .adv-search-grid { grid-template-columns: 1fr; }
    .reader-title-text { font-size: 1.6rem; }
    .reader-header { padding: 20px; }
}
/* --- REPEATABLE AUTHOR FIELDS -------------------------------------
   Replaces the old single "Author(s)" text box. See
   database/README.md for why a comma-separated box could not work.
   Uses the existing design tokens only - no new hardcoded colours. */

.author-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.author-row {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.author-row-index {
    flex: 0 0 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--text-muted);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 50%;
    user-select: none;
}

.author-row .author-input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.author-remove {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.author-remove:hover,
.author-remove:focus-visible {
    color: #dc2626;
    border-color: #fecaca;
    background: #fee2e2;
}

.author-add {
    align-self: flex-start;
    margin-top: var(--s-2);
}

.author-hint {
    margin: 6px 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

/* Tap targets stay usable on a phone, and the row must not overflow. */
@media (max-width: 480px) {
    .author-row-index { flex-basis: 20px; height: 20px; font-size: 0.7rem; }
    .author-remove    { width: 36px; height: 36px; }
}

/* ============================================================
   TABLET — 1024 already exists above; this fills 1024-1200,
   where the content column was still running full desktop
   widths against a 240px sidebar.
   ============================================================ */

@media (max-width: 1200px) and (min-width: 901px) {
    .main-content-area { padding-left: 20px; padding-right: 20px; }
    .dashboard-panel { padding: 24px 28px; }
}

/* ---------------------------------------------------------------------
   Author rows, compact (author-fields.js): the name box, an x from the
   second author on, and the + beside the last row - the same square
   button as the + beside Classification and Institution. It used to be
   a separate "Add author" button under the list, full width on a phone,
   and each row carried its number in a circle outside the box; the
   number is in the placeholder now ("Author 2: surname, given names").
   --------------------------------------------------------------------- */
.author-row { align-items: stretch; }
.author-row .author-input { flex: 1 1 auto; min-width: 0; }
.author-add,
.author-remove {
    flex: 0 0 auto;
    align-self: stretch;
    width: 40px;
    height: auto;
    min-height: 40px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.author-add { color: var(--text); font-size: 0.9rem; }
.author-add:hover { background: var(--surface-sunken); color: var(--text); }
.author-add:focus-visible,
.author-remove:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.author-add[hidden],
.author-remove[hidden] { display: none; }
.author-row-index { display: none; }
