/* === RESET / BASE === */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1f2937;
    background: #f3f5f9;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: #0b2545; line-height: 1.25; }
h2 { font-size: 1.6em; margin: 0 0 .8em; }
h3 { font-size: 1.15em; margin: 1.4em 0 .4em; }
p { margin: 0 0 1em; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 3px; font-size: .92em; }

/* === BOUTONS === */
.btn-primary {
    background: #1a6fb7; color: #fff; border: 0;
    padding: 12px 24px; font-size: 1em; font-weight: 600;
    border-radius: 8px; cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn-primary:hover:not(:disabled) { background: #155a96; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { background: #c7d2dd; color: #6b7280; cursor: not-allowed; }
.btn-link {
    background: none; border: 0; color: #1a6fb7;
    cursor: pointer; font-size: .95em; text-decoration: underline;
}

/* === LOGIN === */
.page-login { display: flex; flex-direction: column; min-height: 100vh; padding: 32px 16px; }
.card {
    max-width: 460px; margin: auto;
    background: #fff; border-radius: 14px;
    padding: 32px 36px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 10px 30px rgba(11,37,69,.08);
    width: 100%;
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.brand-shield { font-size: 38px; }
.brand-label { color: #1a6fb7; font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.brand-title { font-size: 1.5em; margin: 0; color: #0b2545; }
.intro { color: #374151; }
.intro.small { font-size: .92em; color: #6b7280; }

form label { display: block; font-weight: 600; margin-top: 18px; margin-bottom: 6px; font-size: .92em; }
form input[type="email"], form input[type="text"] {
    width: 100%; padding: 11px 14px; font-size: 1em;
    border: 1px solid #cbd5e0; border-radius: 8px;
    background: #fff;
}
form input:focus { outline: 2px solid #1a6fb7; outline-offset: 1px; border-color: #1a6fb7; }
form button[type="submit"] { margin-top: 18px; width: 100%; }
.error { background: #fdecea; color: #b03c2d; padding: 10px 14px; border-radius: 8px; margin: 12px 0 0; font-size: .92em; }

.notice {
    margin-top: 24px; font-size: .85em; color: #6b7280;
    border-top: 1px solid #e5e7eb; padding-top: 14px;
}
.notice summary { cursor: pointer; font-weight: 600; color: #4a5568; }
.notice p { margin-top: 8px; }

.footer-login { text-align: center; color: #9ca3af; font-size: .82em; padding: 18px; }

/* === TOPBAR (FORMATION) === */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: #0b2545; color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.topbar-inner {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 22px; max-width: 980px; margin: 0 auto;
}
.topbar-brand { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.topbar-user { font-size: .9em; display: flex; gap: 14px; align-items: center; opacity: .9; }
.topbar-user button { color: #fff; }
.progress { height: 4px; background: rgba(255,255,255,.15); }
.progress-bar { height: 100%; background: #4dd3a4; transition: width .4s ease-out; }
.topbar-meta {
    background: #112d54; color: #cbd5e0;
    font-size: .82em; padding: 7px 22px;
    display: flex; justify-content: space-between; max-width: 980px; margin: 0 auto;
}
.timer-line { font-variant-numeric: tabular-nums; }
.idle-badge {
    display: inline-block; margin-left: 10px;
    background: #f59e0b; color: #fff; padding: 1px 8px;
    border-radius: 999px; font-weight: 600; font-size: .9em;
}

/* === CONTENU DE FORMATION === */
.training {
    max-width: 760px; margin: 0 auto; padding: 32px 22px 80px;
}
.step {
    background: #fff; border-radius: 14px; padding: 28px 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 6px 20px rgba(11,37,69,.05);
    animation: fadeIn .3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-objective {
    background: #e8f1fa; border-left: 4px solid #1a6fb7;
    padding: 12px 16px; border-radius: 6px; font-size: .95em;
}

.step-footer {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #e5e7eb; padding-top: 18px; margin-top: 28px; gap: 14px;
    flex-wrap: wrap;
}
.step-status { color: #4a5568; font-size: .92em; flex: 1; }

/* === CALLOUTS === */
.callout {
    padding: 14px 18px; border-radius: 10px;
    margin: 18px 0; border-left: 4px solid; font-size: .96em;
}
.callout-blue  { background: #e8f1fa; border-color: #1a6fb7; }
.callout-red   { background: #fdecea; border-color: #c0392b; }
.callout-green { background: #e8f5ec; border-color: #1e8449; }
.callout-amber { background: #fff4e5; border-color: #b5651d; }
.callout ul { margin: 6px 0 0 0; padding-left: 22px; }

/* === LISTES === */
.check-list { list-style: none; padding-left: 0; }
.check-list li {
    padding: 8px 0 8px 30px; position: relative;
    border-bottom: 1px solid #f1f3f7;
}
.check-list li::before {
    content: "✓"; position: absolute; left: 4px; top: 8px;
    color: #1e8449; font-weight: 700;
}
.numbered { padding-left: 22px; }
.numbered li { margin-bottom: 10px; }

/* === 7 SIGNAUX === */
.signals { display: grid; gap: 14px; margin: 18px 0; }
.signals article {
    position: relative; background: #f9fafc;
    border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 14px 14px 14px 60px; font-size: .94em;
}
.signal-num {
    position: absolute; left: 14px; top: 14px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #c0392b; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.signals h3 { margin: 0 0 4px; font-size: 1em; }
.signals p { margin: 0; color: #4a5568; }

/* === EXEMPLE EMAIL / SMS === */
.example-email, .example-sms {
    background: #f9fafc; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 14px 18px; font-size: .94em; margin: 12px 0;
}
.example-email hr { border: 0; border-top: 1px solid #e5e7eb; margin: 10px 0; }
.example-sms { font-family: -apple-system, sans-serif; max-width: 360px; background: #e8f3ff; border-radius: 14px; }

/* === RÉFLEXES === */
.reflexes { list-style: none; padding-left: 0; }
.reflexes li {
    padding: 10px 0 10px 32px; position: relative;
    border-bottom: 1px solid #f1f3f7;
}
.reflexes li::before {
    content: "✅"; position: absolute; left: 0; top: 10px;
}

/* === VIDÉO === */
.video-wrap {
    position: relative; padding-bottom: 56.25%; height: 0;
    background: #000; border-radius: 10px; overflow: hidden;
    margin: 12px 0;
}
.video-wrap iframe, .video-wrap div {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.video-progress {
    background: #e5e7eb; border-radius: 999px; overflow: hidden;
    height: 12px; position: relative; margin-bottom: 6px;
}
.video-progress-bar { height: 100%; background: #4dd3a4; width: 0; transition: width .3s; }
.video-progress-label { font-size: .85em; color: #4a5568; }

/* === QUIZ === */
.quiz-q {
    background: #f9fafc; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 18px 22px; margin-bottom: 14px;
}
.quiz-q h3 { margin: 0 0 12px; font-size: 1em; color: #0b2545; }
.quiz-choice {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 8px 10px; border-radius: 6px; cursor: pointer;
    transition: background .12s;
}
.quiz-choice:hover { background: #eef2f7; }
.quiz-choice input { margin-top: 3px; }

/* === SIGNATURE === */
.engagement {
    background: #f9fafc; border-left: 4px solid #1a6fb7;
    padding: 14px 18px; border-radius: 8px; font-style: italic; color: #374151;
    margin: 16px 0;
}
.form-row { margin: 18px 0; }
.form-row label { font-weight: 600; display: block; margin-bottom: 6px; }
.check-row {
    display: flex; gap: 10px; align-items: flex-start;
    background: #fffdf5; border: 1px solid #f5e6b8; border-radius: 8px;
    padding: 12px 14px; cursor: pointer; margin: 12px 0;
}
.check-row input { margin-top: 3px; }

/* === CERTIFICAT === */
.certificate {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 32px 36px; max-width: 720px; margin: 32px auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 10px 30px rgba(11,37,69,.08);
}
.cert-header { text-align: center; padding-bottom: 22px; border-bottom: 2px solid #1a6fb7; margin-bottom: 22px; }
.cert-icon { font-size: 56px; }
.cert-title { color: #0b2545; font-size: 2em; margin: 8px 0 4px; }
.cert-subtitle { color: #4a5568; }
.cert-body { font-size: 1.05em; line-height: 1.7; }
.cert-meta {
    background: #f9fafc; border-radius: 10px; padding: 14px 18px;
    margin-top: 22px; font-size: .92em; font-family: ui-monospace, monospace;
    word-break: break-all;
}
.cert-meta div { padding: 4px 0; }
.cert-meta b { color: #0b2545; }

/* === ADMIN === */
.admin-wrap { max-width: 1100px; margin: 24px auto; padding: 0 22px; }
.admin-card { background: #fff; padding: 22px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.admin-table th { background: #f3f5f9; text-align: left; padding: 10px; }
.admin-table td { padding: 10px; border-top: 1px solid #e5e7eb; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .82em; font-weight: 600; }
.badge-done { background: #d1f4e2; color: #1e8449; }
.badge-progress { background: #fff4d6; color: #92400e; }
.badge-pending { background: #fde7e7; color: #b03c2d; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; }
.stat { background: #f9fafc; padding: 18px; border-radius: 10px; text-align: center; }
.stat b { display: block; font-size: 2em; color: #0b2545; }
.stat span { color: #6b7280; font-size: .9em; }

/* === ADMIN AVANCÉ — ONGLETS === */
.admin-tabs {
    background: #112d54; max-width: 1100px; margin: 0 auto;
    display: flex; gap: 4px; padding: 0 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-tabs a {
    color: #cbd5e0; text-decoration: none; padding: 12px 18px;
    font-size: .92em; border-radius: 6px 6px 0 0;
    border-bottom: 3px solid transparent; transition: background .15s;
}
.admin-tabs a:hover { background: rgba(255,255,255,.05); color: #fff; }
.admin-tabs a.active { background: #f3f5f9; color: #0b2545; border-bottom-color: #4dd3a4; font-weight: 600; }

/* === ADMIN — KPI CARDS COULEURS === */
.stat.stat-total b    { color: #0b2545; }
.stat.stat-never b    { color: #b03c2d; }
.stat.stat-progress b { color: #c47712; }
.stat.stat-quiz b     { color: #1a6fb7; }
.stat.stat-done b     { color: #1e8449; }
.stat.stat-percent b  { color: #1e8449; }
.stat { transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }

/* === ADMIN — MONITORING HEADER === */
.monitoring-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 14px;
}
.live-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: #1e8449; color: #fff; padding: 6px 14px;
    border-radius: 999px; font-size: .85em; font-weight: 600;
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4dd3a4; box-shadow: 0 0 0 0 rgba(77,211,164,.7);
    animation: pulse 1.8s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(77,211,164,.7); }
    70%  { box-shadow: 0 0 0 8px rgba(77,211,164,0); }
    100% { box-shadow: 0 0 0 0 rgba(77,211,164,0); }
}
.live-badge .muted { color: rgba(255,255,255,.85); font-weight: 400; }

/* === ADMIN — FILTRES === */
.filter-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; gap: 14px; flex-wrap: wrap;
}
.filter-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
    background: #f3f5f9; border: 1px solid #e5e7eb; color: #4a5568;
    padding: 7px 14px; border-radius: 999px; cursor: pointer;
    font-size: .88em; transition: all .12s;
}
.filter-btn:hover { background: #e5e7eb; }
.filter-btn.active { background: #0b2545; color: #fff; border-color: #0b2545; }
.filter-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#searchBox {
    padding: 7px 12px; border: 1px solid #cbd5e0; border-radius: 6px;
    font-size: .92em; min-width: 220px;
}

/* === ADMIN — BADGES === */
.badge { white-space: nowrap; }
.badge-quiz { background: #dbeafe; color: #1e40af; }

/* === ADMIN — BOUTONS === */
.btn-secondary {
    background: #fff; color: #1a6fb7; border: 1px solid #1a6fb7;
    padding: 10px 20px; font-size: .95em; font-weight: 600;
    border-radius: 8px; cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: #e8f1fa; }
.btn-warning {
    background: #d97706; color: #fff; border: 0;
    padding: 10px 20px; font-size: .95em; font-weight: 600;
    border-radius: 8px; cursor: pointer; transition: background .15s;
}
.btn-warning:hover:not(:disabled) { background: #b65d04; }
.btn-warning:disabled { background: #e0c79a; cursor: not-allowed; }
.btn-mini {
    background: #fff; border: 1px solid #d97706; color: #d97706;
    padding: 4px 10px; font-size: .82em; border-radius: 6px;
    cursor: pointer; font-weight: 600;
}
.btn-mini:hover:not(:disabled) { background: #fff4e5; }
.btn-mini:disabled { opacity: .5; cursor: not-allowed; }

.row-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.row-actions-cell { white-space: nowrap; }
.row-actions-cell a { margin-left: 8px; font-size: .88em; }

/* === ADMIN — INVITATIONS === */
#emailsInput {
    width: 100%; padding: 12px 14px; font-family: ui-monospace, monospace;
    font-size: .92em; border: 1px solid #cbd5e0; border-radius: 8px;
    resize: vertical; min-height: 140px;
}
.muted { color: #6b7280; font-size: .9em; }
.send-log {
    list-style: none; padding: 12px 18px; margin: 10px 0 0;
    background: #f9fafc; border-radius: 8px; max-height: 200px;
    overflow-y: auto; font-family: ui-monospace, monospace; font-size: .85em;
}
.send-log li { padding: 2px 0; }

/* === ADMIN — MODALE APERÇU === */
.modal {
    position: fixed; inset: 0; background: rgba(11,37,69,.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}
.modal-inner {
    background: #fff; border-radius: 12px; padding: 24px 28px;
    max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h3 { margin: 0; }

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .step { padding: 22px 18px; border-radius: 0; }
    .training { padding: 16px 0; }
    .topbar-inner, .topbar-meta { padding-left: 14px; padding-right: 14px; }
    .card { padding: 24px 22px; border-radius: 10px; }
    .step-footer { flex-direction: column; align-items: stretch; }
    .step-footer .btn-primary { width: 100%; }
}
