/* =========================================================
   LibraryApp - Global Theme Variables
   Ces variables permettent de centraliser les couleurs du site.
   Si on veut changer l'identité visuelle, on modifie ici.
========================================================= */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #f59e0b;

    --dark-color: #111827;
    --muted-color: #6b7280;

    --light-bg: #f8fafc;
    --soft-bg: #eff6ff;
    --card-bg: #ffffff;

    --border-color: #e5e7eb;

    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-light: 0 8px 20px rgba(15, 23, 42, 0.05);

    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}


/* =========================================================
   Global Base
   Styles généraux appliqués à tout le site.
========================================================= */
body {
    background: var(--light-bg);
    color: var(--dark-color);
}

a {
    text-decoration: none;
}

.section-title {
    font-weight: 800;
    margin-bottom: 12px;
}

.section-subtitle {
    color: var(--muted-color);
    max-width: 700px;
    margin: 0 auto;
}

/* =========================================================
   Navbar
   Barre de navigation commune aux pages publiques.
========================================================= */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
}

.navbar-brand {
    letter-spacing: -0.4px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* =========================================================
   Home Page - Hero Section
   Grande section d'accueil qui donne la première impression.
========================================================= */
.hero-section {
    background: linear-gradient(135deg, var(--soft-bg), #ffffff);
    border-radius: var(--radius-lg);
    padding: 80px 40px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
}

.hero-badge {
    display: inline-block;
    background: #dbeafe;
    color: var(--primary-dark);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    margin-bottom: 20px;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero-text {
    max-width: 720px;
    margin: 20px auto 0;
    color: var(--muted-color);
    font-size: 1.2rem;
}

/* =========================================================
   Home Page - Feature Cards
   Cartes de la section "Pourquoi utiliser LibraryApp ?"
========================================================= */
.feature-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 16px;
}


/* =========================================================
   Home Page - Value Section
   Section sombre qui explique la valeur de l'application.
========================================================= */
.value-section {
    background: var(--dark-color);
    color: white;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    box-shadow: var(--shadow-soft);
}

.value-section .text-muted-custom {
    color: #d1d5db;
}


/* =========================================================
   Home Page - CTA Section
   Section d'appel à l'action qui remplace le faux formulaire.
========================================================= */
.cta-section {
    background: linear-gradient(135deg, #ffffff, var(--soft-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    box-shadow: var(--shadow-light);
}

/* =========================================================
   Catalogue Page
   Header et filtres de la page /books.
========================================================= */
.catalog-header {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-light);
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================
   Book Cards
   Cartes utilisées dans index.html et books.html.
========================================================= */
.book-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.book-card .card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.book-card-title {
    min-height: 4.5rem;
    line-height: 1.25;
}

.book-card-author {
    min-height: 3rem;
}

.book-card-description {
    min-height: 5.25rem;

    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;

    overflow: hidden;
}



.book-cover-placeholder {
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
}

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

/* =========================================================
   Book Details Page
   Styles de la page /books/{id}.
========================================================= */
.book-detail-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-soft);
}

.book-detail-img {
    background: #f8fafc;
    width: 100%;
    height: 100%;
    max-height: 620px;
    object-fit: contain;
    border-radius: var(--radius-md);
    display: block;
}

.book-detail-placeholder {
    min-height: 520px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    font-weight: 800;
}

.book-detail-content {
    height: 100%;
    padding: 12px;
}

.book-detail-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.8px;
}

.book-info-list {
    display: grid;
    gap: 12px;
}

.book-info-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.book-info-label {
    color: var(--muted-color);
    font-weight: 600;
}

.book-info-value {
    font-weight: 700;
    text-align: right;
}

.borrow-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

/* =========================================================
   Dark / Light Mode
   Ces styles s'activent quand le body reçoit la classe dark-mode.
========================================================= */
body.dark-mode {
    background: #020617;
    color: #e5e7eb;
}

body.dark-mode .navbar {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: #1e293b !important;
}

body.dark-mode .navbar-brand {
    color: #f8fafc;
}

body.dark-mode .navbar-toggler {
    border-color: #64748b;
}

body.dark-mode .navbar-toggler-icon {
    filter: invert(1);
}

body.dark-mode .hero-section,
body.dark-mode .catalog-header,
body.dark-mode .cta-section,
body.dark-mode .book-detail-card,
body.dark-mode .book-card,
body.dark-mode .feature-card {
    background: #0f172a;
    border-color: #1e293b;
    color: #e5e7eb;
}

