* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.theme-switcher {
    display: flex;
    gap: 0.5rem;
}

.theme-button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-button:hover {
    transform: scale(1.1);
}

.theme-button.white { background-color: #ffffff; }
.theme-button.red { background-color: #dc2626; }
.theme-button.blue { background-color: #2563eb; }
.theme-button.turquoise { background-color: #14b8a6; }
.theme-button.black { background-color: #1f2937; }

/* Thèmes de couleurs */
:root {
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --background: #f3f4f6;
    --text: #1f2937;
    --card-bg: #ffffff;
}

/* Thème rouge */
[data-theme="red"] {
    --primary-color: #dc2626;
    --primary-hover: #b91c1c;
    --background: #fef2f2;
    --text: #7f1d1d;
    --card-bg: #fee2e2;
}

/* Thème bleu */
[data-theme="blue"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background: #eff6ff;
    --text: #1e3a8a;
    --card-bg: #dbeafe;
}

/* Thème turquoise */
[data-theme="turquoise"] {
    --primary-color: #14b8a6;
    --primary-hover: #0d9488;
    --background: #f0fdfa;
    --text: #134e4a;
    --card-bg: #ccfbf1;
}

/* Thème noir */
[data-theme="black"] {
    --primary-color: #4b5563;
    --primary-hover: #374151;
    --background: #1f2937;
    --text: #f9fafb;
    --card-bg: #374151;
}

h1 {
   color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.add-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.add-button:hover {
   background-color: var(--primary-hover);
}

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

.book-card {
   background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: box-shadow 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center; /* Ajout de cette ligne pour centrer les éléments */
}

.book-rating {
    text-align: center;
    font-size: 1.25rem;
    display: flex;
    justify-content: center; /* Double assurance de centrage */
}

.book-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.book-cover {
    aspect-ratio: 3/4;
    background: #e5e7eb;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    overflow: hidden;
}

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

.book-title {
    text-align: center;
    font-weight: 600;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

[data-theme="black"] .modal-content {
    background: #1f2937;
    color: #f9fafb;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.rating-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.rating-button {
    font-size: 1.5rem;
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 0.25rem;
}

.rating-button.selected {
    background: #e5e7eb;
}

.total-pages {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
}

.book-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.delete-button {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    margin-top: 1rem;
}

.edit-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
    width: 100%;
}

.edit-button:hover {
    background-color: var(--primary-hover);
}

.delete-button:hover {
    background-color: #b91c1c;
}

.switch-button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
}

.switch-button:hover {
    background-color: var(--card-bg);
}
