/* ============================================================
   Feuille de style commune - BGE Sud Ouest / Gestion des ateliers
   Une seule charte graphique pour toutes les pages du site.
   ============================================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #bbc4ed 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------- Bandeau logo / titre (toutes les pages) ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.topbar .logo {
    max-height: 70px;
}

.topbar-title {
    font-size: 1.4em;
    color: #333;
}

/* ---------- Menu d'administration ---------- */
.nav-admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.nav-admin a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.nav-admin a:hover {
    background: #667eea;
    color: white;
}

.nav-logout {
    margin-left: auto;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c82333;
}

/* ---------- En-tête de page (sous-titre) ---------- */
.header {
    text-align: center;
    color: white;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---------- Messages ---------- */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Cartes ---------- */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.card h2 {
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 15px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
}

/* ---------- Formulaires ---------- */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

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

.checkbox-group {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.checkbox-group h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-item label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 500;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

/* ---------- Boutons ---------- */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button, input[type="submit"] {
    padding: 13px 28px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-supprimer {
    background: #dc3545;
    color: white;
}

.btn-supprimer:hover {
    background: #c82333;
}

.btn-valider {
    background: #28a745;
    color: white;
}

.btn-valider:hover {
    background: #218838;
}

.view-mode {
    background: #17a2b8;
    color: white;
}

.view-mode:hover {
    background: #138496;
}

.edit-mode {
    display: none;
    background: #28a745;
    color: white;
}

.edit-mode:hover {
    background: #218838;
}

/* Petits boutons dans les tableaux */
table button {
    padding: 8px 14px;
    font-size: 0.85em;
    margin-right: 5px;
}

.link-section {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.link-section a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.link-section a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ---------- Tableaux ---------- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 3px solid #667eea;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

th.sortable:hover {
    background: #e9ecef;
}

th.sortable::after {
    content: ' ⇅';
    opacity: 0.5;
    font-size: 0.9em;
}

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

tr:hover {
    background: #f9f9f9;
}

.actions-cell {
    white-space: nowrap;
    min-width: 220px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-animateur {
    background: #667eea;
    color: white;
}

.badge-count {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.6em;
    font-weight: 600;
}

.lieu-badge {
    display: inline-block;
    background: #764ba2;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.date-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
}

.email-link, .id-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.email-link:hover, .id-link:hover {
    text-decoration: underline;
}

/* ---------- Filtres ---------- */
.filter-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
}

.filter-section label {
    display: inline-block;
    margin-right: 15px;
    color: #333;
    font-weight: 600;
}

.filter-section select {
    width: auto;
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
}

/* ---------- Page de connexion ---------- */
.login-card {
    background: white;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin: 40px auto;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
    border-bottom: none;
}

/* ---------- Liste d'ateliers (page d'inscription) ---------- */
.atelier-list {
    list-style: none;
}

.atelier-item {
    background: #f9f9f9;
    border-left: 5px solid #667eea;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    transition: all 0.3s;
}

.atelier-item:hover {
    background: #f0f0f0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.atelier-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.atelier-date, .atelier-lieu {
    background: #667eea;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.atelier-lieu {
    background: #764ba2;
}

.atelier-places {
    background: #fff3cd;
    color: #856404;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.atelier-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.atelier-description {
    color: #666;
    margin-bottom: 10px;
    line-height: 1.6;
}

.atelier-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.atelier-animateur {
    color: #667eea;
    font-weight: 600;
}

.section-title {
    margin-top: 20px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
}

.legales {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    font-size: 0.85em;
    color: #666;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.legales a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.legales a:hover {
    text-decoration: underline;
}

/* ---------- Info-bulle ---------- */
.bulleinfo {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.bulleinfo .tooltip {
    visibility: hidden;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    text-align: left;
    border-radius: 5px;
    padding: 8px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.3s;
}

.bulleinfo:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* ---------- Gestion des notes ---------- */
.notes-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.section-categories, .section-notes {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.section-display, .section-noncat {
    grid-column: 1 / -1;
}

.section-noncat {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #ffc107;
    margin-top: 20px;
}

.form-category, .form-note {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item {
    margin-bottom: 10px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.category-label {
    padding: 8px 0;
    font-weight: 600;
    color: #555;
}

.btn-edit-cat, .btn-delete-cat {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-edit-cat:hover { background: #17a2b8; color: white; }
.btn-delete-cat:hover { background: #dc3545; color: white; }

.edit-category-form { display: none; }

.edit-category-form input {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    width: auto;
}

.accordion-btn {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    padding: 10px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.accordion-btn:hover { background: #dee2e6; }

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s;
}

.accordion-btn.active .toggle-icon { transform: rotate(90deg); }

.accordion-content {
    margin-top: 10px;
    padding-left: 20px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    background: white;
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 4px;
}

.note-item strong { color: #333; }
.note-item small { color: #999; font-size: 12px; }

.note-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn-copy, .btn-edit, .btn-delete {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-copy { background: #28a745; color: white; }
.btn-copy:hover { background: #218838; }
.btn-copy.copied { background: #20c997; }
.btn-edit { background: #17a2b8; color: white; }
.btn-edit:hover { background: #138496; }
.btn-delete { background: #dc3545; color: white; }
.btn-delete:hover { background: #c82333; }

.note-content {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .topbar { flex-direction: column; text-align: center; }
    .header h1 { font-size: 1.6em; }
    .nav-admin { flex-direction: column; align-items: stretch; }
    .nav-logout { margin-left: 0; }
    .grid-2, .notes-container { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .button-group { flex-direction: column; }
    button, input[type="submit"] { width: 100%; }
    table { font-size: 0.85em; }
    td, th { padding: 8px; }
    .actions-cell { display: flex; gap: 5px; flex-wrap: wrap; min-width: auto; }
    .actions-cell button { margin-right: 0; flex: 1; min-width: 60px; }
    .atelier-date, .atelier-lieu, .atelier-places { width: 100%; text-align: center; }
    .filter-section select { width: 100%; }
}
