/* ─── Bootstrap primary color (indigo) ──────────────────────────────────── */
:root {
    --bs-primary:           #6366f1;
    --bs-primary-rgb:       99, 102, 241;
    --bs-link-color:        #6366f1;
    --bs-link-color-rgb:    99, 102, 241;
    --bs-link-hover-color:  #4f46e5;
    --bs-body-font-family:  'Inter', system-ui, -apple-system, sans-serif;
    --bs-body-bg:           #f1f5f9;

    /* Kept for timer board & misc */
    --c-success:  #10b981;
    --c-danger:   #ef4444;
    --c-muted:    #64748b;
    --radius-card: 1rem;
    --radius-sm:   .5rem;
}

[hidden] { display: none !important; }

/* ─── Body ───────────────────────────────────────────────────────────────── */
body { -webkit-font-smoothing: antialiased; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar { min-height: 56px; }

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: #fff;
        border-top: 1px solid #e2e8f0;
        padding: .5rem 0 .75rem;
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
    }
}

/* ─── Page wrapper ───────────────────────────────────────────────────────── */
.page-wrapper { padding: 2rem 0 3rem; }

/* ─── Bootstrap primary button → indigo gradient ─────────────────────────── */
.btn-primary {
    --bs-btn-bg:              #6366f1;
    --bs-btn-border-color:    #4f46e5;
    --bs-btn-hover-bg:        #4f46e5;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg:       #4338ca;
    --bs-btn-active-border-color: #3730a3;
    --bs-btn-focus-shadow-rgb: 99, 102, 241;
    background: linear-gradient(160deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 8px rgba(99,102,241,.28);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(160deg, #5153ec 0%, #4338ca 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,.1), 0 4px 16px rgba(99,102,241,.38);
}

/* ─── Soft badge colors ──────────────────────────────────────────────────── */
.badge.bg-success   { background-color: #dcfce7 !important; color: #15803d; }
.badge.bg-warning   { background-color: #fef3c7 !important; color: #b45309; }
.badge.bg-secondary { background-color: #f1f5f9 !important; color: #475569; }
.badge.bg-danger    { background-color: #fee2e2 !important; color: #b91c1c; }
.badge.bg-primary   { background-color: #eef2ff !important; color: #4338ca; }
.badge.bg-info      { background-color: #dbeafe !important; color: #1d4ed8; }

/* ─── Form label: uppercase compact style ─────────────────────────────────── */
.form-label {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: .4rem;
}

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
    border-color: #e2e8f0;
    border-radius: var(--radius-card);
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 20px rgba(0,0,0,.07);
}
.card-header {
    background: #fff;
    border-bottom-color: #e2e8f0;
    border-radius: var(--radius-card) var(--radius-card) 0 0 !important;
}

/* ─── Table headers ──────────────────────────────────────────────────────── */
.table thead th {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom-width: 1px;
}
.table > :not(caption) > * > * { vertical-align: middle; }

/* ─── List group hover ───────────────────────────────────────────────────── */
.list-group-item-action:hover,
.list-group-item-action:focus { background-color: #fafbff; color: inherit; }

/* ─── Navbar brand icon ──────────────────────────────────────────────────── */
.chron-brand-icon {
    width: 32px; height: 32px;
    border-radius: .5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
    flex-shrink: 0;
}

/* ─── Avatar circle ──────────────────────────────────────────────────────── */
.chron-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: .68rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0;
}

/* ─── Live dot animation ─────────────────────────────────────────────────── */
.dash-live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-success);
    box-shadow: 0 0 0 2px rgba(16,185,129,.2);
    display: inline-block;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
    50%       { box-shadow: 0 0 0 5px rgba(16,185,129,.0); }
}

/* ─── Monospace badge (slug, code) ───────────────────────────────────────── */
.c-mono-badge {
    font-family: ui-monospace, monospace;
    font-size: .82rem;
    background: #f1f5f9;
    padding: .2rem .5rem;
    border-radius: .35rem;
    color: #475569;
}

/* ─── Admin stat icon ────────────────────────────────────────────────────── */
.admin-stat-icon {
    width: 44px; height: 44px;
    border-radius: .7rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ─── Report bars ────────────────────────────────────────────────────────── */
.report-bar-wrap { display: flex; align-items: center; gap: .65rem; }
.report-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.report-bar-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #818cf8); border-radius: 999px; }
.report-bar-label { font-size: .8rem; color: var(--c-muted); min-width: 40px; text-align: right; }

/* ─── Participant search autocomplete ────────────────────────────────────── */
.ps-wrap { position: relative; }

.ps-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.1);
    z-index: 900;
    max-height: 280px;
    overflow-y: auto;
}

.ps-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .55rem .85rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: .875rem;
    color: #0f172a;
    border-bottom: 1px solid #f8fafc;
    gap: .5rem;
}
.ps-item:last-child { border-bottom: none; }
.ps-item:hover, .ps-item.is-focused { background: #f8fafc; }

.ps-item-name { flex: 1; font-weight: 500; }
.ps-item-name mark { background: none; color: #6366f1; font-weight: 700; }

.ps-item-code {
    font-family: ui-monospace, monospace;
    font-size: .72rem;
    color: var(--c-muted);
    background: #f1f5f9;
    padding: .1rem .35rem;
    border-radius: .25rem;
    flex-shrink: 0;
}

.ps-empty {
    padding: .85rem 1rem;
    font-size: .875rem;
    color: var(--c-muted);
    text-align: center;
}

/* ─── Timer board ────────────────────────────────────────────────────────── */
.timer-board-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    min-height: 420px;
}

.timer-board-main {
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.timer-board-sidebar {
    display: flex;
    flex-direction: column;
    background: #fafbff;
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.timer-sidebar-header {
    padding: .65rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--c-muted);
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    border-radius: 0 var(--radius-card) 0 0;
}

.timer-sidebar-body {
    flex: 1;
    overflow-y: auto;
    max-height: 560px;
}

.timer-sidebar-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: .82rem;
    color: var(--c-muted);
}

/* ─── Timer rows ─────────────────────────────────────────────────────────── */
.timer-row {
    display: flex;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 1rem;
    transition: background .15s;
}
.timer-row:last-child { border-bottom: none; }
.timer-row.is-active { background: #f0fdf4; }

.timer-name {
    flex: 1;
    font-weight: 600;
    font-size: .95rem;
    color: #0f172a;
}

.timer-display {
    font-variant-numeric: tabular-nums;
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    min-width: 100px;
    text-align: center;
    letter-spacing: .02em;
}
.timer-row.is-active .timer-display { color: var(--c-success); }

.timer-actions { display: flex; gap: .4rem; align-items: center; }

/* Free chrono row */
.timer-row--free { background: #fafafa; }
.timer-row--free.is-active { background: #f0fdf4; }

.timer-name--free {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-weight: 500;
    color: #64748b;
}

/* Separator */
.timer-separator {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1.5rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.timer-separator::before,
.timer-separator::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

/* Add free zone */
.timer-add-free {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}
.timer-add-free .form-control-sm { flex: 1; min-width: 0; }

/* Assign zone */
.timer-assign {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-left: .25rem;
    border-left: 1px solid #e2e8f0;
    padding-left: .5rem;
}

/* ─── Timer buttons ──────────────────────────────────────────────────────── */
.btn-timer {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .45rem .85rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    font-family: inherit;
}
.btn-timer:active { transform: scale(.96); }
.btn-timer:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-timer-start { background: #dcfce7; color: #15803d; }
.btn-timer-start:hover:not(:disabled) { background: #bbf7d0; }

.btn-timer-stop { background: #fef3c7; color: #b45309; }
.btn-timer-stop:hover:not(:disabled) { background: #fde68a; }

.btn-timer-reset {
    background: #fee2e2; color: #b91c1c;
    width: 34px; height: 34px; padding: 0;
    justify-content: center;
    border-radius: 50%; font-size: .95rem;
}
.btn-timer-reset:hover:not(:disabled) { background: #fecaca; }

.btn-timer-add { background: #ede9fe; color: #7c3aed; }
.btn-timer-add:hover { background: #ddd6fe; }

.btn-timer-assign {
    background: #e0f2fe; color: #0369a1;
    width: 30px; height: 30px; padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm); font-size: 1rem;
}
.btn-timer-assign:hover:not(:disabled) { background: #bae6fd; }

/* ─── Audience bar ───────────────────────────────────────────────────────── */
.timer-audience-bar {
    display: flex;
    gap: .4rem;
    padding: .65rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    flex-wrap: wrap;
    align-items: center;
}

.timer-audience-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-muted);
    white-space: nowrap;
}

.btn-audience {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .7rem;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: white;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    font-family: inherit;
}
.btn-audience--applause:hover { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.btn-audience--boo:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.btn-audience--other:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }

/* ─── Timer bottom bar ───────────────────────────────────────────────────── */
.timer-bottom-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    margin-top: auto;
    border-radius: 0 0 0 var(--radius-card);
    flex-wrap: wrap;
}

@media (max-width: 860px) {
    .timer-board-layout { grid-template-columns: 1fr; }
    .timer-board-main { border-right: none; border-bottom: 1px solid #e2e8f0; }
    .timer-board-sidebar { border-radius: 0 0 var(--radius-card) var(--radius-card); }
    .timer-sidebar-header { border-radius: 0; }
    .timer-sidebar-body { max-height: 300px; }
    .timer-bottom-bar { border-radius: 0; }
}

/* ─── Pending / sync states ──────────────────────────────────────────────── */
@keyframes timer-sync-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

.is-pending {
    animation: timer-sync-pulse 1.1s ease-in-out infinite;
    pointer-events: none;
}

/* ─── Sidebar entries (timeline) ─────────────────────────────────────────── */
.sb-entry {
    padding: .65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: .83rem;
}
.sb-entry:last-child { border-bottom: none; }
.sb-entry--active { background: #f0fdf4; }
.sb-entry--audience { background: #fffbeb; }

.sb-entry-header {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
}

.sb-entry-label {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-entry-duration {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: .88rem;
    color: #0f172a;
    flex-shrink: 0;
}
.sb-entry--active .sb-entry-duration { color: var(--c-success); }

.sb-entry-time { font-size: .72rem; color: var(--c-muted); margin-top: .12rem; }

.sb-entry-interrupted {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-top: .25rem;
    font-size: .73rem;
    font-weight: 600;
    color: #b91c1c;
    background: #fee2e2;
    border-radius: 999px;
    padding: .15rem .55rem;
}

/* Interrupt form */
.sb-interrupt { margin-top: .4rem; display: flex; flex-direction: column; gap: .3rem; }

.sb-interrupt-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .76rem;
    color: var(--c-muted);
    cursor: pointer;
    user-select: none;
}
.sb-interrupt-toggle input[type=checkbox] {
    accent-color: var(--c-danger);
    width: 13px; height: 13px;
    cursor: pointer;
}

.sb-interrupt-detail { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }

/* ─── Admin — rôles utilisateur ──────────────────────────────────────────── */
.user-roles { display: flex; flex-direction: column; gap: .3rem; }

.user-role-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    line-height: 1.3;
}

.user-role-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.user-role-type { font-weight: 600; color: #0f172a; white-space: nowrap; }
.user-role-sep { color: #e2e8f0; }
.user-role-scope { color: var(--c-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role-org {
    font-size: .72rem;
    color: #e2e8f0;
    padding-left: .2rem;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-role-org::before { content: '('; }
.user-role-org::after  { content: ')'; }

/* ─── Admin tabs ─────────────────────────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .85rem;
    font-size: .83rem;
    font-weight: 500;
    color: var(--c-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s, border-color .12s;
    white-space: nowrap;
}
.admin-tab:hover { color: #0f172a; }
.admin-tab.is-active { color: #6366f1; border-bottom-color: #6366f1; font-weight: 600; }

.admin-tab-count {
    font-size: .72rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--c-muted);
    line-height: 1.4;
}
.admin-tab-count--green { background: #dcfce7; color: #15803d; }
.admin-tab-count--amber { background: #fef3c7; color: #92400e; }

/* ─── News content (rendu HTML Quill) ───────────────────────────────────── */
.news-content p  { margin-bottom: .3rem; }
.news-content ul,
.news-content ol { padding-left: 1.25rem; margin-bottom: .3rem; }
.news-content p:last-child,
.news-content ul:last-child,
.news-content ol:last-child { margin-bottom: 0; }
.news-content a  { color: var(--bs-link-color); }

/* ─── Mobile overrides (≤ 575px) ────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .page-wrapper { padding-top: 1.25rem; padding-bottom: 2rem; }

    /* Timer: moins de padding, boutons plus petits */
    .timer-row { padding: .7rem .85rem; gap: .5rem; }
    .timer-display { font-size: 1.1rem; min-width: 76px; }
    .timer-bottom-bar { padding: .6rem .85rem; gap: .5rem; }
    .timer-add-free { padding: .55rem .85rem; }
    .timer-separator { padding: .35rem .85rem; }
    .btn-timer { padding: .35rem .55rem; font-size: .75rem; }
    .btn-timer-reset { width: 30px; height: 30px; font-size: .85rem; }
    .btn-timer-assign { width: 26px; height: 26px; }

    /* Admin tabs: masquer la scrollbar tout en gardant le scroll */
    .admin-tabs { scrollbar-width: none; }
    .admin-tabs::-webkit-scrollbar { display: none; }
}
