/* Modern Digital Library Theme */
:root {
    --lib-primary: #1e3a8a; /* Academic Blue */
    --lib-secondary: #3b82f6; /* Bright accent blue */
    --lib-dark: #0f172a;
    --lib-light: #f1f5f9;
    --lib-text: #334155;
    --lib-header-font: 'Merriweather', serif; /* Scholarly feel */
    --lib-body-font: 'Inter', sans-serif;
    --lib-radius: 8px; /* Sharper, more professional corners */
    --lib-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    background-color: #f8fafc;
    font-family: var(--lib-body-font) !important;
    color: var(--lib-text);
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

input, textarea {
    -webkit-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--lib-header-font);
    color: var(--lib-dark);
}

/* --- Library Header --- */
.library-header {
    background: var(--lib-dark); /* Match footer dark blue */
    /* border-bottom: 2px solid var(--lib-primary); Removed as requested */
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); /* Stronger shadow for dark mode */
}

/* ... existing code ... */

/* --- Mobile & Responsive Tweaks --- */
@media (max-width: 768px) {
    /* Horizontal Scroll for Projects on Mobile */
    .row-cols-md-2 {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 1.5rem; /* More space for scrollbar */
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        margin-right: -15px; /* Offset bootstrap margin */
        margin-left: -5px; /* Slight left pull */
    }

    .row-cols-md-2::-webkit-scrollbar {
        height: 6px;
    }

    .row-cols-md-2::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }

    .row-cols-md-2 > .col {
        flex: 0 0 85%; /* SHow 85% of card to encourage scroll */
        max-width: 85%;
        scroll-snap-align: center;
    }

    .library-sidebar {
        margin-bottom: 2rem;
    }
    
    /* Order change class for mobile filtering */
    .mobile-filter-order {
        order: -1 !important;
    }
}

/* Ensure all links and text in header are white-ish */
.library-header, .library-header a, .navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,0.9);
}

.library-header a:hover, .navbar-dark .navbar-nav .nav-link:hover {
    color: white;
}
.library-nav-link {
    color: rgba(255, 255, 255, 0.8) !important; /* Light text for dark bg */
    font-weight: 600;
    padding: 0.5rem 1rem !important;
    position: relative;
    font-family: var(--lib-body-font);
}

.library-nav-link:hover {
    color: #fff !important;
}

.library-nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--lib-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.library-nav-link:hover::after {
    width: 80%;
}

.bar {
    background-color: #fff; /* White hamburger bars */
}

/* --- Hero Search Section --- */
.library-hero {
    /* Background image with a dark gradient overlay for text readability */
    background: linear-gradient(rgba(15, 23, 42, 0.7), rgba(243, 187, 123, 0)), url('/static/assets/img/lib.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 6rem 0; /* Slightly increased padding */
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* --- Off-Canvas Mobile Navigation --- */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden by default */
        width: 85%; /* Drawer width */
        height: 100vh;
        background: var(--lib-dark); /* Dark Match */
        z-index: 1050;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 5rem 2rem 2rem;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        display: block !important; /* Force block to allow transition */
        visibility: hidden;
    }

    .navbar-collapse.show {
        right: 0;
        visibility: visible;
    }
    
    .navbar-collapse h5 {
        color: white !important; /* Menu title white */
    }
    
    .close-nav {
        color: white !important;
    }

    /* --- Stylish Thick Hamburger (Slant) --- */
    .custom-toggler {
        border: none !important;
        background: transparent !important;
        padding: 10px;
        cursor: pointer;
        z-index: 1100;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
    }

    .custom-toggler:focus {
        outline: none;
    }

    .bar {
        display: block;
        width: 35px;
        height: 4px; /* Thick */
        background-color: white !important; /* Force White */
        margin: 5px 0;
        border-radius: 4px;
        transition: all 0.4s ease;
        transform: skewX(-15deg); /* The "Slant" Style */
        box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    }
    
    /* Uneven bars for extra style */
    .bar2 {
        width: 25px; /* Middle bar shorter */
    }

    /* Rotate to X when open */
    .custom-toggler.change .bar {
        transform: skewX(0) !important; /* Reset slant for X */
    }
    .custom-toggler.change .bar1 {
        transform: rotate(45deg) translate(5px, 5px);
        width: 35px;
    }
    .custom-toggler.change .bar2 { opacity: 0; }
    .custom-toggler.change .bar3 {
        transform: rotate(-45deg) translate(7px, -6px);
        width: 35px;
    }
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.4; /* Visible but not blocking text */
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-120vh) rotate(720deg);
        opacity: 0;
    }
}

