/* =========================================
   CSS Variables (Derived from Logo Palette)
   ========================================= */
   :root {
    --royal-purple: #2B0E44;
    --berry-magenta: #C21A5C;
    --elegant-gold: #B78F4B;
    --soft-amethyst: #9B659F;
    --crisp-white: #FFFFFF;
    --off-white: #FAF8FC; /* Soft background for sections */
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Poppins', sans-serif;
    
    --transition: all 0.3s ease-in-out;
}

/* =========================================
   Base & Resets (Mobile First)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--royal-purple);
    background-color: var(--crisp-white);
    line-height: 1.6;
    overflow-x: hidden;
}

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

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

h1, h2, h3 {
    font-family: var(--font-heading);
}

.section-heading {
    text-align: center;
    color: var(--royal-purple);
    font-size: 2.2rem;
    margin-bottom: 2rem;
    position: relative;
}

.section-heading.left-align {
    text-align: left;
}

/* Gold underline decorative element */
.section-heading::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--elegant-gold);
    margin: 10px auto 0;
}

.section-heading.left-align::after {
    margin: 10px 0 0 0;
}

/* =========================================
   Navigation Bar
   ========================================= */
.navbar {
    background-color: var(--crisp-white);
    box-shadow: 0 2px 10px rgba(43, 14, 68, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
}

.brand-logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
}

.brand-primary { color: var(--royal-purple); }
.brand-secondary { color: var(--berry-magenta); font-style: italic; }

.nav-links {
    display: none; /* Hidden on mobile by default */
    list-style: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--crisp-white);
    text-align: center;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.nav-links li {
    padding: 1rem 0;
}

.nav-links a {
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--berry-magenta);
}

/* Hamburger Menu Magic */
.nav-toggle { display: none; }
.nav-toggle-label {
    cursor: pointer;
    display: block;
}
.nav-toggle-label span, .nav-toggle-label span::before, .nav-toggle-label span::after {
    display: block;
    background: var(--royal-purple);
    height: 3px;
    width: 25px;
    position: relative;
    transition: var(--transition);
}
.nav-toggle-label span::before, .nav-toggle-label span::after {
    content: '';
    position: absolute;
}
.nav-toggle-label span::before { bottom: 8px; }
.nav-toggle-label span::after { top: 8px; }

/* Show menu when checkbox is checked */
.nav-toggle:checked ~ .nav-links { display: flex; }

/* =========================================
   Buttons (CTAs)
   ========================================= */
.cta-button {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.primary-cta {
    position: relative;
    overflow: hidden;
    background: transparent;
    color: var(--royal-purple);
    border: 1px solid var(--royal-purple);
    z-index: 1;
    transition: color 0.4s ease;
}

/* The invisible liquid background */
.primary-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%; /* Hidden to the left */
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--royal-purple), var(--berry-magenta));
    z-index: -1;
    transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* The sweep effect on hover */
.primary-cta:hover {
    color: white;
}
.primary-cta:hover::before {
    left: 0; /* Sweeps in from the left */
}

.secondary-cta {
    background-color: var(--berry-magenta);
    color: var(--crisp-white);
    margin-top: 1rem;
}

.secondary-cta:hover {
    background-color: var(--royal-purple);
}

.outline-cta {
    border: 2px solid var(--soft-amethyst);
    color: var(--royal-purple);
    margin-top: 1rem;
}

.outline-cta:hover {
    background-color: var(--soft-amethyst);
    color: var(--crisp-white);
}

/* =========================================
   Section 1: Hero & Slider
   ========================================= */
.hero-section {
    height: 100vh;
    margin-top: 60px; /* Offset for navbar */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden; /* Keeps the slides contained */
    /* Note: The static background url() was removed from here */
}

/* The container holding all 5 images */
.hero-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Sits at the very back */
}

/* Individual slides */
.hero-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0; /* Hidden by default */
    transition: opacity 1.5s ease-in-out, transform 4s ease-in-out; /* Smooth fade and subtle zoom */
    transform: scale(1.05); /* Starts slightly zoomed in */
}

