/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Kibogora Polytechnic palette, taken from kp.ac.rw and the KP crest.
       The four brand colours are also written from the settings table by
       includes/header.php, so a librarian can change them without editing
       this file. */
    --primary: #0a70e3;          /* KP blue, the dominant surface colour */
    --primary-light: #0a70e3;    /* same blue, used for accents and icon tints */
    --primary-dark: #0a5bb8;     /* deeper blue for gradients and hovers */
    --primary-soft: #7cbeeb;     /* KP pale blue */
    --lake: #30a0d0;             /* Lake Kivu, from the crest */
    --leaf: #2f7a43;             /* Tree, from the crest */
    --accent: #e8a838;           /* Open book, from the crest */
    --accent-hover: #d4942a;
    --text: #1e1e2a;
    --text-light: #4a4a5a;
    --bg: #f5f7fa;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --transition: 0.3s ease;
    --max-width: 1200px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

/* ===== TYPOGRAPHY ===== */
.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 0.75rem 1.75rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

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

.btn-outline-small {
    display: inline-block;
    background: transparent;
    color: var(--primary);
    padding: 0.4rem 1.2rem;
    border: 2px solid var(--primary);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 0.5rem;
}

.btn-outline-small:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-login {
    background: var(--accent);
    color: var(--primary);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: background var(--transition);
}

.btn-login:hover {
    background: var(--accent-hover);
}

/* ===== HEADER ===== */
/* ===== INSTITUTIONAL SYSTEMS STRIP ===== */
/* A quiet band above the branding bar for the links that leave the Library:
   the portals, e-learning and the repository. Deliberately darker and
   smaller than the header so it reads as context, not navigation. */
.topbar {
    background: #073f80;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
}

.topbar-inner {
    display: flex;
    justify-content: flex-end;
}

.topbar-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0.4rem 0;
    list-style: none;
}

.topbar-menu a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition);
}

.topbar-menu a:hover,
.topbar-menu a:focus-visible {
    color: var(--white);
    text-decoration: underline;
}

.topbar-menu i {
    margin-right: 0.3rem;
    opacity: 0.75;
}

@media (max-width: 768px) {
    /* On a phone this is the least important row on the page, so it centres
       and wraps rather than competing with the logo for space. */
    .topbar-inner {
        justify-content: center;
    }

    .topbar-menu {
        justify-content: center;
        gap: 0.25rem 0.9rem;
        font-size: 0.78rem;
    }
}

.header {
    background: var(--primary-dark);
    color: var(--white);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--white);
    object-fit: cover;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 0.8rem;
    opacity: 0.8;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    align-items: center;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.15);
}

