/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #d50101 0%, #a00000 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.titre {
    text-align: center;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    width: 50px;
    height: auto;
}

.titre h1 {
    font-size: clamp(1.2rem, 4vw, 2rem);
}

.user-info {
    background: rgba(255,255,255,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    font-weight: 600;
}

/* Menu mobile toggle */
.mobile-menu-toggle {
    display: none;
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    z-index: 1001;
}

/* Menu */
.menu {
    display: flex;
    justify-content: center;
    background: #333;
    flex-wrap: wrap;
}

.menu a {
    color: white;
    text-decoration: none;
    padding: 1rem 1.2rem;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.menu a:hover {
    background: #4CAF50;
    border-bottom-color: #2e7d32;
}

.menu a.active {
    background: #555;
    border-bottom-color: #d50101;
}

.logout-btn {
    background: #c62828 !important;
}

.logout-btn:hover {
    background: #b71c1c !important;
    border-bottom-color: #fff !important;
}

/* Main */
main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: clamp(1rem, 3vw, 2rem);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card h2 {
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #d50101;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #d50101;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: clamp(0.85rem, 2vw, 1rem);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}

.btn-primary {
    background: #d50101;
    color: white;
}

.btn-primary:hover {
    background: #a00000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(213,1,1,0.3);
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #444;
}

.btn-danger {
    background: #c62828;
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #388E3C;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: clamp(0.5rem, 2vw, 1rem);
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
}

th {
    background: #d50101;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody tr:hover {
    background: #f5f5f5;
}

td input,
td select,
td textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #d50101;
}

.stat-card h3 {
    color: #666;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-card .stat-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
    color: #d50101;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.login-container .card {
    text-align: center;
}

.login-container .logo {
    width: 80px;
    margin-bottom: 1rem;
}

/* Actions buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: #666;
    margin-top: 2rem;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

/* Filter section */
.filter-section {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #ddd;
}

.filter-section label {
    font-weight: 600;
    margin-right: 0.5rem;
}

.filter-section select {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Responsive Tablets */
@media (max-width: 1024px) {
    .header-container {
        padding: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #333;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .menu.active {
        display: flex;
    }
    
    .menu a {
        padding: 1rem;
        border-bottom: 1px solid #555;
        border-left: none;
    }
    
    .card {
        border-radius: 4px;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 500px;
    }
    
    th, td {
        padding: 0.6rem 0.4rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Responsive très petits écrans */
@media (max-width: 480px) {
    .titre h1 {
        font-size: 1.2rem;
    }
    
    .logo {
        width: 40px;
    }
    
    table {
        min-width: 400px;
    }
    
    th, td {
        font-size: 0.75rem;
        padding: 0.5rem 0.3rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
    }
}

/* Amélioration scroll horizontal sur mobile */
@media (max-width: 768px) {
    .table-wrapper {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
    }
    
    .table-wrapper table {
        margin: 0;
    }
}

/* Print styles */
@media print {
    header, footer, .btn, .action-buttons, .mobile-menu-toggle {
        display: none;
    }
    
    main {
        max-width: 100%;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}