@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --dark-color: #2B1C17;
    --light-color: #F4C7A1;
    --main-background: #FFF8F1;
    --primary-background: #B23A30;
    --primary-textColor: #FFFFFF;
    --secondary-background: #F4C7A1;
    --secondary-textColor: #2B1C17;
    --accent-background: #E76F51;
    --accent-textColor: #FFFFFF;
    --primary-gradient: linear-gradient(135deg, #B23A30 0%, #E76F51 100%);
    --secondary-gradient: linear-gradient(180deg, #F9DCC4 0%, #FFF8F1 100%);
    --shadow-sm: 0 1px 3px rgba(43, 28, 23, 0.08);
    --shadow-md: 0 4px 12px rgba(43, 28, 23, 0.12);
    --shadow-lg: 0 8px 30px rgba(43, 28, 23, 0.16);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--main-background);
    color: var(--dark-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

::selection {
    background-color: var(--accent-background);
    color: #fff;
}

/* ── Layout ── */

.page-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: var(--primary-gradient);
    color: var(--primary-textColor);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.page-header h1 {
    font-family: 'Caveat', cursive;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

.page-header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 0.3rem;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* ── Cards ── */

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(43, 28, 23, 0.06);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    color: var(--primary-background);
    margin-bottom: 1rem;
}

/* ── Forms ── */

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--dark-color);
}

input[type="email"],
input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0d3c8;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--dark-color);
    background: var(--main-background);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-background);
    box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.15);
}

input[type="file"] {
    padding: 0.6rem;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--secondary-background);
    color: var(--secondary-textColor);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background var(--transition);
}

input[type="file"]::file-selector-button:hover {
    background: #e8b98a;
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--primary-textColor);
    box-shadow: 0 2px 8px rgba(178, 58, 48, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(178, 58, 48, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-background);
    color: var(--secondary-textColor);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #e8b98a;
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent-background);
    color: var(--accent-textColor);
    box-shadow: 0 2px 8px rgba(231, 111, 81, 0.3);
}

.btn-accent:hover {
    background: #d4624a;
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

/* ── Alerts ── */

/* Bloc + icône en absolu : évite le bug flex où chaque morceau de texte
   devient un flex item et s’aligne en colonnes (mise en page illisible). */
.alert {
    display: block;
    position: relative;
    padding: 1rem 1.25rem 1rem 2.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    line-height: 1.55;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.alert::before {
    position: absolute;
    left: 1rem;
    top: 1.05rem;
    font-size: 1.2rem;
    line-height: 1;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-error::before {
    content: '\26A0';
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.alert-success::before {
    content: '\2713';
}

.alert-info {
    background: #fff7ed;
    color: #9a3412;
    border-left: 4px solid var(--accent-background);
}

.alert-info::before {
    content: '\2139';
}

/* ── Links ── */

a {
    color: var(--primary-background);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-background);
    text-decoration: underline;
}

.link-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    margin-top: 1.25rem;
    color: var(--dark-color);
    opacity: 0.7;
    transition: opacity var(--transition);
}

.link-back:hover {
    opacity: 1;
    text-decoration: none;
}

.link-back::before {
    content: '\2190';
}

/* ── Debug block ── */

.debug-block {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    border-radius: var(--radius-sm);
    color: #1e40af;
    font-size: 0.9rem;
}

.debug-block strong {
    font-size: 1.1rem;
    letter-spacing: 2px;
}

/* ── Help text ── */

.help-text {
    font-size: 0.85rem;
    color: #8b7b72;
    margin-top: 0.3rem;
}

.format-hint {
    background: var(--secondary-background);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--secondary-textColor);
    margin-bottom: 1.25rem;
    word-break: break-all;
}

/* ── Success page ── */

.success-page {
    text-align: center;
    padding: 3rem 1.5rem;
}

.success-page h2 {
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    color: #166534;
    margin-bottom: 1rem;
}

/* ── Footer ── */

.page-footer {
    width: 100%;
    background: var(--secondary-gradient);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    color: var(--dark-color);
    opacity: 0.7;
    margin-top: auto;
}

/* ── Atelier cards ── */

.ateliers-grid {
    display: grid;
    gap: 1rem;
}

.atelier-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid #efe6df;
    padding: 1.25rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.atelier-card--eco {
    background: #f0fdf4;
    border-color: #bbf7d0;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.08), var(--shadow-sm);
}

.atelier-card--eco:hover {
    border-color: #86efac;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.14), var(--shadow-md);
}

.atelier-eco-badge {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    font-size: 1.05rem;
    line-height: 1;
    z-index: 3;
}

.atelier-eco-badge--with-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(21, 128, 61, 0.15);
}