/* The active slide */
.hero-slider .slide.active {
    opacity: 1;
    transform: scale(1); /* Zooms out smoothly while fading in */
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(43, 14, 68, 0.7), rgba(194, 26, 92, 0.5));
    z-index: 2; /* Sits over the images to make text readable */
}

.hero-content {
    position: relative;
    z-index: 10; /* Sits on top of everything */
    color: var(--crisp-white);
    padding: 2rem;
}

/* =========================================
   Section 2: Publications Marquee
   ========================================= */
.publications-section {
    padding: 4rem 0;
    background-color: var(--off-white);
    overflow: hidden;
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    padding: 1rem 0;
}

.marquee-track {
    display: flex;
    gap: 2rem;
    width: calc(250px * 6); /* Adjust based on card count */
    animation: scrollMarquee 20s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused; /* Interactive element: pauses on hover */
}

@keyframes scrollMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-250px * 4)); }
}

.pub-card {
    min-width: 200px;
    text-align: center;
}

.pub-cover {
    height: 280px;
    background-color: var(--soft-amethyst);
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.pub-card:hover .pub-cover {
    transform: translateY(-10px);
}

/* Placeholder gradients for book covers */
.mock-cover-1 { background: linear-gradient(135deg, var(--royal-purple), var(--soft-amethyst)); }
.mock-cover-2 { background: linear-gradient(135deg, var(--berry-magenta), var(--elegant-gold)); }
.mock-cover-3 { background: linear-gradient(135deg, var(--elegant-gold), var(--royal-purple)); }
.mock-cover-4 { background: linear-gradient(135deg, var(--soft-amethyst), var(--berry-magenta)); }

.pub-card h3 {
    font-size: 1.1rem;
    color: var(--royal-purple);
}

/* =========================================
   Section 3: About & Recent (Grid)
   ========================================= */
.about-recent-section {
    padding: 4rem 0;
}

.split-layout {
    display: flex;
    flex-direction: column; /* Mobile first: top-bottom stack */
    gap: 3rem;
}

.recent-card {
    display: flex;
    flex-direction: column;
    background: var(--off-white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.recent-cover {
    height: 250px;
    background: linear-gradient(45deg, var(--berry-magenta), var(--royal-purple));
}

.recent-details {
    padding: 1.5rem;
}

.pub-date {
    color: var(--soft-amethyst);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.pub-desc {
    margin-bottom: 1.5rem;
}

/* =========================================
   Footer Styles (Bulletproof 2-Column)
   ========================================= */
.site-footer {
    background-color: var(--royal-purple); 
    color: var(--crisp-white); 
    padding: 4rem 0 1rem 0;
}

.footer-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- 1. MOBILE FIRST (Stacked Top-to-Bottom) --- */
.footer-top {
    display: flex;
    flex-direction: column; /* Forces stacking on mobile */
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-author h3 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--crisp-white);
}

.footer-nav-groups {
    display: flex;
    flex-direction: column; /* Stacks the two link lists on mobile */
    gap: 2rem;
}

.footer-group h4, .footer-right h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--elegant-gold); 
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.footer-group ul a {
    color: #e0e0e0;
    transition: var(--transition);
    font-size: 0.95rem;
}

.footer-group ul a:hover {
    color: var(--berry-magenta); 
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--crisp-white);
    transition: var(--transition);
}

.social-icon:hover {
    background-color: var(--berry-magenta);
    transform: translateY(-3px);
}

/* Bottom Copyright */
.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: #aaa;
}

/* --- 2. DESKTOP ONLY (Side-by-Side) --- */
@media (min-width: 768px) {
    .footer-top {
        flex-direction: row; /* Forces Left and Right columns side-by-side */
        justify-content: space-between;
        align-items: flex-start;
    }

    .footer-left {
        flex: 2; /* Left side takes up 2/3 of the space */
    }

    .footer-nav-groups {
        flex-direction: row; /* Puts "Latest Pubs" and "Quick Links" side-by-side */
        gap: 5rem;
    }

    .footer-right {
        flex: 1; /* Right side takes up 1/3 of the space */
        display: flex;
        flex-direction: column;
        align-items: flex-end; /* Aligns the "Connect" text and icons to the right edge */
    }
}

