@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Desktop header layout */
.header-top {
    display: contents;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4a5568;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-toggle-btn {
    display: none;
}

.add-book-btn,
.user-icon {
    background: transparent;
    color: #5a67d8;
    border: none;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
}

.add-book-btn:hover,
.user-icon:hover {
    background: #667eea;
    color: white;
    border-radius: 8px;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
    position: relative;
}

.search-input-container {
    display: flex;
    background: white;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-input-container:focus-within {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
}

.search-input::placeholder {
    color: #a0aec0;
}

.search-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 1rem;
}

.search-btn:hover {
    background: #5a67d8;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    max-height: 400px;
    overflow: auto;
    z-index: 1000;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1px);
    transition: all 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.2) transparent;
}

.search-results::-webkit-scrollbar {
    width: 3px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 2px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-section {
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section h4 {
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 1rem 0.5rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-item:hover {
    background: #f7fafc;
}

.search-item-image {
    width: 40px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.search-author-icon,
.search-category-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    border-radius: 50%;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.search-author-icon {
    background: #e6fffa;
    color: #319795;
}

.search-category-icon {
    background: #fef5e7;
    color: #d69e2e;
}

.search-item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.search-item-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.search-item-author {
    color: #718096;
    font-size: 0.85rem;
}

nav {
    position: fixed;
    left: 15px;
    top: 100px;
    background: white;
    padding: 1.5rem 0;
    border-radius: 15px;
    width: 200px;
    font-size: 0.9rem;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.2) transparent;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Hidden state for desktop navigation */
nav.desktop-nav-hidden {
    display: none;
}

nav::-webkit-scrollbar {
    width: 3px;
}

nav::-webkit-scrollbar-track {
    background: transparent;
}

nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 2px;
}

nav::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

nav h3 {
    position: sticky;
    top: 0;
    background: white;
    color: #2d3748;
    margin: 0 1.5rem 1rem 1.5rem;
    font-size: 1.2rem;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    z-index: 1;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li {
    list-style: none;
    margin-bottom: 0.5rem;
}

nav a {
    display: block;
    color: #4a5568;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

nav a:hover {
    background: #667eea;
    color: white;
}

.nav-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
}

.nav-add-item-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.3s ease;
}

.nav-add-item-btn:hover {
    background: #5a67d8;
}

.mobile-nav-toggle {
    background: transparent;
    color: #5a67d8;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.mobile-nav-toggle:hover {
    background: #667eea;
    color: white;
    border-radius: 8px;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 150;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-nav {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 15px;
    padding: 2rem;
    max-width: 90%;
    width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 160;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.2) transparent;
}

.mobile-nav::-webkit-scrollbar {
    width: 3px;
}

.mobile-nav::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 2px;
}

.mobile-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

.mobile-nav.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.mobile-nav h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    margin-bottom: 0.5rem;
}

.mobile-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-nav a:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

.mobile-nav-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-nav-close:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.mobile-nav .nav-actions {
    padding: 1rem 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
}

.mobile-nav .nav-add-item-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.mobile-nav .nav-add-item-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.category-section {
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 320px;
    max-height: 620px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.2) transparent;
}

.category-section::-webkit-scrollbar {
    width: 3px;
}

.category-section::-webkit-scrollbar-track {
    background: transparent;
}

.category-section::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 2px;
}

.category-section::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

.grid-container {
    height: 100%;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

.grid-container::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.grid-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

.grid-container::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.category-title {
    position: sticky;
    top: 0;
    background: #f0f1fc;
    backdrop-filter: blur(10px);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2d3748;
    border-bottom: 3px solid #667eea;
    display: inline-block;
    padding-bottom: 0.5rem;
    z-index: 1;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.book-cover {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.book-info {
    padding: 1rem;
}

.book-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #2d3748;
    line-height: 1.2;
}

.book-author {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.book-rating {
    font-size: 0.9rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.2) transparent;
}

.modal-content::-webkit-scrollbar {
    width: 3px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 2px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    color: #2d3748;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.add-book-form,
.user-form {
    padding: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2d3748;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.request-summary-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    transition: background 0.3s ease;
}

.request-summary-btn:hover {
    background: #38a169;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.cancel-btn {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

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

.submit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: #5a67d8;
}

.book-details-content {
    padding: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.book-details-image {
    flex-shrink: 0;
}

.detail-book-cover {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.book-details-info {
    flex: 1;
}

.detail-book-title {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.detail-book-author {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: 1rem;
    font-style: italic;
}

.detail-book-category {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.detail-book-rating {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-book-summary h4 {
    color: #2d3748;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    text-transform: none;
}

.summary-text {
    line-height: 1.6;
    color: #4a5568;
    font-size: 1rem;
}

.popup {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 5000;
    background-color: rgb(0, 131, 0);
    width: 30%;
    color: white;
    min-height: 60px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    opacity: 0;
    padding: 0 30px;
    text-transform: capitalize;
    font-family: poppins;
}


/* responsive design */
@media (max-width: 768px) {
    .popup {
        width: 90%;
        right: 5%;
        padding: 0 20px;
    }

    .book-details-content {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.5rem;
        align-items: center;
        text-align: center;
    }

    .detail-book-cover {
        width: 160px;
        height: 220px;
    }

    .detail-book-title {
        font-size: 1.5rem;
    }

    .detail-book-author {
        font-size: 1rem;
    }

    .detail-book-rating {
        font-size: 1.2rem;
    }

    .header {
        min-height: auto;
    }

    .header-content {
        padding: 0.75rem;
        flex-direction: column;
        gap: 1rem;
    }

    .header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .add-book-btn,
    .user-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .add-book-btn {
        display: none;
    }

    .search-toggle-btn {
        background: transparent;
        color: #5a67d8;
        border: none;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1.3rem;
        flex-shrink: 0;
    }

    .search-toggle-btn:hover {
        background: #667eea;
        color: white;
        border-radius: 8px;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }

    .search-container {
        flex: none;
        margin: 0;
        max-width: none;
        width: 100%;
        display: none;
    }

    .search-container.active {
        display: block;
    }

    .search-input-container {
        width: 100%;
    }

    .search-input {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .search-btn {
        padding: 0.75rem 1.5rem;
    }

    nav {
        display: none;
    }

    .header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
    }

    .mobile-nav-toggle {
        order: 1;
    }

    .logo {
        order: 2;
        flex: 1;
        text-align: center;
    }

    .header-actions {
        order: 3;
        gap: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .category-section {
        padding: 1.5rem;
    }

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

    .book-cover {
        height: 200px;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .add-book-form,
    .user-form {
        padding: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .header-content {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .header-top {
        display: contents;
    }

    .mobile-nav-toggle {
        order: 1;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        flex-shrink: 0;
    }

    .logo {
        order: 2;
        flex-shrink: 0;
    }

    .search-container {
        order: 3;
        flex: 1;
        max-width: 500px;
        margin: 0 2rem;
    }

    .header-actions {
        order: 4;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.4rem;
    }

    .category-title {
        font-size: 1.5rem;
    }

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

    .book-cover {
        height: 160px;
    }

    .book-title {
        font-size: 0.9rem;
    }

    .book-author {
        font-size: 0.8rem;
    }

    .book-details-content {
        padding: 1rem;
    }

    .detail-book-cover {
        width: 140px;
        height: 190px;
    }

    .detail-book-title {
        font-size: 1.3rem;
    }
}