.nav-menu a.active {
    color: var(--accent);
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 4rem 0 3.5rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.hero-sub {
    font-size: 1.15rem;
    opacity: 0.85;
    margin-bottom: 1.5rem;
}

.search-form {
    max-width: 700px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.search-wrapper input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1.05rem;
    outline: none;
    color: var(--text);
}

.search-wrapper button {
    background: var(--accent);
    color: var(--primary);
    border: none;
    padding: 0 2rem;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background var(--transition);
}

.search-wrapper button:hover {
    background: var(--accent-hover);
}

.search-filters {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.search-filters label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    opacity: 0.85;
    cursor: pointer;
}

.search-filters input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* ===== QUICK ACCESS ===== */
.quick-access {
    padding: 2rem 0;
    background: var(--white);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
    transition: all var(--transition);
    border: 2px solid transparent;
    color: var(--text);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.card p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-catalogue:hover {
    border-color: #2a5a8c;
}
.card-digital:hover {
    border-color: #6c5ce7;
}
.card-research:hover {
    border-color: #00b894;
}
.card-services:hover {
    border-color: #fdcb6e;
}
.card-news:hover {
    border-color: #e17055;
}
.card-about:hover {
    border-color: #0984e3;
}

/* ===== STATUS BAR ===== */
.status-bar {
    background: var(--primary-light);
    color: var(--white);
    padding: 0.75rem 0;
}

.status-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-item i {
    opacity: 0.8;
}

.status-item.emergency {
    font-weight: 600;
}

/* ===== SECTIONS ===== */
.section {
    padding: 3rem 0;
    border-bottom: 1px solid #e9ecef;
}

.section:last-of-type {
    border-bottom: none;
}

/* ===== ANNOUNCEMENTS ===== */
.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.announcement-item {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition);
}

.announcement-item:hover {
    box-shadow: var(--shadow);
}

.announcement-item .badge {
    background: var(--primary);
    color: var(--white);
    padding: 0.15rem 0.7rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.announcement-item .badge.new {
    background: #e17055;
}

.announcement-item p {
    flex: 1;
    font-size: 0.95rem;
}

.announcement-item .date {
    font-size: 0.8rem;
    color: var(--text-light);
    flex-shrink: 0;
}

/* ===== RESOURCES ===== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: all var(--transition);
    border: 1px solid #e9ecef;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.resource-image {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.resource-card h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.resource-author {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.resource-type {
    display: inline-block;
    padding: 0.1rem 0.7rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 0.4rem;
}

.resource-type.book {
    background: #dfe6e9;
    color: #2d3436;
}
.resource-type.journal {
    background: #74b9ff;
    color: #2d3436;
}
.resource-type.thesis {
    background: #fdcb6e;
    color: #2d3436;
}
.resource-type.database {
    background: #55efc4;
    color: #2d3436;
}

.resource-status {
    display: inline-block;
    padding: 0.1rem 0.7rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.resource-status.available {
    background: #d4edda;
    color: #155724;
}
.resource-status.online {
    background: #cce5ff;
    color: #004085;
}

/* ===== EVENTS ===== */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.event-card {
    display: flex;
    gap: 1rem;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition);
    align-items: center;
}

.event-card:hover {
    box-shadow: var(--shadow);
}

.event-date {
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    text-align: center;
    min-width: 60px;
}

.event-date .day {
    font-size: 1.5rem;
    font-weight: 800;
    display: block;
    line-height: 1.2;
}

.event-date .month {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.event-info h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.event-info p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0.1rem 0;
}

.event-info i {
    width: 1.2rem;
    color: var(--primary-light);
}

/* ===== ABOUT PREVIEW ===== */
.about-preview {
    background: var(--white);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text h2 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.about-text p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.stat {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== FAQ ===== */
.faq-grid {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition);
    color: var(--text);
}

.faq-question:hover {
    background: #f8f9fa;
}

.faq-question i {
    transition: transform var(--transition);
    color: var(--primary-light);
}

.faq-question[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1.5rem;
    color: var(--text-light);
}

.faq-answer.open {
    max-height: 200px;
    padding: 0 1.5rem 1rem;
}

/* ===== CONTACT ===== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.contact-item i {
    font-size: 1.3rem;
    color: var(--primary);
    width: 2rem;
    text-align: center;
    margin-top: 0.1rem;
}

.contact-item strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
}

.contact-item p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.contact-item a {
    color: var(--primary);
    font-weight: 500;
}

.contact-item a:hover {
    text-decoration: underline;
}

.contact-form {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 3rem 0 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.footer-col p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.7;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col ul a {
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity var(--transition);
}

.footer-col ul a:hover {
    opacity: 1;
    color: var(--accent);
}

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: background var(--transition);
}

.social-links a:hover {
    background: var(--accent);
    color: var(--primary-dark);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.7;
}

.footer-bottom a {
    color: var(--white);
}

.footer-bottom a:hover {
    opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 1rem 0;
        gap: 0.25rem;
        background: var(--primary-dark);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0.75rem;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu a {
        width: 100%;
        padding: 0.6rem 0.75rem;
        border-radius: 4px;
    }

    .nav-menu a.btn-login {
        background: var(--accent);
        color: var(--primary);
        text-align: center;
        margin-top: 0.25rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-sub {
        font-size: 1rem;
    }

    .search-wrapper input {
        font-size: 0.95rem;
        padding: 0.8rem 1rem;
    }

    .search-wrapper button {
        padding: 0 1.2rem;
        font-size: 1rem;
    }

    .search-filters {
        gap: 0.75rem;
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .announcement-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .announcement-item .badge {
        order: -1;
    }

    .announcement-item .date {
        font-size: 0.7rem;
    }

    .resource-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .events-grid {
        grid-template-columns: 1fr;
    }

    .about-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .status-inner {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo-name {
        font-size: 0.9rem;
    }
    .logo-sub {
        font-size: 0.7rem;
    }
    .logo-img {
        width: 40px;
        height: 40px;
    }

    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    .card {
        padding: 1rem 0.5rem;
    }
    .card i {
        font-size: 1.5rem;
    }
    .card h3 {
        font-size: 0.8rem;
    }
    .card p {
        font-size: 0.65rem;
    }

    .hero {
        padding: 2.5rem 0 2rem;
    }
    .hero h1 {
        font-size: 1.4rem;
    }

    .resource-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ===== PAGE HERO ===== */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 3rem 0 2.5rem;
    text-align: center;
}

.page-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

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

/* ===== CATALOGUE PAGE ===== */
.catalogue-search-section {
    padding-top: 2rem;
}

.catalogue-search-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.catalogue-search-form .search-wrapper {
    display: flex;
    background: var(--bg);
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: border-color var(--transition);
}

.catalogue-search-form .search-wrapper:focus-within {
    border-color: var(--primary);
}

.catalogue-search-form .search-wrapper input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    background: transparent;
    outline: none;
    color: var(--text);
}

.catalogue-search-form .search-wrapper button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0 2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background var(--transition);
}

.catalogue-search-form .search-wrapper button:hover {
    background: var(--primary-light);
}

.catalogue-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
}

.filter-group input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.filter-group select {
    padding: 0.4rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
}