/* =========================================
   Media Queries (Desktop/Tablet)
   ========================================= */
@media (min-width: 768px) {
    /* Navbar Desktop */
    .nav-toggle-label { display: none; }
    
    .nav-links {
        display: flex; /* <--- ADD THIS LINE! */
        position: static; 
        width: auto;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: row;
        padding: 0;
        max-height: none; 
        overflow: visible;
    }

    .nav-links li {
        margin: 0 0 0 2rem; /* Side-by-side spacing */
        display: inline-block;
    }

    .btn-login {
        background-color: var(--royal-purple);
        color: var(--crisp-white) !important;
        padding: 0.5rem 1.2rem;
        border-radius: 20px;
    }

    .btn-login:hover {
        background-color: var(--berry-magenta);
    }

    /* Hero */
    .hindi-poem {
        font-size: 2.2rem;
    }

    /* About/Recent Split Layout */
    .split-layout {
        flex-direction: row; /* Side by side on desktop */
        align-items: stretch;
    }

    .about-column, .recent-column {
        flex: 1;
    }

    .recent-card {
        flex-direction: row; /* Horizontal card on desktop */
    }

    .recent-cover {
        width: 200px;
        height: auto;
    }
}

@media (max-width: 767px) {
    /* Navbar Mobile (The Dropdown) */
    .nav-links {
        position: fixed; 
        top: 70px; 
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.95); 
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        flex-direction: column;
        align-items: center;
        
        max-height: 0;
        overflow: hidden;
        padding: 0; /* Reset padding when closed */
        transition: max-height 0.4s ease-in-out, padding 0.4s ease;
        z-index: 9999; 
    }

    #nav-toggle:checked ~ .nav-links {
        max-height: 650px; /* INCREASED: Gives the menu plenty of room for the extra Admin link */
        padding: 1.5rem 0; /* Slightly reduced the top/bottom padding of the whole menu */
        border-bottom: 1px solid rgba(155, 101, 159, 0.2);
    }

    .nav-links li {
        margin: 0.8rem 0; /* DECREASED: Tightens the gap between individual links */
        display: block; 
    }
}

/* =========================================
   About Page Specific Styles
   ========================================= */

/* Catchy Heading Section */
.about-hero {
    margin-top: 60px; /* Offset for navbar */
    padding: 5rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--royal-purple), var(--soft-amethyst));
    color: var(--crisp-white);
    position: relative;
    overflow: hidden;
}

.page-title {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
    opacity: 0.9;
}

/* Portrait and Details Section */
.author-details-section {
    padding: 4rem 5%;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
}

.author-portrait {
    position: relative;
    width: 100%;
    max-width: 350px;
    margin-top: 1rem; /* Space for the accent frame */
    margin-left: 1rem;
}

.portrait-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(43, 14, 68, 0.2);
    position: relative;
    z-index: 2;
    display: block; /* removes bottom gap */
}

/* Interactive gold frame behind the portrait */
.portrait-accent {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 100%;
    height: 100%;
    border: 3px solid var(--elegant-gold);
    border-radius: 12px;
    z-index: 1;
    transition: var(--transition);
}

.author-portrait:hover .portrait-accent {
    top: -20px;
    left: -20px;
}

.author-bio {
    width: 100%;
}

.author-bio p {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
    color: #444; /* Slightly softer than pure purple for long paragraphs */
    text-align: justify;
}

.bio-cta-container {
    margin-top: 2rem;
}

/* =========================================
   Reading Corner Specific Styles
   ========================================= */

/* Catchy Heading Section */
.reading-hero {
    margin-top: 60px;
    padding: 4rem 1rem;
    text-align: center;
    background-color: var(--off-white);
    border-bottom: 2px solid var(--elegant-gold);
}

