:root {
    --primary-green: #27ae60;
    --light-green: #ebf9f1;
    --accent-green: #2ecc71;
    --text-dark: #2c3e50;
    --white: #ffffff;
    --gray-bg: #f4f4f4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
}

/* Top Bar Container */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 5%;
    background: var(--white);
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-green);
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* Search Bar Styles */
.search-container {
    flex-grow: 1;
    margin: 0 20px;
    max-width: 450px;
}

.search-container input {
    width: 100%;
    padding: 10px 20px;
    border-radius: 25px;
    border: 1px solid #ddd;
    background: var(--gray-bg);
    outline: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.search-container input:focus {
    background: var(--white);
    border-color: var(--primary-green);
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.2);
}

/* Navigation Links */
.nav-links {
    display: flex;
    list-style: none;
    gap: 25px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-green);
}

.mobile-btn {
    background: var(--primary-green);
    color: white !important;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
}

/* Hamburger Menu Icon */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 5px;
    transition: 0.3s;
}

/* Genre Pills Wrapper */
.genre-wrapper {
    padding: 15px 5%;
    background: var(--light-green);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}

/* Hide scrollbar but keep functionality */
.genre-wrapper::-webkit-scrollbar {
    display: none;
}

.genre-pills {
    display: flex;
    gap: 12px;
}

.pill {
    padding: 8px 22px;
    background: var(--white);
    border: 1px solid var(--primary-green);
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-green);
}

.pill:hover, .pill.active {
    background: var(--primary-green);
    color: white;
}

/* Stories/Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    padding: 30px 5%;
}

.book-card {
    transition: transform 0.3s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
}

/* --- MOBILE RESPONSIVENESS --- */

@media (max-width: 900px) {
    .nav-links {
        display: none; /* Controlled by JS '.active' class */
        flex-direction: column;
        position: absolute;
        top: 70px;
        right: 5%;
        width: 220px;
        background: white;
        padding: 20px;
        border-radius: 15px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        border: 1px solid #eee;
    }

    .nav-links.active {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .search-container {
        max-width: none;
        margin: 0 10px;
    }
}

@media (max-width: 500px) {
    .logo {
        font-size: 1.3rem;
    }
    
    /* On very small screens, make search bar smaller to fit */
    .search-container input {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}