/* ========== STYLES GÉNÉRAUX ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin: 20px 0;
    font-size: 2em;
}

h2 {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    color: #444;
    margin-bottom: 15px;
}

p, a {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 1.15em;
}

a {
    color: #2196F3;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========== BARRE D'EN-TÊTE UTILISATEUR ========== */
.header-bar {
    background-color: #ffffff;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-name {
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
}

.user-role {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-bibliothecaire {
    background-color: #4CAF50;
    color: white;
}

.role-abonne {
    background-color: #2196F3;
    color: white;
}

.role-admin {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    color: white;
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

/* Menu déroulant utilisateur */
.user-menu {
    position: relative;
}

.user-menu-btn {
    background-color: #666;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.user-menu-btn:hover {
    background-color: #555;
    text-decoration: none;
}

.user-menu-btn::after {
    content: "▼";
    font-size: 0.7em;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
}

.user-menu.active .user-menu-dropdown {
    display: block;
}

.user-menu-dropdown a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.user-menu-dropdown a:last-child {
    border-bottom: none;
}

.user-menu-dropdown a:hover {
    background-color: #f5f5f5;
    text-decoration: none;
}

.user-menu-dropdown a.logout {
    color: #f44336;
    font-weight: bold;
}

.user-menu-dropdown a.logout:hover {
    background-color: #ffebee;
}

.logout-btn {
    background-color: #f44336;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: bold;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #da190b;
    text-decoration: none;
}

/* ========== CONTENEUR PRINCIPAL ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ========== STYLES POUR book_detail.php ========== */
.book-image {
    max-width: 400px;
    height: auto;
    margin: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

main {
    margin: 0 auto;
    max-width: 90%;
    display: flex;
    justify-content: space-around;
    gap: 30px;
    flex-wrap: wrap;
}

main section {
    flex: 1;
    min-width: 300px;
}

/* ========== FORMULAIRES ========== */
form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

form div {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

/* ========== BOUTONS ========== */
button,
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s, transform 0.1s;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

button:active,
.btn:active {
    transform: translateY(0);
}

button[type="submit"],
.btn-primary {
    background-color: #4CAF50;
    color: white;
}

button[type="submit"]:hover,
.btn-primary:hover {
    background-color: #45a049;
}

.btn-edit {
    background-color: #2196F3;
    color: white;
}

.btn-edit:hover {
    background-color: #0b7dda;
}

.btn-delete {
    background-color: #f44336;
    color: white;
}

.btn-delete:hover {
    background-color: #da190b;
}

.btn-back,
.btn-secondary {
    background-color: #666;
    color: white;
}

.btn-back:hover,
.btn-secondary:hover {
    background-color: #555;
}

/* ========== RECHERCHE ET ACTIONS ========== */
.search-add-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex: 1;
}

.search-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.add-book-btn {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.add-book-btn:hover {
    background-color: #45a049;
    text-decoration: none;
}

/* ========== LISTES ========== */
ul {
    list-style: none;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
}

ul li {
    background-color: #f9f9f9;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid #4CAF50;
    transition: transform 0.2s, box-shadow 0.2s;
}

ul li:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ========== ACTIONS DE GESTION (ADMIN) ========== */
.admin-actions {
    background-color: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 30px;
}

.admin-actions h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #856404;
    font-size: 1.1em;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* ========== MESSAGES ========== */
.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}


.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #f44336;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #4CAF50;
}

.info-box {
    background-color: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    border: 1px solid #bee5eb;
    border-left: 4px solid #2196F3;
    font-size: 0.95em;
}

.info-box h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
}

.info-box ul {
    margin: 10px 0;
    padding-left: 20px;
    list-style: disc;
}

.info-box li {
    margin: 8px 0;
    padding: 0;
    background: none;
    border: none;
}

.info-box code {
    background-color: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* ========== PAGE DE CONNEXION ========== */
.login-container {
    max-width: 450px;
    margin: 50px auto;
    padding: 40px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.login-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.login-container form {
    width: 100%;
}

.login-container .form-group {
    margin-bottom: 20px;
}

.login-container button {
    width: 100%;
    margin-top: 10px;
}

/* ========== PROFIL UTILISATEUR ========== */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-card {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.profile-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 48px;
    color: white;
}

.profile-header h2 {
    margin: 10px 0 5px;
    color: #333;
}

.profile-email {
    color: #666;
    font-size: 1em;
}

.profile-info {
    display: grid;
    gap: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #4CAF50;
}

.info-label {
    font-weight: bold;
    color: #555;
}

.info-value {
    color: #333;
}

.role-badge-large {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.permissions-section {
    margin-top: 30px;
}

.permissions-list {
    list-style: none;
    padding: 0;
}

.permissions-list li {
    padding: 12px;
    margin-bottom: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #2196F3;
}

.permissions-list li::before {
    content: "✓ ";
    color: #4CAF50;
    font-weight: bold;
    margin-right: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card.green {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.stat-card.blue {
    background: linear-gradient(135deg, #2196F3 0%, #0b7dda 100%);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header-bar {
        flex-direction: column;
        text-align: center;
    }
    
    main {
        flex-direction: column;
    }
    
    .book-image {
        max-width: 100%;
        margin: 10px 0;
    }
    
    .search-add-container {
        flex-direction: column;
    }
    
    .search-form {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        text-align: center;
    }
    
    ul {
        width: 100%;
    }
}