.reading-hero .page-title {
    color: var(--royal-purple);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.reading-hero .page-subtitle {
    color: var(--berry-magenta);
    font-style: italic;
    font-size: 1.1rem;
}

/* Publications Grid Section */
.library-section {
    padding: 4rem 5%;
}

.publications-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first: 1 column */
    gap: 2.5rem;
}

.library-card {
    background: var(--crisp-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(43, 14, 68, 0.08);
    border: 1px solid rgba(155, 101, 159, 0.2);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    
    /* THE FIX: Stop the card from stretching infinitely */
    max-width: 340px; 
    width: 100%;
    justify-self: center; /* Centers the card neatly inside its grid column */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.library-card:hover {
    transform: translateY(-8px) scale(1.02); /* Lifts up and slightly magnifies */
    box-shadow: 0 15px 30px rgba(43, 14, 68, 0.15); /* Shadow gets deeper and softer */
}

.library-cover {
    height: 350px; /* Increased from 220px to perfectly fit standard book/magazine ratios */
    width: 100%;
}

.library-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes the button to the bottom if titles vary in height */
}

.library-title {
    font-size: 1.3rem;
    color: var(--royal-purple);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.library-date {
    font-size: 0.9rem;
    color: var(--soft-amethyst);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.library-type {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cta-button.full-width {
    width: 100%;
    margin-top: auto; /* Aligns button to the bottom of the card */
    box-sizing: border-box;
}

/* =========================================
   Authentication Pages (Login/Signup) Styles
   ========================================= */

/* Optional: Subtle background for the whole page to make the card pop */
.auth-body {
    background: linear-gradient(135deg, var(--off-white) 0%, rgba(155, 101, 159, 0.1) 100%);
    min-height: 100vh;
}

.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px); /* Viewport minus navbar height */
    padding: 6rem 1rem 3rem 1rem; /* Extra top padding to clear navbar */
}

.auth-card {
    background: var(--crisp-white);
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(43, 14, 68, 0.1);
    border: 1px solid rgba(155, 101, 159, 0.1);
    animation: fadeIn 0.5s ease-out;
}

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

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

.auth-title {
    color: var(--royal-purple);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--soft-amethyst);
    font-size: 0.9rem;
}

/* Google Button Styling */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0.8rem;
    background-color: var(--crisp-white);
    border: 1px solid #ddd;
    border-radius: 30px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    transition: var(--transition);
}

.google-btn:hover {
    background-color: var(--off-white);
    border-color: var(--soft-amethyst);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Divider with lines */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #999;
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #eee;
}

.auth-divider span {
    padding: 0 10px;
}

/* Form Inputs */
.input-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--royal-purple);
}

.input-group input {
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    background-color: #fcfcfc;
}

.input-group input:focus {
    outline: none;
    border-color: var(--berry-magenta);
    background-color: var(--crisp-white);
    box-shadow: 0 0 0 3px rgba(194, 26, 92, 0.1);
}

/* Options (Remember me / Forgot Password) */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    cursor: pointer;
}

.forgot-password {
    color: var(--elegant-gold);
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--berry-magenta);
    text-decoration: underline;
}

/* Switch to Signup */
.auth-switch {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.auth-switch a {
    color: var(--royal-purple);
    font-weight: 600;
    transition: var(--transition);
}

.auth-switch a:hover {
    color: var(--berry-magenta);
    text-decoration: underline;
}

/* =========================================
   Admin Dashboard Styles
   ========================================= */
.admin-body {
    background-color: var(--off-white);
}

.admin-hero {
    margin-top: 60px;
    padding: 3rem 1rem 2rem 1rem;
    text-align: center;
}

.admin-hero .page-title {
    color: var(--royal-purple);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.admin-hero .page-subtitle {
    color: #666;
    font-size: 1rem;
}

.admin-section {
    padding: 2rem 5% 5rem 5%;
}

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

.admin-card {
    background: var(--crisp-white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(43, 14, 68, 0.05);
    border: 1px solid rgba(155, 101, 159, 0.15);
}

.admin-heading {
    color: var(--royal-purple);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--off-white);
}

/* Form Additions */
.admin-form select,
.admin-form textarea {
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    background-color: #fcfcfc;
    width: 100%;
    resize: vertical; /* allows textarea to be resized up/down only */
}

.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--berry-magenta);
    background-color: var(--crisp-white);
    box-shadow: 0 0 0 3px rgba(194, 26, 92, 0.1);
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Custom File Drop Zone */
.file-upload-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.file-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    background-color: #fafafa;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.file-drop-zone:hover {
    border-color: var(--elegant-gold);
    background-color: rgba(183, 143, 75, 0.05);
}

