/* assets/css/style.css */

/* === RÈGLES DE BASE ET ANTI-DÉBORDEMENT (Mobiles) === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    /* Empêche le scroll horizontal de la page entière */
}

/* Empêche les gros textes et liens de sortir de leurs boîtes */
p,
h1,
h2,
h3,
a,
td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Rendre les tableaux scrollables avec le doigt sur mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
}

/* === MENU LATÉRAL === */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: left 0.3s ease;
}

.sidebar-logo {
    text-align: center;
    padding: 20px 10px;
    background-color: #1a252f;
    color: #d32f2f;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 2px solid #d32f2f;
}

.sidebar-logo img {
    width: 80px;
    height: auto;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.sidebar a {
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    border-bottom: 1px solid #34495e;
    transition: background 0.3s;
    display: block;
}

.sidebar a:hover {
    background-color: #34495e;
}

.sidebar a.admin-link {
    padding: 10px 15px;
    border-left: 3px solid transparent;
}

/* === CONTENU PRINCIPAL === */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    /* Sécurité anti-débordement */
}

.topbar {
    background-color: #d32f2f;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-logout {
    background-color: white;
    color: #d32f2f;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
}

.container {
    padding: 20px;
    max-width: 100%;
    /* Sécurité anti-débordement */
}

/* Animation globale pour les cartes V1 */
.carte-animee {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.carte-animee:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15) !important;
    border-color: #d32f2f !important;
}

/* === CLASSES RÉUTILISABLES (V1) === */
.white-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    max-width: 100%;
    /* Sécurité anti-débordement */
}