.hero-search-box {
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    max-width: 700px;
    margin: 0 auto;
}

.hero-search-input {
    border: none;
    flex-grow: 1;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    outline: none;
    border-radius: 50px 0 0 50px;
}

.hero-search-btn {
    background: var(--lib-primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
}

.hero-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30, 58, 138, 0.3);
}

/* --- Back to Top Button --- */
.u-go-to-modern {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    width: 50px;
    height: 50px;
    background: var(--lib-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.u-go-to-modern.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.u-go-to-modern:hover {
    background: #1e40af; /* Darker blue */
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(30, 58, 138, 0.4);
}

/* --- Floating Background Shapes --- */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1; /* Behind everything */
    pointer-events: none;
}

.shape {
    position: absolute;
    color: var(--lib-secondary); /* Bright Blue */
    font-size: 2rem;
    animation: float 25s infinite linear;
    bottom: -100px; /* Start below screen */
    opacity: 0;
}

/* Specific Shapes */
.shape-1 { left: 5%; animation-duration: 25s; animation-delay: 0s; font-size: 3rem; }
.shape-2 { left: 15%; animation-duration: 35s; animation-delay: 2s; font-size: 1.5rem; }
.shape-3 { left: 25%; animation-duration: 30s; animation-delay: 5s; font-size: 4rem; }
.shape-4 { left: 35%; animation-duration: 28s; animation-delay: 1s; font-size: 2.5rem; }
.shape-5 { left: 45%; animation-duration: 32s; animation-delay: 7s; font-size: 3.5rem; }
.shape-6 { left: 55%; animation-duration: 22s; animation-delay: 3s; font-size: 2rem; }
.shape-7 { left: 65%; animation-duration: 29s; animation-delay: 6s; font-size: 2.8rem; }
.shape-8 { left: 75%; animation-duration: 33s; animation-delay: 4s; font-size: 1.8rem; }
.shape-9 { left: 85%; animation-duration: 26s; animation-delay: 0s; font-size: 3.2rem; }
.shape-10 { left: 95%; animation-duration: 31s; animation-delay: 2s; font-size: 2.2rem; }
/* --- Sidebar Layout --- */
.library-sidebar {
    background: white;
    border-radius: var(--lib-radius);
    padding: 1.5rem;
    box-shadow: var(--lib-shadow);
    border: 1px solid #e2e8f0;
}

.sidebar-title {
    font-size: 1.1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--lib-primary);
}

.sidebar-link {
    display: block;
    padding: 0.5rem 0;
    color: var(--lib-text);
    transition: color 0.2s;
    text-decoration: none;
}

.sidebar-link:hover, .sidebar-link.active {
    color: var(--lib-primary);
    font-weight: 600;
    padding-left: 5px; /* Indent */
    text-decoration: none;
}

/* --- List View Item --- */
.lib-item-card {
    background: #f8fafc; /* Slightly darker than white */
    border-radius: var(--lib-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Stronger shadow */
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.lib-item-card:hover {
    transform: translateY(-5px); /* Slightly more lift */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-left-color: var(--lib-secondary);
}

.lib-item-meta {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.lib-item-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.lib-item-title a {
    color: var(--lib-dark);
    text-decoration: none;
}

.lib-item-title a:hover {
    color: var(--lib-primary);
}

.lib-badge {
    background: #eff6ff;
    color: var(--lib-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

/* --- Stats Counters --- */
.stat-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--lib-radius);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--lib-primary);
    font-family: var(--lib-body-font);
}

/* --- Footer --- */
.library-footer {
    background: var(--lib-dark);
    color: #94a3b8;
    padding: 3rem 0;
    margin-top: 0; /* Closed gap as requested */
}

.footer-heading {
    color: white;
    font-family: var(--lib-header-font);
    margin-bottom: 1.5rem;
}