.file-drop-zone .drop-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-drop-zone p {
    font-size: 0.9rem;
    color: #666;
}

.file-drop-zone span {
    color: var(--berry-magenta);
    font-weight: 500;
}

/* Make actual input invisible but clickable over the whole zone */
.file-input-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Manage List (Right Column) */
.manage-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--off-white);
    border-radius: 8px;
    border: 1px solid #eee;
    transition: var(--transition);
}

.manage-item:hover {
    background-color: var(--crisp-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-color: var(--soft-amethyst);
}

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

.manage-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot-ebook { background-color: var(--berry-magenta); }
.dot-mag { background-color: var(--elegant-gold); }

.manage-info h4 {
    color: var(--royal-purple);
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.manage-info p {
    font-size: 0.8rem;
    color: #888;
}

.manage-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
    transition: var(--transition);
}

.edit-btn { color: var(--soft-amethyst); }
.edit-btn:hover { color: var(--royal-purple); }

.delete-btn { color: #ccc; }
.delete-btn:hover { color: #ff4d4d; }

/* =========================================
   Media Queries (Desktop/Tablet) Updates
   ========================================= */
@media (min-width: 768px) {
    /* About Page Desktop Layout */
    .page-title {
        font-size: 3rem;
    }
    
    .author-details-section {
        flex-direction: row;
        align-items: flex-start;
        padding: 5rem 0;
        gap: 5rem; /* Larger gap on desktop */
    }

    .author-portrait {
        flex: 1;
    }

    .author-bio {
        flex: 1.5;
    }

    /* Reading Corner Desktop */
    .reading-hero .page-title {
        font-size: 3rem;
    }

    .publications-grid {
        /* Changing auto-fit to auto-fill stops the grid from forcefully expanding items */
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 3rem;
        justify-content: center; /* Keeps the cluster of books perfectly centered on the page */
    }

    /* Admin Desktop Layout */
    .admin-grid {
        flex-direction: row;
        align-items: flex-start;
    }

    .admin-card {
        flex: 2; /* Form takes up more space */
    }

    .summary-card {
        flex: 1; /* List takes up less space */
        position: sticky;
        top: 90px; /* Keeps the recent list in view when scrolling a long form */
    }

    .input-row {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .input-row .input-group {
        flex: 1;
    }

    .file-upload-container {
        flex-direction: row;
    }

    .file-upload-container .input-group {
        flex: 1;
    }
}

/* =========================================
   Reveal Animations
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(40px); /* Starts slightly lower */
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); /* Smooth snapping effect */
}

.reveal.active {
    opacity: 1;
    transform: translateY(0); /* Moves to original position */
}

/* Optional: Add slight delays so things don't appear all at once */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* Utility class to hide elements */
.hidden {
    display: none !important;
}

/* =========================================
   Toast Notifications
   ========================================= */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--crisp-white);
    border-left: 5px solid var(--berry-magenta);
    color: var(--royal-purple);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-weight: 500;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Bouncy slide in */
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-color: #34A853; } /* Green */
.toast.error { border-color: #EA4335; }   /* Red */

/* =========================================
   Progress Button Setup
   ========================================= */
.primary-cta.uploading {
    background: var(--royal-purple); /* Base color behind the progress */
    color: var(--crisp-white);
    border-color: transparent;
    cursor: not-allowed;
    transition: none; /* Disable standard hover transitions while uploading */
}

/* =========================================
   Custom Confirmation Modal
   ========================================= */
.confirm-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(43, 14, 68, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: var(--crisp-white);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.confirm-modal-overlay.active .confirm-modal {
    transform: translateY(0);
}

.confirm-modal h3 {
    color: var(--royal-purple);
    margin-bottom: 1rem;
}

.confirm-modal p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-cancel {
    background: #eee;
    color: #444;
}

.btn-cancel:hover { background: #ddd; }

.btn-confirm-delete {
    background: #EA4335;
    color: white;
}

.btn-confirm-delete:hover { background: #c53024; }

/* =========================================
   3D Book Viewer Modal Styles
   ========================================= */
.book-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(20, 5, 35, 0.95); /* Deep dark purple */
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.book-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.close-book-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: var(--crisp-white);
    font-size: 3rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10001;
}

.close-book-btn:hover {
    color: var(--berry-magenta);
    transform: scale(1.1);
}

.flipbook-container {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* StPageFlip specific overrides */
.stf__wrapper {
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border-radius: 4px;
}

.page {
    background-color: #fcfcfc; /* Solid white/off-white is CRUCIAL for the 3D backward flip */
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05); /* Adds a realistic paper shadow */
    border: 1px solid rgba(0,0,0,0.05); /* Subtle page edge */
}

.page canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Loading Spinner for the Book */
.book-loading-screen {
    position: absolute;
    text-align: center;
    color: var(--crisp-white);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top-color: var(--elegant-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.book-controls {
    margin-top: 20px;
    display: flex;
    align-items: center;
    z-index: 10001;
}

/* =========================================
   Lazy Loading Page States
   ========================================= */
.lazy-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #bbb;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 0;
}

/* Ensure the canvas sits on top of the loading text */
.page canvas {
    position: relative;
    z-index: 1;
}

/* Skeleton Shimmer Animation */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton-card {
    background: #eee;
    background-image: linear-gradient(90deg, #eee 0px, #f5f5f5 40px, #eee 80px);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
    border-radius: 12px;
    height: 350px;
    width: 100%;
    max-width: 340px;
}

/* Horizontal Skeleton for Admin List */
.skeleton-row {
    background: #eee;
    background-image: linear-gradient(90deg, #eee 0px, #f5f5f5 40px, #eee 80px);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
    border-radius: 8px;
    height: 70px;
    width: 100%;
    margin-bottom: 1rem;
}

/* Custom Browser Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #f4f0f5; /* Light theme background */
}
::-webkit-scrollbar-thumb {
    background: var(--soft-amethyst); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--royal-purple); 
}

/* Subtle Paper Grain Overlay */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; /* Lets clicks pass through to buttons */
    z-index: 9999; /* Sits on top of everything */
    opacity: 0.04; /* Keep it VERY subtle */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Create the ambient floating animation */
@keyframes breathe {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); } /* Gently floats up */
}

/* Apply it to the cards */
.library-card {
    animation: breathe 6s ease-in-out infinite;
}

/* Desync every second book so they don't move like robots */
.library-card:nth-child(even) {
    animation-delay: 3s; 
}

/* Pause the breathing if the user hovers over it so they can read/click easily */
.library-card:hover {
    animation-play-state: paused; 
}

/* =========================================
   Tactile Ripple Feedback
   ========================================= */
.ripple-parent {
    position: relative;
    overflow: hidden; /* Keeps the ripple inside the button/card */
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 0.6s linear forwards;
    background-color: rgba(194, 26, 92, 0.2); /* Soft Berry Magenta splash */
    pointer-events: none; /* Prevents the ripple from blocking clicks */
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* =========================================
   Smooth Page Transitions
   ========================================= */
.page-transition-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--crisp-white);
    z-index: 99999; /* Covers absolutely everything */
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.5s ease;
}

/* State when the page has finished loading (Slides up and fades) */
.page-transition-overlay.loaded {
    transform: translateY(-100%);
    opacity: 0;
}

/* State when clicking a link to leave the page (Drops back down) */
.page-transition-overlay.leaving {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}