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

body {
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header et Footer fixes */
header, footer {
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    z-index: 1000;
}

header {
    top: 0;
}

footer {
    bottom: 0;
    margin-top: auto;
    flex-wrap: wrap;
}

header h1, footer h1 {
    font-size: 24px;
    color: #333;
    flex-shrink: 0;
}

header nav ul, footer nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

header li, footer li {
    margin: 0;
}

header a, footer a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

header a:hover, footer a:hover {
    color: #fff;
}

/* Main content */
main {
    flex: 1;
    margin-top: 60px;
    margin-bottom: 120px;
    padding: 20px;
}

/* Section Hero */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(image/hero.png);
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 30px;
}

.text_hero {
    color: #fff;
    animation: slideInDown 0.8s ease-out;
}

.text_hero h2 {
    font-size: 38px;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.text_hero p {
    font-size: 18px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.button button {
    padding: 14px 36px;
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.button button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section recherche */
.search {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.search form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.search input, .search select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    flex: 1;
    min-width: 150px;
    background: #f9f9f9;
    transition: all 0.3s ease;
}

.search input:focus, .search select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
    background: #fff;
}

.search button {
    padding: 12px 28px;
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

/* Carrousel */
.carousel-section {
    margin-bottom: 40px;
}

.carousel-section h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-item {
    min-width: 100%;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px;
    text-align: center;
}

.carousel-caption h3 {
    font-size: 20px;
    margin-bottom: 5px;
}

.carousel-caption p {
    font-size: 14px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 10;
    font-weight: bold;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

/* Grille de livres */
.catalogue, .list-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out;
}

.catalogue h2, .list-section h2 {
    font-size: 28px;
    margin-bottom: 25px;
    color: #333;
    font-weight: 700;
    border-bottom: 3px solid #f59e0b;
    display: inline-block;
    padding-bottom: 8px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.book-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

.book-image {
    position: relative;
    overflow: hidden;
    height: 250px;
}

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

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

/* Coeur pour les favoris */
.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #e74c3c;
}

.book-info {
    padding: 15px;
}

.book-info h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
    min-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-info .categorie {
    font-size: 12px;
    color: #f59e0b;
    font-weight: bold;
    margin-bottom: 10px;
}

.book-info .auteur {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

/* Boutons */
.btn-details, .btn-edit, .btn-delete, .btn-back {
    display: inline-block;
    padding: 12px 20px;
    margin: 6px 4px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-details {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

.btn-details:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(52, 152, 219, 0.3);
}

.btn-edit {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #fff;
}

.btn-edit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(39, 174, 96, 0.3);
}

.btn-delete {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

.btn-delete:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(231, 76, 60, 0.3);
}

.btn-back {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: #fff;
}

.btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Page de détail */
.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-content h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

.detail-content p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #555;
}

.detail-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.description {
    margin-top: 20px;
}

.description h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.detail-actions .btn-back,
.detail-actions .btn-edit,
.detail-actions .btn-delete {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

#favBtn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 15px 0;
}

#favBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#favBtn.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Section historique et favoris */
.history-favorites-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
}

.history-section, .favorites-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-section h2, .favorites-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.history-list, .favorites-list {
    list-style: none;
}

.history-list li, .favorites-list li {
    padding: 10px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-left: 4px solid #f59e0b;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-list li:hover, .favorites-list li:hover {
    background: #f0f0f0;
    padding-left: 15px;
}

.history-list a, .favorites-list a {
    text-decoration: none;
    color: #333;
    display: block;
}

.no-results {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 16px;
}

/* Section ajout/modification */
.ajout {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.ajout form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ajout div {
    display: flex;
    flex-direction: column;
}

.ajout label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.ajout input, .ajout textarea, .ajout select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #f9f9f9;
    transition: all 0.3s ease;
}

.ajout input:focus, .ajout textarea:focus, .ajout select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    background: #fff;
}

.ajout button {
    padding: 14px;
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ajout button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Section footer */
.sect2 {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 15px;
}

.sect2 p {
    margin: 0;
}

.sect2 a {
    color: #333;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.sect2 a:hover {
    color: #fff;
    transform: scale(1.2);
}

/* Table des livres */
.books-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.books-table thead {
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    color: #fff;
}

.books-table th {
    padding: 15px;
    text-align: left;
    font-weight: bold;
}

.books-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.books-table tbody tr:hover {
    background: #f9f9f9;
}

.table-image {
    width: 80px;
    text-align: center;
}

.table-image img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.category-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #f59e0b;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.description-cell {
    font-size: 13px;
    color: #666;
    max-width: 200px;
}

.actions-cell {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.favorite-btn-small {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.favorite-btn-small:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.favorite-btn-small.active {
    color: #e74c3c;
}

/* Responsivité */
@media (max-width: 1024px) {
    .detail-container {
        grid-template-columns: 1fr;
    }

    .history-favorites-container {
        grid-template-columns: 1fr;
    }

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

    .search form {
        flex-direction: column;
    }

    .search input, .search select {
        width: 100%;
    }

    header, footer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    header nav ul, footer nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    main {
        margin-bottom: 140px;
    }

    .hero {
        height: 300px;
    }

    .text_hero h2 {
        font-size: 24px;
    }

    .text_hero p {
        font-size: 14px;
    }

    .carousel-item img {
        height: 250px;
    }

    .book-image {
        height: 180px;
    }

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

    .book-info h3 {
        font-size: 14px;
        min-height: 30px;
    }

    .btn-details, .btn-edit, .btn-delete {
        padding: 6px 10px;
        font-size: 11px;
    }

    .detail-content h1 {
        font-size: 22px;
    }

    .detail-content p {
        font-size: 13px;
    }

    /* Table responsif */
    .books-table {
        font-size: 12px;
    }

    .books-table th, .books-table td {
        padding: 8px;
    }

    .table-image img {
        width: 50px;
        height: 60px;
    }

    .description-cell {
        display: none;
    }

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

    .btn-details, .btn-edit, .btn-delete {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    main {
        padding: 10px;
        margin-bottom: 150px;
    }

    header h1, footer h1 {
        font-size: 18px;
    }

    header nav ul, footer nav ul {
        gap: 10px;
    }

    header a, footer a {
        font-size: 12px;
    }

    .hero {
        height: 200px;
    }

    .text_hero h2 {
        font-size: 18px;
    }

    .text_hero p {
        font-size: 12px;
    }

    .carousel-item img {
        height: 150px;
    }

    .carousel-btn {
        padding: 8px 12px;
        font-size: 16px;
    }

    .search {
        padding: 15px;
    }

    .search form {
        flex-direction: column;
        gap: 8px;
    }

    .search input, .search select, .search button {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .book-card {
        overflow: hidden;
    }

    .book-info {
        padding: 10px;
    }

    .book-info h3 {
        font-size: 12px;
        min-height: 25px;
    }

    .btn-details, .btn-edit, .btn-delete {
        padding: 5px 8px;
        font-size: 10px;
        margin: 2px 1px;
    }

    .ajout {
        padding: 15px;
    }

    .history-favorites-container {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }

    .carousel-caption h3 {
        font-size: 16px;
    }

    .carousel-caption p {
        font-size: 12px;
    }
}

/* PDF Modal et Lecteur */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.pdf-modal-content {
    background: white;
    width: 95%;
    height: 95vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.pdf-header {
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
}

.pdf-header h2 {
    margin: 0;
    font-size: 24px;
}

.pdf-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pdf-controls button {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.pdf-controls button:hover {
    background: #f0f0f0;
}

.pdf-controls button:last-child {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.pdf-controls button:last-child:hover {
    background: #ff5252;
}

#zoom-level {
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.pdf-viewer {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background: #e9ecef;
}

#pdf-canvas {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    max-width: 100%;
    height: auto;
}

.pdf-footer {
    background: #f8f9fa;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #ddd;
}

.pdf-footer button {
    padding: 10px 15px;
    background: linear-gradient(135deg, #f1c039 0%, #f59e0b 100%);
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.pdf-footer button:hover {
    transform: scale(1.05);
}

#page-num {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.pdf-section {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #2196f3;
}

.pdf-section h3 {
    color: #1976d2;
    margin-bottom: 10px;
}

.btn-read {
    display: inline-block;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 10px;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: none;
}

.btn-read:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3);
}