.table-manager {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table-manager thead tr {
    background-color: #f8f9fa;
    text-transform: uppercase;
    font-size: 11px;
    color: #666;
    letter-spacing: 0.5px;
}

.table-manager th,
.table-manager td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.category-header {
    padding: 12px 15px;
    border-radius: 4px 4px 0 0;
    margin: 0;
    font-size: 16px;
}

.form-container {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2c3e50;
}

.form-group-inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Bouton Menu Mobile & Fond sombre */
.btn-menu-mobile {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin-right: 15px;
    padding: 0;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

/* Classe active pour afficher l'overlay en JS */
.overlay.actif {
    display: block;
}

/* =======================================================
   NOUVELLES CLASSES UTILITAIRES (V2 - INVENTAIRE & PARAMÈTRES)
   ======================================================= */
.flex-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.flex-row-sm {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-between-start {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.flex-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flex-1 {
    flex: 1 1 0%;
}

.flex-2 {
    flex: 2;
}

.min-w-100 {
    min-width: 100px;
}

.min-w-150 {
    min-width: 150px;
}

.min-w-200 {
    min-width: 200px;
}

.min-w-350 {
    min-width: 350px;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-5 {
    margin-bottom: 5px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-25 {
    margin-bottom: 25px;
}

.mb-30 {
    margin-bottom: 30px;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-5 {
    margin-top: 5px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-15 {
    margin-top: 15px;
}

.mt-30 {
    margin-top: 30px;
}

.mt-40 {
    margin-top: 40px;
}

.pb-10 {
    padding-bottom: 10px;
}

.pb-15 {
    padding-bottom: 15px;
}

.pb-30 {
    padding-bottom: 30px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

.ml-10 {
    margin-left: 10px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-danger {
    color: #d32f2f;
}

.text-success {
    color: #2e7d32;
}

.text-warning {
    color: #ef6c00;
}

.text-muted {
    color: #999;
}

.text-dark {
    color: #333;
}

.text-primary {
    color: #2c3e50;
}

.font-bold {
    font-weight: bold;
}

.font-italic {
    font-style: italic;
}

.font-normal {
    font-weight: normal;
}

.text-sm {
    font-size: 12px;
}

.text-md {
    font-size: 14px;
}

.text-lg {
    font-size: 18px;
}

.text-xl {
    font-size: 24px;
}

.display-block {
    display: block;
}

.align-center {
    align-items: center;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: #2c3e50;
    color: white;
}

.btn-success {
    background-color: #4caf50;
    color: white;
}

.btn-success-dark {
    background-color: #2e7d32;
    color: white;
}

.btn-danger {
    background-color: #f44336;
    color: white;
}

.btn-danger-dark {
    background-color: #d32f2f;
    color: white;
}

.btn-warning {
    background-color: #ef6c00;
    color: white;
}

.btn-secondary {
    background-color: #ccc;
    color: #333;
}

.btn-outline-primary {
    background-color: white;
    color: #2c3e50;
    border: 1px solid #2c3e50;
}

.btn-outline-danger {
    background-color: white;
    color: #d32f2f;
    border: 1px solid #d32f2f;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    vertical-align: middle;
}

.badge-pill {
    border-radius: 20px;
    padding: 5px 15px;
}

.badge-reserve {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.badge-reserve-abs {
    position: absolute;
    top: -10px;
    right: -10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 20px;
    background: #1565c0;
    color: white;
    font-weight: bold;
    z-index: 10;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: bold;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 5px solid #4caf50;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border-left: 5px solid #f44336;
}

.alert-warning {
    background-color: #fff3e0;
    color: #555;
    border-left: 5px solid #ef6c00;
    font-weight: normal;
}

.alert-warning-box {
    background-color: #fff3e0;
    border: 2px solid #ef6c00;
}

.page-title {
    margin: 0 0 10px 0;
    color: #d32f2f;
}

.section-title {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.border-bottom {
    border-bottom: 2px solid #f0f0f0;
}

.border-radius-4 {
    border-radius: 4px;
}

.bg-white {
    background-color: #ffffff;
}

.form-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.form-box-edit {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-left: 5px solid #2c3e50;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.card-sac {
    display: block;
    width: 200px;
    padding: 20px;
    background-color: white;
    border: 2px solid transparent;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #333;
    text-align: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.card-sac:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    border-color: #d32f2f;
}

.card-sac-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.border-blue {
    border-color: #bbdefb !important;
}

/* ========================================== */
/* 📱 RESPONSIVE DESIGN (MOBILES & TABLETTES) */
/* ========================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -250px;
    }

    .sidebar.ouvert {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .btn-menu-mobile {
        display: inline-block;
    }

    .topbar {
        padding: 12px 15px;
        font-size: 14px;
        flex-wrap: wrap;
        /* Permet aux éléments de s'ajuster si trop peu de place */
    }

    .topbar>div {
        display: flex;
        align-items: center;
    }

    .container {
        padding: 10px;
    }

    .white-box {
        padding: 15px;
    }
}
/* ========================================== */
/* PAGE DE CONNEXION                          */
/* ========================================== */
body.login-page {
    background-color: #f4f7f6;
    font-family: Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h2 {
    color: #d32f2f;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    font-size: 22px;
}

.login-box h3 {
    color: #555;
    margin: 0 0 30px 0;
    font-weight: normal;
    font-size: 14px;
}

.btn-oauth {
    width: 100%;
    padding: 14px;
    background-color: #f7c814;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
    margin-bottom: 25px;
}

.btn-oauth:hover {
    background-color: #d3ac11;
}

.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.separator:not(:empty)::before {
    margin-right: .25em;
}

.separator:not(:empty)::after {
    margin-left: .25em;
}

.btn-local {
    width: 100%;
    padding: 10px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-local:hover {
    background-color: #1a252f;
}

.error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #ffcdd2;
    text-align: left;
    line-height: 1.5;
}

.info-msg {
    background: #e3f2fd;
    color: #1565c0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #bbdefb;
    text-align: left;
    line-height: 1.5;
}

.info-msg a {
    color: #0d47a1;
    font-weight: bold;
    text-decoration: underline;
}

/* ========================================== */
/* PAGE CATALOGUE (materiel.php)              */
/* ========================================== */

.catalogue-container { display: flex; gap: 20px; flex-wrap: wrap; }
.catalogue-sidebar { flex: 1; min-width: 300px; }
.catalogue-main { flex: 2; min-width: 400px; margin-bottom: 0; }

.title-red { margin-top: 0; color: #d32f2f; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; }
.title-orange { margin-top: 0; color: #e65100; border-bottom: 2px solid #ffe0b2; padding-bottom: 10px; }

.form-label { display: block; font-weight: bold; font-size: 14px; margin-bottom: 5px; color: #333; }
.form-label-edit { display: block; font-weight: bold; font-size: 14px; margin-bottom: 5px; color: #e65100; }

.input-edit-focus { border-color: #ffcc80; }
.form-box-orange { display: none; background: #fff3e0; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border-left: 5px solid #ef6c00; margin-bottom: 20px; }

.btn-full { width: 100%; padding: 12px; }
.btn-flex-2 { flex: 2; padding: 12px; }
.btn-flex-1 { flex: 1; padding: 12px; }

.search-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.search-container { position: relative; }
.search-icon { position: absolute; left: 10px; top: 10px; color: #999; }
.search-input { padding: 10px 10px 10px 35px; min-width: 250px; border-radius: 20px; border: 1px solid #ccc; width: 100%; box-sizing: border-box; }

.category-card { margin-bottom: 30px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-radius: 4px; overflow: hidden; background: white; }
.empty-message { color: #666; font-style: italic; text-align: center; padding: 20px; }

.item-name { font-weight: 500; color: #444; }
.item-supplier { color: #666; font-size: 14px; }