* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, system-ui, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 10px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

/* IMPORTANT */

.dashboard-title {
    text-align: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin: 0px 0;
}

/* Filtres */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.filter-group {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}

#btnFiltrer {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.kpi-card {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eee;
    text-align: center;
}

.kpi-card .label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
}

.kpi-card .value {
    font-size: 1rem;
    font-weight: bold;
    display: block;
}

.kpi-card.interactive {
    cursor: pointer;
    transition: 0.2s;
}

.kpi-card.highlight {
    border-top: 4px solid #2ecc71;
}

.kpi-card.tva-highlight {
    border-top: 4px solid #9b59b6;
}

/* Tableaux de détails */
.detail-reglements-table {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 10px;
    overflow: hidden;
}

.detail-header {
    padding: 8px;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
}

#tvaDetailWrapper .detail-header {
    background: #9b59b6;
}

#detailWrapper .detail-header {
    background: #2ecc71;
}

.reg-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #fafafa;
    font-size: 0.85rem;
}

/* Charts */
.chart-container,
.chart-container-pie {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
}

/* Grille Transactions */
/* Réduire la police du tableau de transactions */
.transaction-grid {
    display: grid;
    grid-template-columns: 35px 75px 35px 1fr 75px;
    /* Colonnes un peu plus étroites */
    gap: 4px;
    padding: 8px 5px;
    /* Padding réduit */
    font-size: 0.7rem;
    /* Police plus petite (au lieu de 0.75rem ou 0.85rem) */
    border-bottom: 1px solid #eee;
    align-items: center;
    cursor: pointer;
    /* Indique que la ligne est cliquable */
    user-select: none;
    /* Évite de sélectionner le texte par erreur en cliquant vite */
}

.transaction-grid.header {
    background: #f4f4f4;
    font-weight: bold;
}

.ticket-pair {
    background-color: #f1f7ff;
}

.ticket-impair {
    background-color: #ffffff;
}

.col-montant {
    text-align: right;
    font-weight: bold;
    background-color: #f4f4f4;
    font-weight: bold;
    font-size: 0.65rem;
}

/* Centrer et réduire les titres de section (h2) */
h2 {
    font-size: 0.95rem;
    /* Taille réduite */
    text-align: center;
    color: #34495e;
    margin: 15px 0 10px 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* MODAL TICKET */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.ticket-paper {
    background: white;
    width: 90%;
    max-width: 320px;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.ticket-header {
    text-align: center;
}

.ticket-divider {
    border: none;
    border-top: 1px dashed #000;
    margin: 10px 0;
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 10px;
}

.btn-close {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    cursor: pointer;
}

.ticket-content em {
    font-size: 0.8rem;
    display: block;
    margin-top: 5px;
}

/* Conteneur de la modale (le fond gris) */
#ticketModal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.5);
}

/* La boîte blanche du ticket */
#ticketModal>div {
    max-height: 90vh;
    /* Maximum 90% de la hauteur de l'écran */
    width: 100%;
    max-width: 400px;
    /* Largeur type ticket de caisse */
    display: flex;
    flex-direction: column;
    /* Organise le header, le corps et le footer verticalement */
    background: white;
    border-radius: 8px;
    overflow: hidden;
    /* Empêche les bords de dépasser */
}

/* Le corps du ticket (là où sont les articles) */
#ticketBody {
    flex: 1;
    /* Prend toute la place disponible */
    overflow-y: auto;
    /* Active le défilement vertical si nécessaire */
    padding: 15px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* Le bouton fermer (pour qu'il soit toujours visible en haut ou en bas) */
.btn-close-ticket {
    padding: 10px;
    background: #f8f9fa;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    border: none;
    width: 100%;
}

.error-total {
    color: #e74c3c !important;
    /* Rouge */
    animation: blink 1s infinite;
    font-weight: bold;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}