.btn-advanced {
    padding: 0.4rem 1.2rem;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-advanced:hover {
    background: var(--primary);
    color: var(--white);
}

/* ===== SEARCH RESULTS ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.results-count {
    font-size: 1rem;
    color: var(--text);
}

.results-count strong {
    color: var(--primary);
}

.results-time {
    font-size: 0.85rem;
    color: var(--text-light);
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-item {
    display: flex;
    gap: 1.5rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition);
    border: 1px solid #e9ecef;
}

.result-item:hover {
    box-shadow: var(--shadow);
}

.result-image {
    flex-shrink: 0;
    width: 80px;
    height: 100px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-light);
}

.result-details {
    flex: 1;
    min-width: 0;
}

.result-details h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.result-details h3 a {
    color: var(--primary);
    transition: color var(--transition);
}

.result-details h3 a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.result-author {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.4rem;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.1rem 0.7rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-light);
}

.result-meta .tag.book {
    background: #dfe6e9;
    color: #2d3436;
}
.result-meta .tag.journal {
    background: #74b9ff;
    color: #2d3436;
}
.result-meta .tag.thesis {
    background: #fdcb6e;
    color: #2d3436;
}
.result-meta .tag.database {
    background: #55efc4;
    color: #2d3436;
}

.result-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.result-actions .status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
}

.result-actions .status.available {
    background: #d4edda;
    color: #155724;
}

.result-actions .status.online {
    background: #cce5ff;
    color: #004085;
}

.result-actions .status.checked-out {
    background: #fff3cd;
    color: #856404;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--white);
    color: var(--text);
    border: 1px solid #e9ecef;
    font-weight: 600;
    transition: all var(--transition);
}

.pagination a:hover:not(.disabled):not(.active) {
    background: var(--bg);
    border-color: var(--primary);
}

.pagination a.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination a.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== DIGITAL LIBRARY PAGE ===== */
.digital-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.category-card {
    background: var(--bg);
    padding: 1.25rem 0.75rem;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.category-card i {
    font-size: 1.8rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.4rem;
}

.category-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.category-card.active {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: var(--shadow);
}

.digital-search {
    margin-bottom: 2rem;
}

.digital-search .search-wrapper {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: border-color var(--transition);
    max-width: 600px;
}

.digital-search .search-wrapper:focus-within {
    border-color: var(--primary);
}

.digital-search .search-wrapper input {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    font-size: 1rem;
    background: transparent;
    outline: none;
    color: var(--text);
}

.digital-search .search-wrapper button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--transition);
}

.digital-search .search-wrapper button:hover {
    background: var(--primary-light);
}

/* Digital Grid */
.digital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.digital-item {
    display: flex;
    gap: 1rem;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all var(--transition);
    border: 1px solid #e9ecef;
    align-items: flex-start;
}

.digital-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.digital-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: var(--bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-light);
}

.digital-content {
    flex: 1;
    min-width: 0;
}

.digital-content h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.digital-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.digital-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.digital-actions .status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.7rem;
    border-radius: 50px;
}

.digital-actions .status.online {
    background: #cce5ff;
    color: #004085;
}

.digital-actions .status.available {
    background: #d4edda;
    color: #155724;
}

/* ===== SERVICES PAGE ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.service-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all var(--transition);
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.service-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.service-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.service-card ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
    flex: 1;
}

.service-card ul li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.service-card ul li i {
    color: var(--accent);
    font-size: 0.8rem;
    width: 1.2rem;
    text-align: center;
}

.service-card .btn-outline-small {
    align-self: flex-start;
}

/* ===== RESEARCH SUPPORT PAGE ===== */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.research-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all var(--transition);
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.research-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.research-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.research-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.research-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    flex: 1;
    line-height: 1.6;
}

.research-card .btn-outline-small {
    align-self: flex-start;
}

/* ===== ABOUT PAGE ===== */
.about-full {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.about-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e9ecef;
}

