/* style.css */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

nav h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#searchInput {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    width: 300px;
    font-size: 0.9rem;
}

#searchBtn {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#searchBtn:hover {
    background-color: #2980b9;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Library Section */
.library-container {
    margin-bottom: 2rem;
}

.shelf {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.shelf h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Book List */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
}

/* Book Cards */
.book-card {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.book-cover {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.book-info h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-info p {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Progress Bar */
.progress-container {
    margin-top: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
    text-align: right;
}

/* Recommendations Section */
.recommendations {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.recommendations h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Recommended Books Grid */
#recommendedBooks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
}

/* Genre Filters */
.genre-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.genre-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.genre-btn:hover {
    background: #f5f5f5;
}

.genre-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
}

.close:hover {
    color: var(--accent-color);
}

#bookDetails h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#bookDetails p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Shelf Controls */
.shelf-controls {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#shelfSelect {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Reading Progress Controls */
.progress-container label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

#readingProgress {
    width: 100%;
    margin-bottom: 0.5rem;
}

#progressValue {
    color: #666;
    font-size: 0.9rem;
}

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--accent-color);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .search-container {
        width: 100%;
    }

    #searchInput {
        width: 100%;
    }

    .book-list, #recommendedBooks {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .book-cover {
        height: 200px;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .book-list, #recommendedBooks {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .book-cover {
        height: 180px;
    }

    .genre-filters {
        flex-direction: column;
    }

    .genre-btn {
        width: 100%;
        text-align: center;
    }
}