/* Google Books Integration Styles */

/* Navigation Enhancement */
.featured-link {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(40, 167, 69, 0.5); }
    to { box-shadow: 0 0 20px rgba(40, 167, 69, 0.8), 0 0 30px rgba(40, 167, 69, 0.6); }
}

/* Book Cards */
.google-book-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.google-book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-heavy);
}

.book-cover {
    position: relative;
    height: 280px;
    overflow: hidden;
    background: var(--background-light);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.google-book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.google-book-card:hover .book-overlay {
    opacity: 1;
}

.book-info {
    padding: 20px;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.book-author {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 12px;
    font-style: italic;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.pages {
    color: var(--text-light);
    font-size: 0.8rem;
}

.book-description {
    color: var(--text-medium);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.book-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.book-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px 12px;
}

/* Star Rating */
.rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.star {
    color: #ffd700;
    font-size: 14px;
}

.star.empty {
    color: #ddd;
}

.star.half {
    background: linear-gradient(90deg, #ffd700 50%, #ddd 50%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.rating-value {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: 5px;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

/* Google Books Results Section */
#google-books-results {
    margin-top: 30px;
    padding: 25px;
    background: var(--background-light);
    border-radius: var(--border-radius);
    display: none;
}

#google-books-results h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#google-books-results h3:before {
    content: "📚";
    font-size: 1.2em;
}

/* Book Modal */
.book-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.book-modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.book-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid var(--accent-color);
    background: var(--background-light);
}

.modal-header h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

.modal-body {
    padding: 25px;
}

.book-details {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.book-cover-large img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
}

.book-meta-detailed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.book-meta-detailed p {
    margin: 0;
    color: var(--text-medium);
    line-height: 1.5;
}

.book-meta-detailed strong {
    color: var(--text-dark);
    font-weight: 600;
    min-width: 80px;
    display: inline-block;
}

.book-description-full h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.book-description-full p {
    color: var(--text-medium);
    line-height: 1.7;
    margin-bottom: 25px;
}

.book-actions-modal {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--accent-color);
}

/* Button Variations for Google Books */
.btn.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
}

.btn.btn-success:hover {
    background: linear-gradient(135deg, #218838, #1da88a);
    transform: translateY(-1px);
}

.read-online-btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* Icons */
.icon-book-reader:before { content: "📖"; }
.icon-download:before { content: "⬇️"; }
.icon-preview:before { content: "👁️"; }
.icon-external:before { content: "🔗"; }
.icon-info:before { content: "ℹ️"; }
.icon-eye:before { content: "👁️"; }
.icon-book-open:before { content: "📚"; }

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 300px;
}

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

.notification.info {
    border-left: 4px solid var(--primary-color);
}

.notification.warning {
    border-left: 4px solid #ffc107;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification.success {
    border-left: 4px solid #28a745;
}

/* Online Reading Section */
.online-reading-section {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 40px 25px;
    border-radius: var(--border-radius);
    margin: 30px 0;
    text-align: center;
}

.online-reading-section h2 {
    color: var(--white);
    margin-bottom: 15px;
    font-size: 2rem;
}

.online-reading-section p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    opacity: 0.9;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
    text-align: left;
}

.feature-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.feature-item h4 {
    color: var(--white);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-item p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .book-details {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .book-actions-modal {
        flex-direction: column;
    }
    
    .book-actions {
        flex-direction: column;
    }
    
    .feature-list {
        grid-template-columns: 1fr;
    }
    
    .online-reading-section h2 {
        font-size: 1.5rem;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .book-cover {
        height: 200px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .book-actions-modal {
        gap: 10px;
    }
}

/* Enhanced Search Results Styles */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.search-result-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.search-result-item:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.search-result-item.google-book {
    border-left: 4px solid var(--accent);
}

.search-result-item.local-book {
    border-left: 4px solid var(--secondary);
}

.book-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.book-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--background-light);
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    margin: 0;
    line-height: 1.3;
}

.result-title:hover {
    color: var(--accent);
}

.result-author {
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

.result-category {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.result-description {
    color: var(--text-medium);
    line-height: 1.5;
    margin: 0;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag {
    background: var(--background-light);
    color: var(--text-medium);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.book-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.book-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: flex-start;
    min-width: 120px;
}

.search-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* Search Loading Styles */
.search-loading {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--background-light);
    border-left: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Search Error Styles */
.search-error {
    text-align: center;
    padding: 40px 20px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Highlight styles */
mark {
    background: var(--accent-light);
    color: var(--text-dark);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Responsive Search Results */
@media (max-width: 768px) {
    .search-result-item {
        flex-direction: column;
        gap: 15px;
    }
    
    .book-thumbnail {
        width: 60px;
        height: 90px;
        align-self: flex-start;
    }
    
    .result-actions {
        flex-direction: row;
        min-width: auto;
    }
    
    .result-actions .btn {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .search-result-item {
        padding: 15px;
        gap: 12px;
    }
    
    .result-title {
        font-size: 1.1rem;
    }
    
    .error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .error-actions .btn {
        min-width: 200px;
    }
}