/* ===== BASE ===== */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc6e0;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* RESET BASIQUE */
html {
    box-sizing: border-box;
    font-size: 16px;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    line-height: 1.5;
    background-color: #f8f9fa;
}

/* TABLEAU VISIBLE */
#loans-section {
margin: 2rem auto;
max-width: 1200px;
background: white;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#loans-table {
width: 100%;
border-collapse: collapse;
margin-top: 1rem;
}

#loans-table th {
background-color: #4a6fa5;
color: white;
padding: 12px;
text-align: left;
}

#loans-table td {
padding: 12px;
border-bottom: 1px solid #ddd;
}

#loans-table tr:hover {
background-color: #f5f5f5;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f5f5;
    padding: 0;
    margin: 0;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ===== MAIN LAYOUT ===== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

h2 {
    color: var(--secondary-color);
    margin-bottom: 0;
    font-size: 1.8rem;
}

/* ===== TABLE STYLES ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e9e9e9;
}

/* ===== ITEMS GRID ===== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.item-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.item-image {
    height: 160px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
}

.item-info {
    padding: 1rem;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.item-category {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #e2e6ea;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    justify-content: center;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalOpen 0.3s ease-out;
}

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

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--dark-color);
}

/* ===== FORMS ===== */
form {
    display: grid;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: var(--secondary-color);
}

input, select, textarea {
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 198, 224, 0.2);
}

/* ===== SEARCH & FILTER ===== */
.search-filter {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#search-items {
flex: 1;
min-width: 200px;
}

#category-filter {
width: 180px;
}

/* ===== UTILITIES ===== */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.mt-3 {
    margin-top: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-filter {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    #search-items, #category-filter {
    width: 100%;
    }

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

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    select {
        font-size: 16px; /* Empêche le zoom sur iOS */
        padding: 12px 15px;
    }
}

.item-details {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.detail-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.detail-info {
    flex: 1;
}

.detail-info p {
    margin-bottom: 0.8rem;
}

@media (max-width: 600px) {
    .item-details {
        flex-direction: column;
    }

    .detail-image {
        width: 100%;
        height: auto;
    }
}

#loans-table tr.reservation {
background-color: #fff3cd;
}

#loans-table tr.reservation:hover {
background-color: #ffe8a1;
}

.contact-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.contact-info p {
    margin: 0.5rem 0;
}

/* Validation des dates */
input:invalid {
    border-color: var(--danger-color);
}

/* Responsive */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
}

.delete-btn {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    margin-left: auto; /* Alignement à droite */
}

.delete-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

/* Taille augmentée */
.btn-large {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 10px;
}

/* Espacement des icônes */
.btn-large i {
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .btn-large {
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
    }
}

/* Animation au survol */
.btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.delete-user-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.user-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Ajoutez à la fin du fichier */
.users-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem;
}

.user-card {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    flex: 1;
}

.user-actions {
    margin-left: 1rem;
}

.delete-user-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
}

.delete-user-btn:hover {
    color: #c82333;
}

/* Animation pour le chargement */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}


#loans-table .actions {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}

#loans-table .btn-sm {
padding: 0.3rem 0.6rem;
font-size: 0.85rem;
}