.about-section h2 {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.about-section h2 i {
    color: var(--accent);
    margin-right: 0.5rem;
}

.about-section p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.mission-vision {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.mission-vision .mission,
.mission-vision .vision {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.mission-vision h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.mission-vision h3 i {
    color: var(--accent);
    margin-right: 0.5rem;
}

/* Staff Grid */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.staff-card {
    text-align: center;
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.staff-photo {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.staff-card h4 {
    font-size: 1rem;
    color: var(--text);
}

.staff-card .staff-title {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.staff-card p:last-child {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Collections Grid */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.collection-item {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
}

.collection-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.collection-item p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* Facilities Grid */
.facilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.facility {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
}

.facility i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.facility h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.facility p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* Hours Grid */
.hours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.hours-grid div {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

/* Map Placeholder */
.map-placeholder {
    background: var(--bg);
    padding: 3rem;
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-light);
    margin-top: 1rem;
}

.map-placeholder i {
    font-size: 3rem;
    color: var(--primary-light);
    display: block;
    margin-bottom: 0.5rem;
}

/* Policy List */
.policy-list {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.policy-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.policy-list li i {
    color: var(--accent);
    margin-top: 0.2rem;
}

/* ===== HELP / FAQ PAGE ===== */
.faq-search {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.faq-search .search-wrapper {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: border-color var(--transition);
}

.faq-search .search-wrapper:focus-within {
    border-color: var(--primary);
}

.faq-search .search-wrapper input {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    font-size: 1rem;
    background: transparent;
    outline: none;
    color: var(--text);
}

.faq-search .search-wrapper button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--transition);
}

.faq-search .search-wrapper button:hover {
    background: var(--primary-light);
}

.faq-full-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.faq-category h2 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.faq-category h2 i {
    color: var(--accent);
    margin-right: 0.5rem;
}

.faq-category .faq-item {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
}

.faq-category .faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition);
    color: var(--text);
}

.faq-category .faq-question:hover {
    background: #f8f9fa;
}

.faq-category .faq-question i {
    transition: transform var(--transition);
    color: var(--primary-light);
}

.faq-category .faq-question[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.faq-category .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1.5rem;
    color: var(--text-light);
}

.faq-category .faq-answer.open {
    max-height: 300px;
    padding: 0 1.5rem 1rem;
}

.faq-category .faq-answer .btn-outline-small {
    margin-top: 0.5rem;
}

/* ===== CONTACT PAGE ===== */
.contact-full {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.contact-info-large {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-card {
    display: flex;
    gap: 1rem;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e9ecef;
    align-items: flex-start;
}

.contact-card i {
    font-size: 1.5rem;
    color: var(--primary);
    width: 2.5rem;
    text-align: center;
    margin-top: 0.1rem;
}

.contact-card h3 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.contact-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0.1rem 0;
}

.contact-card a {
    color: var(--primary);
    font-weight: 500;
}

.contact-card a:hover {
    text-decoration: underline;
}

.contact-form-large {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.contact-form-large h2 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.contact-form-large .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.contact-form-large .form-group {
    margin-bottom: 1rem;
}

.contact-form-large .form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.contact-form-large .form-group input,
.contact-form-large .form-group select,
.contact-form-large .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color var(--transition);
    background: var(--white);
}

.contact-form-large .form-group input:focus,
.contact-form-large .form-group select:focus,
.contact-form-large .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== RESPONSIVE FIXES ===== */
@media (max-width: 992px) {
    .contact-full {
        grid-template-columns: 1fr;
    }
    
    .mission-vision {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .hours-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-hero h1 {
        font-size: 1.6rem;
    }
    
    .catalogue-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: center;
    }
    
    .result-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .result-image {
        width: 60px;
        height: 80px;
        font-size: 2rem;
    }
    
    .result-meta {
        justify-content: center;
    }
    
    .result-actions {
        justify-content: center;
    }
    
    .digital-grid {
        grid-template-columns: 1fr;
    }
    
    .digital-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .digital-actions {
        justify-content: center;
    }
    
    .services-grid,
    .research-grid {
        grid-template-columns: 1fr;
    }
    
    .staff-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .collections-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .facilities-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .contact-form-large .form-row {
        grid-template-columns: 1fr;
    }
    
    .digital-categories {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .category-card {
        padding: 0.75rem 0.5rem;
    }
    
    .category-card i {
        font-size: 1.4rem;
    }
    
    .category-card h3 {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .page-hero h1 {
        font-size: 1.3rem;
    }
    
    .staff-grid {
        grid-template-columns: 1fr;
    }
    
    .collections-grid {
        grid-template-columns: 1fr;
    }
    
    .facilities-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        gap: 1rem;
    }
    
    .result-item {
        padding: 1rem;
    }
    
    .digital-categories {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .pagination a {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}
/* =====================================================================
   Components added with the database-backed rebuild.
   Everything below was either missing from the original stylesheet
   (the whole My Library dashboard) or is new markup introduced by the
   server-rendered pages.
   ===================================================================== */

/* ---- Generic helpers ---------------------------------------------- */
.muted,
.text-muted {
    color: var(--text-light);
    font-size: 0.85rem;
}

.empty-state {
    background: var(--bg);
    border: 1px dashed #cfd8e3;
    border-radius: var(--radius);
    padding: 1.5rem;
    color: var(--text-light);
    text-align: center;
}

.inline-form {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
}

/* Honeypot field: present for bots, invisible and unfocusable for people. */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- Form feedback ------------------------------------------------- */
.form-alert {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.2rem;
    font-size: 0.92rem;
    line-height: 1.5;
}

.form-alert.success {
    background: #e6f6ec;
    color: #14532d;
    border-left: 4px solid #2f7a43;
}

.form-alert.error {
    background: #fdecea;
    color: #7f1d1d;
    border-left: 4px solid #e17055;
}

.form-alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ---- Tables -------------------------------------------------------- */
.record-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.record-table th,
.record-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eef1f5;
    vertical-align: top;
    font-size: 0.92rem;
}

.record-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.record-table tr:last-child th,
.record-table tr:last-child td {
    border-bottom: none;
}

/* ---- Record detail page -------------------------------------------- */
.record-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.record-main h2 {
    margin: 1.5rem 0 0.6rem;
    font-size: 1.15rem;
    color: var(--primary);
}

.record-side {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-list li {
    display: grid;
    grid-template-columns: 1.4rem 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #e3e8ef;
}

.related-list li:last-child {
    border-bottom: none;
}

.related-list li i {
    color: var(--primary-light);
    margin-top: 0.2rem;
}

.related-list span {
    grid-column: 2;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ---- About page ---------------------------------------------------- */
.facility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.facility-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.facility-card i {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 0.6rem;
}

/* ---- Digital library ------------------------------------------------ */
.digital-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0.35rem 0 0.6rem;
}

.category-card.active {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: var(--shadow);
}

/* ---- Footer additions ----------------------------------------------- */
.footer-motto {
    font-style: italic;
    color: var(--primary-soft);
    letter-spacing: 0.04em;
    margin-top: 0.4rem;
}

.footer-contact {
    margin-top: 0.9rem;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* =====================================================================
   MY LIBRARY DASHBOARD
   These classes were used by the original markup but never styled.
   ===================================================================== */
.my-library-login {
    max-width: 460px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.my-library-login h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.my-library-dashboard {
    display: grid;
    gap: 1.5rem;
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.dashboard-header h2 {
    color: var(--white);
    font-size: 1.3rem;
    margin: 0;
}

.dashboard-header p {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0.2rem 0 0;
}

.dashboard-header .btn-outline-small {
    border-color: rgba(255, 255, 255, 0.6);
    color: var(--white);
}

.dashboard-header .btn-outline-small:hover {
    background: var(--white);
    color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info .avatar {
    font-size: 2.6rem;
    line-height: 1;
    color: var(--primary-soft);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.dash-stat {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dash-number {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.dash-stat p {
    margin: 0.3rem 0 0;
    font-size: 0.82rem;
    color: var(--text-light);
}

.dashboard-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dashboard-section h3 {
    color: var(--primary);
    font-size: 1.05rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reserve-confirm {
    border-left: 4px solid var(--accent);
}

.loan-list,
.reservation-list,
.history-list,
.saved-list {
    display: grid;
    gap: 0.75rem;
}

.loan-item,
.reservation-item {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.loan-info h4,
.reservation-info h4 {
    font-size: 0.98rem;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.loan-info p,
.reservation-info p {
    font-size: 0.82rem;
    color: var(--text-light);
    margin: 0.1rem 0;
}

.loan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.loan-status,
.res-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 50px;
    white-space: nowrap;
}

.loan-status.ok,
.res-status.ready {
    background: #e6f6ec;
    color: #14532d;
}

.loan-status.due-soon,
.res-status.pending {
    background: #fff4dd;
    color: #7a4b00;
}

.loan-status.overdue {
    background: #fdecea;
    color: #7f1d1d;
}

.history-item,
.saved-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.saved-item i {
    color: var(--primary-light);
}

.saved-item span {
    flex: 1;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* =====================================================================
   Sections that carried a class but no rules in the original stylesheet
   ===================================================================== */
.hero-content {
    text-align: center;
}

.section.announcements,
.section.faq-preview {
    background: var(--bg);
}

.section.featured,
.section.events,
.section.contact {
    background: var(--white);
}

.search-results {
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .record-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* ===== CAMPUS LIBRARIES ===== */
.campus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.campus-card {
    background: var(--white);
    border-radius: var(--radius);
    border-top: 4px solid var(--primary-light);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.campus-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.campus-head i {
    font-size: 1.8rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.campus-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.campus-head .tag {
    margin-left: auto;
}

.campus-district {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
    color: var(--text-light);
}

.campus-facts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.campus-facts li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.35rem 0;
    font-size: 0.88rem;
    color: var(--text-light);
}

.campus-facts li i {
    color: var(--accent);
    margin-top: 0.2rem;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.campus-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ===== RESEARCH DATABASES ===== */
.section-lead {
    max-width: 70ch;
    color: var(--text-light);
    font-size: 0.92rem;
    margin-bottom: 1.25rem;
}

.section-more {
    margin-top: 1.25rem;
}

.database-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.database-card {
    display: block;
    background: var(--white);
    border: 1px solid #e8ecf1;
    border-radius: var(--radius);
    padding: 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.database-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.database-card h4 {
    margin: 0 0 0.3rem;
    font-size: 0.98rem;
    color: var(--primary-dark);
}

.database-meta {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Access type tells a student whether they can just click through. */
.tag.access-open {
    background: rgba(47, 122, 67, 0.12);
    color: var(--leaf);
}

.tag.access-institutional {
    background: rgba(48, 160, 208, 0.14);
    color: #1c6e90;
}

.tag.access-subscription {
    background: rgba(232, 168, 56, 0.16);
    color: #8a6114;
}

/* ===== POLICIES PAGE ===== */
.policy-group {
    margin-bottom: 2rem;
}

.policy-group h3 {
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--primary-soft);
}

.policy-detail {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.83rem;
    color: var(--text-light);
    opacity: 0.85;
}

.policy-jump {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.25rem;
}

.policy-jump h4 {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
}

.policy-jump ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.policy-jump li + li {
    margin-top: 0.4rem;
}

.policy-jump a {
    font-size: 0.86rem;
    color: var(--text-light);
    text-decoration: none;
}

.policy-jump a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* The online-catalogue quick-access card */
.card-opac:hover {
    border-color: var(--lake);
}

/* ===== HOME PAGE SLIDESHOW ===== */
/* The plain .hero gradient above stays as the fallback; these rules only
   apply once slides are configured. */
.hero-slideshow {
    position: relative;
    padding: 5rem 0 4rem;
    overflow: hidden;
    background: var(--primary-dark);
}

.hero-slides {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.hero-slide.is-active {
    opacity: 1;
}

.hero-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Darkened so white text keeps its contrast whatever the photo. */
.hero-slides::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(10, 44, 77, 0.78) 0%,
        rgba(0, 0, 0, 0.60) 100%);
    z-index: 2;
}

.hero-slideshow .hero-content {
    position: relative;
    z-index: 3;
}

/* Captions are stacked and cross-faded in step with the images. */
.hero-caption {
    display: none;
}

.hero-caption.is-active {
    display: block;
    animation: heroCaptionIn 0.7s ease both;
}

@keyframes heroCaptionIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.hero-eyebrow {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.28rem 1.1rem;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.hero-slideshow h1 {
    font-size: clamp(1.9rem, 5vw, 3.2rem);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    margin-bottom: 0.6rem;
}

.hero-slideshow .hero-sub {
    opacity: 0.95;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    margin: 0 0 1.5rem;
}

/* ---- Controls ---- */
.hero-dots {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 1.5rem;
}

.hero-dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.hero-dot.is-active,
.hero-dot:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
}

.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: var(--transition);
}

.hero-arrow:hover {
    background: var(--accent);
}

.hero-prev { left: 1rem; }
.hero-next { right: 1rem; }

@media (max-width: 768px) {
    .hero-arrow { display: none; }
    .hero-slideshow { padding: 3.5rem 0 3rem; }
}

/* Someone who has asked for less motion gets no cross-fade and no
   auto-advance (the script checks the same query). */
@media (prefers-reduced-motion: reduce) {
    .hero-slide { transition: none; }
    .hero-caption.is-active { animation: none; }
}

/* ===== ADMIN: SLIDES PANEL ===== */
.slide-admin-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.slide-admin-card {
    border: 1px solid #e8ecf1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}

.slide-admin-card.is-hidden {
    opacity: 0.55;
}

.slide-admin-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    background: var(--bg);
}

.slide-admin-body {
    padding: 0.8rem;
}

.slide-admin-body h4 {
    margin: 0 0 0.2rem;
    font-size: 0.92rem;
}

.slide-admin-body p {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    color: var(--text-light);
}

.slide-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.slide-admin-actions button {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
}

.slide-admin-actions button:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.slide-admin-actions .danger:hover {
    border-color: #d63031;
    color: #d63031;
}

/* =====================================================================
   HEADER, TOP STRIP AND DROPDOWN NAVIGATION
   Kibogora Polytechnic's own site leads with its pale blue (#7cbeeb) as
   the branding bar, so the Library does the same.  White text on that blue
   only reaches about 2:1, so the bar carries the deep navy instead, which
   reaches about 7:1 and stays legible.
   ===================================================================== */

/* ---- The strip of institutional systems, kept to the right ---- */
.topbar {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.8rem;
}

.topbar-inner {
    display: flex;
    justify-content: flex-end;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

/* Names the group for a screen reader and, on a wide screen, for everyone. */
.topbar-label {
    font-size: 0.72rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    opacity: 0.55;
    white-space: nowrap;
}

.topbar-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0 0.1rem;
    margin: 0;
    padding: 0.45rem 0;
    list-style: none;
}

/* Hairline separators so six links read as a list, not a run-on line. */
.topbar-menu li + li {
    border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.topbar-menu a {
    display: inline-block;
    padding: 0.15rem 0.85rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition);
}

.topbar-menu a:hover,
.topbar-menu a:focus-visible {
    color: var(--white);
    text-decoration: none;
}

.topbar-menu i {
    margin-right: 0.35rem;
    opacity: 0.7;
}

@media (max-width: 1100px) {
    .topbar-label { display: none; }
}

@media (max-width: 768px) {
    .topbar-inner { justify-content: center; }
    .topbar-menu {
        justify-content: center;
        font-size: 0.76rem;
    }
    /* Separators look wrong once the list wraps over several rows. */
    .topbar-menu li + li { border-left: 0; }
    .topbar-menu a { padding: 0.15rem 0.55rem; }
}

/* ---- Branding bar in Kibogora Polytechnic's blue ---- */
.header {
    background: var(--primary-soft);
    color: var(--primary);
}

/* The bar must stay on one line: the logo keeps its size, the menu takes
   what is left. Wrapping is what made the old menu look broken. */
.header-inner {
    flex-wrap: nowrap;
    gap: 1rem;
}

.logo {
    flex-shrink: 0;
}

.logo-img {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.logo-sub {
    opacity: 0.7;
}

.nav-toggle {
    color: var(--primary);
}

.nav-menu {
    flex-wrap: nowrap;
    gap: 0.15rem;
    justify-content: flex-end;
}

.nav-menu > li > a {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    background: rgba(255, 255, 255, 0.55);
    color: var(--primary);
}

.nav-menu > li > a.active {
    box-shadow: inset 0 -3px 0 var(--accent);
}

.nav-caret {
    font-size: 0.6rem;
    opacity: 0.65;
    transition: transform var(--transition);
}

.nav-menu > li.has-children:hover .nav-caret,
.nav-menu > li.has-children.open .nav-caret {
    transform: rotate(180deg);
}

/* The My Library button keeps its gold pill. */
.nav-menu > li > a.btn-login,
.nav-menu > li > a.btn-login:hover {
    background: var(--accent);
    color: var(--primary);
    box-shadow: none;
}

.nav-menu > li > a.btn-login:hover {
    background: var(--accent-hover);
}

/* ---- Dropdowns ---- */
.nav-menu > li {
    position: relative;
}

.nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 232px;
    margin: 0;
    padding: 0.4rem;
    list-style: none;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    z-index: 1200;
}

.nav-menu > li.has-children:hover > .nav-submenu,
.nav-menu > li.has-children:focus-within > .nav-submenu,
.nav-menu > li.has-children.open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* The last entries would otherwise run off the right edge. */
.nav-menu > li:nth-last-child(-n+2) > .nav-submenu {
    left: auto;
    right: 0;
}

.nav-submenu a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    background: var(--bg);
    color: var(--primary-light);
}

.nav-submenu a i:first-child {
    width: 1rem;
    text-align: center;
    color: var(--primary-light);
    opacity: 0.85;
}

.nav-ext {
    margin-left: auto;
    font-size: 0.62rem;
    opacity: 0.45;
}

/* ---- Below the desktop breakpoint the dropdowns become an accordion ---- */
@media (max-width: 992px) {
    .header-inner { flex-wrap: wrap; }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .nav-submenu {
        position: static;
        min-width: 0;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.5);
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        margin: 0.2rem 0 0.4rem 0.8rem;
    }

    .nav-menu > li.has-children.open > .nav-submenu {
        display: block;
    }
}

/* ---- The systems strip stays one horizontal row on the right ----
   It previously wrapped onto two or three rows once there were six links,
   which is what made it look disorganised. */
.topbar-inner {
    display: flex;
    justify-content: flex-end;
}

.topbar-nav {
    min-width: 0;
    max-width: 100%;
}

.topbar-menu {
    flex-wrap: nowrap;
    justify-content: flex-end;
    /* Narrow windows scroll this row sideways rather than stacking it. */
    overflow-x: auto;
    scrollbar-width: none;
}

.topbar-menu::-webkit-scrollbar {
    display: none;
}

.topbar-menu li {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    /* Still one row, still to the right, just tighter and scrollable. */
    .topbar-inner { justify-content: flex-end; }
    .topbar-menu {
        justify-content: flex-start;
        font-size: 0.74rem;
    }
    .topbar-menu li + li { border-left: 1px solid rgba(255, 255, 255, 0.22); }
    .topbar-menu a { padding: 0.15rem 0.6rem; }
}

/* ---- Quick access row: six cards, each wide enough for a single line ---- */
.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

.card h3 {
    white-space: nowrap;
}

/* The status strip belongs to the same navy family as the top strip. */
.status-bar {
    background: var(--primary);
}

/* =====================================================================
   DASHBOARD: CONTENT EDITING UI
   ===================================================================== */
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.panel-head h3 { margin: 0; }

.panel-note {
    font-size: 0.8rem;
    color: var(--text-light);
    max-width: 48ch;
}

.ghost-btn {
    display: inline-block;
    padding: 0.28rem 0.75rem;
    border: 1px solid #dfe6e9;
    border-radius: 7px;
    background: var(--white);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.ghost-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

/* ---- Featured list ---- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.feature-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    padding: 0.9rem 0.9rem 0.6rem;
    background: var(--white);
    border: 1px solid #e8ecf1;
    border-radius: 12px;
    transition: var(--transition);
}

.feature-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); }

/* Featured beyond what the home page shows: kept, but visibly waiting. */
.feature-card.is-queued {
    background: repeating-linear-gradient(
        -45deg, var(--white), var(--white) 9px, #fafbfc 9px, #fafbfc 18px);
}

.feature-rank {
    position: absolute;
    top: -9px;
    left: -9px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--primary-light);
    font-size: 1.1rem;
}

.feature-body h4 {
    margin: 0 0 0.15rem;
    font-size: 0.92rem;
    line-height: 1.3;
}

.feature-meta {
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    color: var(--text-light);
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tag-queued {
    background: rgba(214, 48, 49, 0.1);
    color: #a32a29;
}

.feature-actions,
.row-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f3f6;
}

.row-actions {
    grid-column: auto;
    margin: 0;
    padding: 0;
    border-top: 0;
}

.feature-actions form,
.row-actions form { display: inline; }

.feature-actions button,
.row-actions button {
    padding: 0.28rem 0.6rem;
    border: 1px solid #dfe6e9;
    border-radius: 7px;
    background: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.feature-actions button:hover,
.row-actions button:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.feature-actions button.danger:hover,
.row-actions button.danger:hover {
    border-color: #d63031;
    color: #d63031;
}

/* ---- Pick an existing title to feature ---- */
.inline-picker {
    padding: 0.9rem 1rem;
    background: var(--bg);
    border-radius: 10px;
}

.inline-picker label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.picker-row select {
    flex: 1 1 280px;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: var(--white);
    font-size: 0.85rem;
}

/* ---- The content form ---- */
.smart-form .field-group {
    margin: 0 0 1.1rem;
    padding: 1rem 1.1rem 1.1rem;
    border: 1px solid #e8ecf1;
    border-radius: 12px;
    background: var(--white);
}

.smart-form legend {
    padding: 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--primary-light);
}

.smart-form .field { margin-bottom: 0.85rem; }

.smart-form .field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
}

.smart-form .field-narrow { max-width: 180px; }

.smart-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.smart-form .req {
    margin-left: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #a32a29;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.smart-form input[type="text"],
.smart-form input[type="url"],
.smart-form input[type="number"],
.smart-form textarea,
.smart-form select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: var(--white);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.smart-form input:focus,
.smart-form textarea:focus,
.smart-form select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(10, 112, 227, 0.14);
}

.smart-form textarea { resize: vertical; }

/* ---- Type chips ---- */
.type-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.type-chip,
.smart-form .type-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 1.5px solid #dfe6e9;
    border-radius: 50px;
    background: var(--white);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0;
}

.type-chip input,
.segment input,
.switch input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.type-chip i { color: var(--primary-light); }

.type-chip:hover { border-color: var(--primary-soft); }

.type-chip:has(input:checked) {
    border-color: var(--primary-light);
    background: rgba(10, 112, 227, 0.08);
    color: var(--primary);
}

.type-chip:has(input:focus-visible) {
    box-shadow: 0 0 0 3px rgba(10, 112, 227, 0.2);
}

/* ---- Segmented control ---- */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--bg);
}

.segment,
.smart-form .segment {
    position: relative;
    display: inline-block;
    margin-bottom: 0;
    border-radius: 7px;
    cursor: pointer;
}


.segment span {
    display: block;
    padding: 0.4rem 0.8rem;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    transition: var(--transition);
}

.segment:has(input:checked) span {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.segment:has(input:focus-visible) span {
    box-shadow: 0 0 0 3px rgba(10, 112, 227, 0.22);
}

/* ---- Switches ---- */
.switches {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem;
}

.switch,
.smart-form .switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0;
    cursor: pointer;
}


.switch-track {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    border-radius: 50px;
    background: #cfd8dc;
    transition: background var(--transition);
    flex-shrink: 0;
}

.switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform var(--transition);
}

.switch input:checked + .switch-track { background: var(--primary-light); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 3px rgba(10, 112, 227, 0.25);
}

.switch-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

/* ---- Form footer ---- */
.form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    background: var(--bg);
    border-radius: 12px;
}

/* ---- Rich text as it appears on the public pages ---- */
.rich-text p { margin: 0 0 0.7rem; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul,
.rich-text ol { margin: 0 0 0.7rem 1.2rem; }
.rich-text li { margin-bottom: 0.25rem; }
.rich-text h3,
.rich-text h4,
.rich-text h5 { margin: 1rem 0 0.4rem; }
.rich-text blockquote {
    margin: 0 0 0.7rem;
    padding: 0.4rem 0 0.4rem 0.9rem;
    border-left: 3px solid var(--primary-soft);
    color: var(--text-light);
}
.rich-text code {
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    background: var(--bg);
    font-size: 0.9em;
}
.rich-text a { color: var(--primary-light); text-decoration: underline; }

@media (max-width: 640px) {
    .form-footer { flex-direction: column; align-items: stretch; }
    .form-footer .btn-primary { width: 100%; }
}

/* The way from the dashboard into the content manager. */
.admin-manage-btn {
    display: block;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.88rem;
    text-decoration: none;
}
