/* ============ RESET & BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============ TOP BAR ============ */
.topbar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.topbar h1 {
    font-size: 24px;
    color: #2c3e50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-right {
    display: flex;
    gap: 10px;
}

.user-badge {
    background: #3498db;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
}

/* ============ BOUTONS ============ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary { background: #3498db; color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-warning { background: #f39c12; color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-info { background: #17a2b8; color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 30px; font-size: 16px; }
.btn-full { width: 100%; }

.btn-group {
    display: flex;
    gap: 5px;
}

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

/* ============ CARDS & TABLE ============ */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #2c3e50;
    color: white;
}

.table th {
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.total-row {
    background: #f8f9fa;
    font-size: 16px;
}

/* ============ FORMULAIRES ============ */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    text-align: center;
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ============ ALERTES ============ */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
}

.empty-icon { font-size: 64px; margin-bottom: 20px; }
.empty-state h3 { color: #2c3e50; margin-bottom: 10px; }
.empty-state p { color: #666; margin-bottom: 20px; }

/* ============ FACTURE A4 ============ */
.facture-a4 {
    background: white;
    max-width: 210mm;
    margin: 20px auto;
    padding: 20mm;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.action-bar {
    text-align: center;
    padding: 15px;
    background: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .topbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .facture-a4 {
        padding: 10px;
    }
    
    .table {
        font-size: 12px;
    }
}