/* Page de détail du livre */
.book-header {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
    align-items: flex-start;
    animation: fadeIn 0.6s ease-out;
}

.book-cover-large {
    width: 280px;
    height: 400px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.book-info {
    flex: 1;
}

.book-info h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    line-height: 1.2;
    position: relative;
    display: inline-block;
}

.book-info h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: 3px;
}

.book-meta {
    background: rgba(233, 236, 239, 0.4);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1.5rem;
}

.book-meta p {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
    color: var(--dark-color);
}

/* Style spécifique pour le lien auteur */
.book-meta a[href^="/author/"] {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    margin-left: 0.3rem;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

/* Effet de fond animé */
.book-meta a[href^="/author/"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                transparent, 
                rgba(255, 255, 255, 0.3), 
                transparent);
    transition: 0.5s ease;
}

/* Icône stylo */
.book-meta a[href^="/author/"]::after {
    content: '✍️';
    margin-left: 0.4rem;
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

/* Effets au survol */
.book-meta a[href^="/author/"]:hover {
    background: rgba(67, 97, 238, 0.2);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(67, 97, 238, 0.2);
    border-color: rgba(67, 97, 238, 0.3);
}

.book-meta a[href^="/author/"]:hover::before {
    left: 100%;
}

.book-meta a[href^="/author/"]:hover::after {
    transform: rotate(-10deg) scale(1.1);
}

/* Style du label (optionnel) */
.book-meta .meta-label {
    font-weight: 600;
    color: var(--dark-color);
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .book-meta a[href^="/author/"] {
        padding: 0.25rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Description du livre */
.book-description {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.book-description h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.6rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.book-description h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--accent-color);
}

.book-description p {
    line-height: 1.7;
    color: var(--dark-color);
    font-size: 1.05rem;
}

/* Section des avis */
.reviews-section {
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.reviews-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.6rem;
    position: relative;
}

.reviews-section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: 3px;
}

.no-reviews {
    text-align: center;
    padding: 2rem;
    background: rgba(233, 236, 239, 0.4);
    border-radius: var(--border-radius);
    color: var(--dark-color);
    font-style: italic;
}

.reviews-list {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.review-card {
    background: white;
    padding: 1.75rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent-color);
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.review-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.03), rgba(67, 97, 238, 0.02));
    z-index: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.review-card:hover::before {
    opacity: 1;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.reviewer {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1.05rem;
    position: relative;
    padding-left: 1.75rem;
}

.reviewer::before {
    content: '👤';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.8;
}

.rating-stars {
    display: flex;
    gap: 0.15rem;
}

.rating-stars::before {
    content: '★★★★★';
    color: #e4e4e4;
    font-size: 1.1rem;
    letter-spacing: 2px;
    position: relative;
}

.rating-stars::after {
    content: '★★★★★';
    color: #ffc107;
    font-size: 1.1rem;
    letter-spacing: 2px;
    position: absolute;
    left: 0;
    top: 0;
    width: calc(var(--rating) * 20%);
    overflow: hidden;
}

.review-comment {
    line-height: 1.7;
    color: #444;
    position: relative;
    z-index: 1;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.review-card:hover {
    background: rgba(248, 249, 250, 0.9);
    border-left-color: var(--accent-color);
}

/* Animation d'apparition séquentielle */
.review-card:nth-child(1) { animation-delay: 0.1s; }
.review-card:nth-child(2) { animation-delay: 0.2s; }
.review-card:nth-child(3) { animation-delay: 0.3s; }
.review-card:nth-child(4) { animation-delay: 0.4s; }
.review-card:nth-child(5) { animation-delay: 0.5s; }
.review-card:nth-child(n+6) { animation-delay: 0.6s; }

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

/* Affichage dynamique des étoiles */
.rating-stars {
    --rating: 0;
    position: relative;
    display: inline-block;
    width: 5.5rem; /* 5 étoiles * 1.1rem + espacement */
}

/* Ajustement pour chaque note */
.rating-stars[data-rating="1"] { --rating: 1; }
.rating-stars[data-rating="2"] { --rating: 2; }
.rating-stars[data-rating="3"] { --rating: 3; }
.rating-stars[data-rating="4"] { --rating: 4; }
.rating-stars[data-rating="5"] { --rating: 5; }

/* Responsive */
@media (max-width: 768px) {
    .review-card {
        padding: 1.5rem;
    }
    
    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .reviewer {
        padding-left: 1.5rem;
    }
}

@media (max-width: 576px) {
    .review-card {
        padding: 1.25rem;
    }
    
    .review-comment {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}

/* Formulaire d'avis */
.add-review {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-top: 2rem;
}

.add-review h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 1.8rem;
    color: #ddd;
    cursor: pointer;
    transition: var(--transition-fast);
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #ffc107;
}

.star-rating input:checked + label {
    color: #ffc107;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    transition: var(--transition-normal);
}

textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
}

.submit-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 3px 10px rgba(67, 97, 238, 0.3);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
}