.atelier-eco-icon {
    font-size: 1rem;
}

.atelier-eco-label {
    color: #15803d !important;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.atelier-eco-ref-centre {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0.1rem 0 0.55rem;
    color: #15803d;
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
}

.atelier-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--light-color);
}

.atelier-card.souhaite {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28), 0 10px 24px rgba(59, 130, 246, 0.14), var(--shadow-sm);
}

.atelier-card--eco.souhaite {
    background: linear-gradient(180deg, #f0fdf4 0%, #eff6ff 100%);
}

.atelier-card.refuse {
    border-color: #ef4444;
    background: #fef2f2;
}

.atelier-card .atelier-code {
    display: inline-block;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.atelier-card .atelier-titre {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}

.atelier-card .atelier-categorie {
    font-size: 0.85rem;
    color: #8b7b72;
}

.atelier-card .atelier-enseignant {
    font-size: 0.85rem;
    color: var(--accent-background);
    margin-top: 0.4rem;
}

.atelier-card .atelier-description {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    color: #5a4a42;
    line-height: 1.5;
}

.atelier-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.atelier-actions .btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

.atelier-precision-banner {
    margin-top: auto;
    background: #ffd4ea;
    color: #e60026;
    border: 1px solid #ff87b0;
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    font-size: 0.84rem;
    line-height: 1.35;
    font-weight: 700;
}

.btn-note-has-content {
    background: #ffe1ef !important;
    border-color: #ff87b0 !important;
    color: #b00028 !important;
}

body.modal-open {
    overflow: hidden;
}

.note-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 12, 10, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 3000;
}

.note-modal-overlay[hidden] {
    display: none !important;
}

.note-modal {
    width: min(640px, 100%);
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(43, 28, 23, 0.12);
    padding: 1rem;
}

.note-modal h3 {
    margin: 0;
}

.note-modal textarea {
    min-height: 130px;
    resize: vertical;
}

.note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.modif-deadline-banner {
    margin: 0.75rem auto 0;
    text-align: center;
    font-size: 0.9rem;
    color: #7f1d1d;
    font-weight: 600;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    max-width: 920px;
}

/* ── Badge ── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-background);
    color: var(--primary-textColor);
}

.badge-accent {
    background: var(--accent-background);
    color: var(--accent-textColor);
}

.badge-secondary {
    background: var(--secondary-background);
    color: var(--secondary-textColor);
}

/* ── User info bar ── */

.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.user-bar .user-name {
    font-weight: 600;
    font-size: 1rem;
}

.user-bar .user-classe {
    font-size: 0.85rem;
    color: #8b7b72;
}

/* ── Wide content ── */

.main-content--wide {
    max-width: 960px;
}

/* ── Button variants ── */

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-detail {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.user-bar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Admin Navigation ── */

.admin-nav {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    background: #fff;
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.admin-nav-link {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark-color);
    transition: all var(--transition);
}

.admin-nav-link:hover {
    background: var(--secondary-background);
    text-decoration: none;
}

.admin-nav-link.active {
    background: var(--primary-gradient);
    color: var(--primary-textColor);
}

.admin-nav-link.active:hover {
    text-decoration: none;
}

.admin-nav-link--logout {
    margin-left: auto;
    color: #991b1b;
    opacity: 0.7;
}

.admin-nav-link--logout:hover {
    opacity: 1;
    background: #fef2f2;
}

/* ── Form row grid ── */

.form-row-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.form-row-grid textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0d3c8;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--dark-color);
    background: var(--main-background);
    outline: none;
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-row-grid textarea:focus {
    border-color: var(--accent-background);
    box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.15);
}

/* ── Stats Row ── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(43, 28, 23, 0.06);
}

.stat-card--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.stat-card--link:hover {
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-background);
}

.stat-card--link:hover .stat-number {
    color: var(--accent-background);
}

.stat-number {
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-background);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #8b7b72;
    margin-top: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Admin Actions Grid ── */

.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* ── Settings Grid ── */

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--main-background);
    border-radius: var(--radius-sm);
}

.setting-row label {
    margin-bottom: 0;
    flex: 1;
}

.setting-row--default {
    border-top: 2px dashed #e0d3c8;
    margin-top: 0.5rem;
    padding-top: 1rem;
}

.input-small {
    width: 70px !important;
    text-align: center;
    padding: 0.5rem !important;
}

