/* Styles communs pour toutes les pages du projet Agenda */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Container principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* En-têtes */
h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 600;
}

h2 {
    color: #444;
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: 600;
}

h3 {
    color: #555;
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Boutons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #e68900;
}

.btn-info {
    background: #2196f3;
    color: white;
}

.btn-info:hover {
    background: #0b7dda;
}

.btn-back {
    background: #e0e0e0;
    color: #333;
    margin-bottom: 15px;
}

.btn-back:hover {
    background: #d0d0d0;
}

/* Cards/Sections */
.section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background: #fafafa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

.badge-warning {
    background: #fff3e0;
    color: #ef6c00;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-secondary {
    background: #f5f5f5;
    color: #666;
}

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Grilles */
.grid {
    display: grid;
    gap: 15px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   RESPONSIVE GLOBAL — Mobile-first additions
   ============================================ */

/* Tableaux scrollables sur mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Wrapper automatique des tableaux dans les sections */
.section table,
.data-table {
    min-width: 480px;
}
.section {
    overflow-x: auto;
}

/* ---- Tablette (≤900px) ---- */
@media (max-width: 900px) {
    .container { padding: 12px; }

    .form-row {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 16px 12px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

/* ---- Mobile (≤600px) ---- */
@media (max-width: 600px) {
    .container { padding: 8px; }

    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    .section { padding: 12px 8px; border-radius: 6px; }

    .section-title { font-size: 16px; }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    th, td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    /* Masquer colonnes secondaires sur petits écrans si balisées */
    .col-hide-mobile { display: none !important; }
}

/* Cartes statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-value.green { color: #2e7d32; }
.stat-value.blue { color: #1565c0; }
.stat-value.orange { color: #ef6c00; }
.stat-value.red { color: #c62828; }
.stat-value.purple { color: #667eea; }

.stat-highlight {
    font-weight: 600;
    color: #667eea;
}

/* Messages */
.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.message {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.message-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.message-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.message-warning {
    background: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #ff9800;
}

.message-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

/* Info-bulles */
[title] {
    cursor: help;
    position: relative;
}

/* Utilitaires */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #999;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .section {
        padding: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
}