body.dark-mode .hero-section,
body.dark-mode .cta-section {
    background: linear-gradient(135deg, #0f172a, #111827);
}

body.dark-mode .hero-text,
body.dark-mode .section-subtitle,
body.dark-mode .text-muted,
body.dark-mode .footer-custom {
    color: #cbd5e1 !important;
}

body.dark-mode .book-info-item,
body.dark-mode .borrow-box {
    background: #111827;
    border-color: #1e293b;
}

body.dark-mode .book-info-label {
    color: #94a3b8;
}

body.dark-mode .book-cover-placeholder,
body.dark-mode .book-detail-placeholder {
    background: linear-gradient(135deg, #1d4ed8, #92400e);
}

body.dark-mode .badge.text-bg-light {
    background: #1e293b !important;
    color: #e5e7eb !important;
    border-color: #334155 !important;
}

body.dark-mode .btn-outline-dark {
    color: #e5e7eb;
    border-color: #64748b;
}

body.dark-mode .btn-outline-dark:hover {
    background: #e5e7eb;
    color: #020617;
}

body.dark-mode .btn-outline-secondary {
    color: #e5e7eb;
    border-color: #64748b;
}

body.dark-mode .btn-outline-secondary:hover {
    background: #e5e7eb;
    color: #020617;
}

body.dark-mode .book-cover-img {
    background: #0f172a;
}
/* =========================================================
   Auth Pages
   Styles pour login.html et register.html.
========================================================= */
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-weight: 800;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: var(--muted-color);
    margin-bottom: 0;
}

body.dark-mode .auth-card {
    background: #0f172a;
    border-color: #1e293b;
    color: #e5e7eb;
}

body.dark-mode .auth-header p {
    color: #cbd5e1;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #020617;
    border-color: #334155;
    color: #e5e7eb;
}

body.dark-mode .form-control::placeholder {
    color: #94a3b8;
}

body.dark-mode .form-label {
    color: #e5e7eb;
}

/* =========================================================
   User Borrowings Page
   Styles pour la page /borrowings.
========================================================= */

.page-header {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-light);
}

.table-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.table-card table {
    margin-bottom: 0;
}

body.dark-mode .page-header,
body.dark-mode .table-card {
    background: #0f172a;
    border-color: #1e293b;
    color: #e5e7eb;
}

body.dark-mode .table {
    --bs-table-bg: #0f172a;
    --bs-table-color: #e5e7eb;
    --bs-table-border-color: #1e293b;
    --bs-table-hover-bg: #222e4d;
    color: #e5e7eb;
}

body.dark-mode .table-light {
    --bs-table-bg: #111827;
    --bs-table-color: #f8fafc;
    --bs-table-border-color: #1e293b;
}

/* =========================================================
   Admin Dashboard
   Styles pour admin.html
========================================================= */
.admin-dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
}

/* Dark mode */
body.dark-mode .admin-dashboard-card {
    background: #0f172a;
    border-color: #1e293b;
    color: #e5e7eb;
}

/* =========================================================
   Admin Dashboard
   Styles pour admin-book-form.html
========================================================= */
.admin-form-card {
    background: var(--card-bg);
    border: 1px solid var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-light);
}

body.dark-mode .admin-form-card {
    background: #0f172a;
    border-color: #1e293b;
    color: #e5e7eb;
}

body.dark-mode .form-text {
    color: #94a3b8;
}

/* =========================================================
   Book Cover API
   Conteneur des couvertures et fallback Open Library.
========================================================= */
.book-cover-wrapper {
    width: 100%;
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* =========================================================
   Book Detail Cover API
========================================================= */
.book-detail-cover-wrapper {
    width: 100%;
    position: relative;
}

/* =========================================================
   Footer
========================================================= */
.footer-custom {
    color: var(--muted-color);
}

/* =========================================================
   Responsive Design
   Amélioration du rendu sur tablette et mobile.
========================================================= */

@media (max-width: 991.98px) {

    .navbar-actions {
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding-top: 16px;
        padding-bottom: 8px;
    }

    .navbar-actions .btn,
    .navbar-actions form,
    .navbar-actions form .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 56px 24px;
    }

    .hero-title {
        font-size: 2.4rem;
    }

    .hero-text {
        font-size: 1rem;
    }

    .catalog-header {
        padding: 28px;
    }

    .value-section,
    .cta-section {
        padding: 40px 24px;
    }

    .book-detail-card {
        padding: 20px;
    }

    .book-detail-placeholder {
        min-height: 320px;
        font-size: 4rem;
    }

    .book-detail-img {
        max-height: 420px;
    }

    .book-info-item {
        flex-direction: column;
        gap: 4px;
    }

    .book-info-value {
        text-align: left;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 44px 20px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .filter-bar {
        gap: 8px;
    }

    .book-cover-img,
    .book-cover-placeholder {
        height: 160px;
    }
}