/* ── CSS Management ── */

.css-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.css-upload-form {
    padding-top: 1rem;
    border-top: 1px solid #e0d3c8;
}

/* ── Tabs ── */

.tabs {
    display: flex;
    gap: 0.25rem;
    background: #fff;
    padding: 0.4rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-color);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: var(--main-background);
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: var(--primary-textColor);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.4rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.25);
}

.tab-btn.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ── Admin Table ── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead {
    background: var(--primary-gradient);
    color: var(--primary-textColor);
}

.admin-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(43, 28, 23, 0.06);
}

.admin-table tbody tr:hover {
    background: var(--main-background);
}

.admin-table .email-cell {
    font-size: 0.85rem;
    color: #8b7b72;
}

/* ── Sortable columns ── */

.sortable th[data-sort]:not([data-sort="none"]) {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.6rem;
    transition: background var(--transition);
}

.sortable th[data-sort]:not([data-sort="none"]):hover {
    background: rgba(255, 255, 255, 0.15);
}

.sort-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    opacity: 0.4;
}

.sort-icon::after {
    content: '\25B2\25BC';
    letter-spacing: -2px;
    font-size: 0.55rem;
}

th.sort-asc .sort-icon,
th.sort-desc .sort-icon {
    opacity: 1;
}

th.sort-asc .sort-icon::after {
    content: '\25B2';
}

th.sort-desc .sort-icon::after {
    content: '\25BC';
}

/* ── Inline form (delete button in table) ── */

.inline-form {
    display: inline;
}

/* ── Actions in table ── */

.actions-cell {
    white-space: nowrap;
}