.login-prompt {
    text-align: center;
    margin-top: 2rem;
}

.login-prompt a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.login-prompt a:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--accent-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 992px) {
    .book-header {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }
    
    .book-cover-large {
        width: 220px;
        height: 330px;
    }
    
    .book-info {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .book-info h1 {
        font-size: 1.8rem;
    }
    
    .book-meta {
        padding: 1.25rem;
    }
    
    .book-description,
    .add-review {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .book-header {
        gap: 1.5rem;
    }
    
    .book-cover-large {
        width: 180px;
        height: 270px;
    }
    
    .book-info h1 {
        font-size: 1.6rem;
    }
    
    .meta-label {
        display: block;
        min-width: auto;
        margin-bottom: 0.2rem;
    }
    
    .star-rating label {
        font-size: 1.5rem;
    }
}

.delete-review {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    margin-top: 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background-color: var(--danger-color);
    border: none;
    border-radius: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(249, 65, 68, 0.2);
    position: relative;
    overflow: hidden;
}

.delete-review::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                transparent, 
                rgba(255, 255, 255, 0.2), 
                transparent);
    transition: all 0.5s ease;
}

.delete-review:hover {
    background-color: #f82b2e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 65, 68, 0.3);
}

.delete-review:hover::before {
    left: 100%;
}

.delete-review:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(249, 65, 68, 0.3);
}

.review-card .delete-review {
    margin-left: auto;
    display: block;
    width: fit-content;
    opacity: 0.9;
}

.review-card:hover .delete-review {
    opacity: 1;
}

.delete-review::after {
    content: '🗑️';
    margin-left: 0.3rem;
    font-size: 0.9em;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.delete-review:hover::after {
    transform: scale(1.1) rotate(5deg);
}

@media (max-width: 768px) {
    .delete-review {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }
}

/* Bouton "Ajouter à ma bibliothèque" */
.add-to-list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    position: relative;
    overflow: hidden;
}

.add-to-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                transparent, 
                rgba(255, 255, 255, 0.2), 
                transparent);
    transition: 0.5s ease;
}

.add-to-list:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.add-to-list:hover::before {
    left: 100%;
}

.add-to-list:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(67, 97, 238, 0.3);
}

.add-to-list::after {
    content: '➕';
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.add-to-list:hover::after {
    transform: rotate(90deg) scale(1.1);
}

/* Message "Déjà dans la bibliothèque" */
.already-in-list {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.8rem;
    background-color: rgba(75, 181, 67, 0.1);
    color: var(--success-color);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(75, 181, 67, 0.3);
    animation: fadeIn 0.5s ease-out;
}

.already-in-list::before {
    content: '📚';
    font-size: 1.1em;
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Animation d'apparition */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .add-to-list,
    .already-in-list {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .add-to-list,
    .already-in-list {
        width: 100%;
        justify-content: center;
    }
}