/* style.css (Version Finale Complète et Corrigée) */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

:root {
    --primary-color: #004b87;
    --secondary-color: #e4002b;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --background-color: #f0f2f5;
    --card-bg-color: #ffffff;
    --text-color: #333;
    --text-light-color: #666;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px; /* Largeur augmentée pour le tableau de bord */
    margin: 0 auto;
    padding: 15px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    max-width: 220px;
}

h1 {
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 10px;
}

.user-info {
    text-align: right;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.user-info a {
    color: var(--secondary-color);
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

nav.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

nav.main-nav a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

nav.main-nav a.active,
nav.main-nav a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
}

.card h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.control-field {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { background-color: #ccc !important; cursor: not-allowed; opacity: 0.6; }

.primary-btn { background-color: var(--primary-color); }
.success-btn { background-color: var(--success-color); }
.danger-btn { background-color: var(--danger-color); }
.secondary-btn { background-color: var(--text-light-color); }

.form-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: center;
}

.loader { text-align: center; padding: 40px; color: var(--text-light-color); font-style: italic; font-weight: bold; }
.error-message { color: var(--danger-color); text-align: center; font-weight: bold; }

/* --- Styles spécifiques aux pages --- */
.login-container { max-width: 380px; margin: 10vh auto; }
.login-screen { background-color: #eee; padding: 20px; text-align: center; font-size: 2rem; letter-spacing: 0.8rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.keypad .key { padding: 20px; font-size: 1.5rem; border: 1px solid var(--border-color); cursor: pointer; }

#cartItems .cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.cart-item-details { flex-grow: 1; }
.btn-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 15px;
    flex-shrink: 0;
}

.table-responsive { width: 100%; overflow-x: auto; }
.sales-table { width: 100%; border-collapse: collapse; }
.sales-table th, .sales-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); white-space: nowrap; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); }
.modal-content { 
    background-color: #fff; 
    margin: 5vh auto; 
    padding: 25px; 
    width: 90%; 
    max-width: 450px; 
    border-radius: 8px; 
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.close-btn { position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; }

.receipt-header { font-family: 'Courier New', monospace; text-align: center; border-bottom: 2px dashed #333; padding-bottom: 15px; }
.receipt-header h3 { margin: 0; }
.receipt-header p { margin: 2px 0; font-size: 0.9em; }
.receipt-items { font-family: 'Courier New', monospace; margin: 20px 0; }
.receipt-items ul { list-style: none; padding: 0; margin: 0; }
.receipt-item { display: flex; justify-content: space-between; margin-bottom: 8px; }
.item-desc { flex-grow: 1; }
.item-desc span { display: block; }
.item-desc .item-subtext { font-weight: 600; color: var(--text-color); }
.item-reduction-receipt { color: var(--secondary-color); font-style: italic; font-size: 0.9em; }
.item-price { white-space: nowrap; font-weight: bold; }
.receipt-total { font-family: 'Courier New', monospace; border-top: 2px dashed #333; padding-top: 15px; text-align: right; font-size: 1.3rem; font-weight: bold; }
.receipt-footer { font-family: 'Courier New', monospace; margin-top: 20px; }
.receipt-footer h4 { margin: 10px 0 0 0; }
.receipt-footer p { margin: 0; }
.receipt-actions { text-align: center; margin-top: 25px; border-top: 1px solid #eee; padding-top: 15px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.kpi-card { text-align: center; }
.kpi-card h3 { font-size: 1rem; color: var(--text-light-color); margin-top: 0; }
.kpi-card p { font-size: 2.2rem; font-weight: 700; color: var(--primary-color); margin: 0; }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.charts-grid .card {
    position: relative;
    height: 350px;
    display: flex;
    flex-direction: column;
}
.charts-grid .card h2 {
    flex-shrink: 0;
}
.charts-grid .card canvas {
    flex-grow: 1;
    min-height: 0;
}

@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
}