.actions-wrap {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.actions-wrap .btn,
.actions-wrap button {
    white-space: nowrap;
}

.btn-active {
    background: var(--primary-gradient) !important;
    color: var(--primary-textColor) !important;
}

/* ── Detail rows (expandable) ── */

.detail-row {
    background: var(--main-background) !important;
}

.detail-row:hover {
    background: var(--main-background) !important;
}

.detail-cell {
    padding: 0 !important;
}

.detail-content {
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--primary-background);
    animation: fadeInUp 0.25s ease-out;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.detail-section {
    margin-bottom: 0.75rem;
}

.detail-section-title {
    font-family: 'Caveat', cursive;
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
}

.detail-section-title--souhaite {
    color: #166534;
}

.detail-section-title--refuse {
    color: #991b1b;
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list li {
    padding: 0.3rem 0;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-cat {
    font-size: 0.75rem;
    color: #8b7b72;
    font-style: italic;
}

/* ── Badge variants ── */

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fef2f2;
    color: #991b1b;
}

/* ── Choix ateliers : Catégories ── */

.categorie-section {
    margin-bottom: 2rem;
}

.categorie-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.categorie-titre {
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    color: var(--primary-background);
}

.categorie-compteurs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.categorie-compteur {
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fff;
    border: 2px solid #e0d3c8;
    transition: all var(--transition);
}

.categorie-compteur--refus {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.7;
}

.categorie-compteur.compteur-ok {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
}

.categorie-compteur.compteur-ko {
    border-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
}

.categorie-consigne {
    font-size: 0.9rem;
    color: #8b7b72;
    margin-bottom: 1rem;
}

/* ── Atelier choice buttons ── */

.atelier-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.atelier-etat-icon::after {
    font-size: 1.4rem;
    transition: all var(--transition);
}

.atelier-card.souhaite .atelier-etat-icon::after {
    content: '\2705';
}

.atelier-card.refuse .atelier-etat-icon::after {
    content: '\274C';
}

.btn-choix {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.btn-souhaite {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.btn-souhaite:hover {
    background: #bfdbfe;
}

.atelier-card.souhaite .btn-souhaite {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.btn-refuse {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.btn-refuse:hover {
    background: #fecaca;
}

.atelier-card.refuse .btn-refuse {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ── Refus bar ── */

.refus-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    margin-top: 1rem;
}

.refus-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.refus-hint {
    font-size: 0.8rem;
    color: #8b7b72;
    font-style: italic;
}

/* ── Submit bar ── */

.submit-bar {
    position: sticky;
    bottom: 0;
    background: var(--main-background);
    padding: 1.25rem 0;
    margin-top: 1rem;
    border-top: 1px solid #e0d3c8;
    z-index: 10;
}

.submit-errors {
    margin-bottom: 0.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    border: 2px solid #ef4444;
    border-radius: var(--radius-sm);
}

.submit-error-item {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submit-error-item + .submit-error-item {
    border-top: 1px solid rgba(0,0,0,0.06);
}

.submit-error-item--warning {
    background: #fff7ed;
    color: #9a3412;
}

.submit-error-item--warning::before {
    content: '\261D';
    font-size: 1.1rem;
}

.submit-error-item--error {
    background: #fef2f2;
    color: #991b1b;
}

.submit-error-item--error::before {
    content: '\26A0';
    font-size: 1.1rem;
}

.submit-status {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #8b7b72;
}

.submit-status--ok {
    color: #166534;
    font-weight: 600;
}

/* ── Recap card ── */

.recap-card {
    border-left: 4px solid #22c55e;
}

.recap-categorie {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: var(--primary-background);
    margin: 1rem 0 0.5rem;
}

.recap-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.recap-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Shake animation ── */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* ── Ateliers grid responsive ── */

.ateliers-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .admin-nav {
        flex-wrap: wrap;
    }

    .admin-nav-link {
        flex: 1;
        text-align: center;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

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

    .admin-actions-grid {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.6rem 0.5rem;
    }

    .ateliers-grid {
        grid-template-columns: 1fr;
    }

    .categorie-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1.25rem 1rem 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .page-header {
        padding: 1.5rem 1rem;
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }

    .atelier-actions {
        flex-direction: column;
    }

    .tabs {
        flex-direction: column;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-small {
        width: 100% !important;
    }
}

/* ── Test mode card ── */

.card--test {
    border-left: 4px solid #3b82f6;
}

.test-user-info {
    background: #f0f7ff;
    border-radius: var(--radius-sm);
    padding: 1.25rem;
}

.test-user-details {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.test-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.test-user-stats {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.test-user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.test-user-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.test-code-section {
    background: var(--main-background);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.test-code-display {
    text-align: center;
    padding: 0.75rem;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 2px solid #22c55e;
}

.test-code-display--empty {
    border-color: #e0d3c8;
    border-style: dashed;
}

.test-code-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: #8b7b72;
    margin-bottom: 0.2rem;
}

.test-code-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--primary-background);
    font-family: 'Courier New', monospace;
}

.test-code-expire {
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 500;
    margin-top: 0.15rem;
}

.test-user-preview {
    background: var(--main-background);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}

.test-preview-table {
    margin-top: 0.5rem;
    border-collapse: collapse;
}

.test-preview-table td {
    padding: 0.3rem 0.75rem 0.3rem 0;
    font-size: 0.9rem;
}

.test-preview-table td:first-child {
    font-weight: 600;
    color: #8b7b72;
    min-width: 80px;
}

/* ── Animations ── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.4s ease-out;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }

.stat-card {
    animation: fadeInUp 0.4s ease-out;
}
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.07s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card:nth-child(4) { animation-delay: 0.21s; }

/* ── Lignes avec indicateur de statut (vert/rouge) ── */

.row-statut {
    position: relative;
}

.row-statut--ok {
    border-left: 4px solid #22c55e;
    background: rgba(220, 252, 231, 0.25);
}

.row-statut--ok:hover {
    background: rgba(220, 252, 231, 0.45) !important;
}

.row-statut--attente {
    border-left: 4px solid #ef4444;
    background: rgba(254, 226, 226, 0.25);
}

.row-statut--attente:hover {
    background: rgba(254, 226, 226, 0.45) !important;
}

/* ── Barre de filtre par classe ── */

.filter-bar {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 0.3rem 0.75rem !important;
    font-size: 0.8rem !important;
    border-radius: 20px !important;
    transition: all var(--transition);
}

.filter-btn.active {
    background: var(--primary-gradient) !important;
    color: var(--primary-textColor) !important;
    box-shadow: 0 2px 8px rgba(178, 58, 48, 0.25);
}

/* ── Remarques inline ── */

.remarque-cell {
    min-width: 180px;
}

.remarque-form {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
}

.remarque-input {
    flex: 1;
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #e0d3c8;
    border-radius: 4px;
    background: var(--main-background);
    color: var(--dark-color);
    min-width: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.remarque-input:focus {
    outline: none;
    border-color: var(--accent-background);
    box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.15);
}

.remarque-input::placeholder {
    color: #c4b5a8;
    font-style: italic;
}

.remarque-save {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1;
    flex-shrink: 0;
}

.remarque-input.remarque-saved {
    border-color: #16a34a;
    background: #f0fdf4;
    transition: background 0.3s, border-color 0.3s;
}
