/* Émargement électronique — feuille de style commune */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --color-bg: #f4f6f9;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; }

/* --- Layout admin --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-brand { font-size: 1.15rem; font-weight: 700; padding: 20px 18px; border-bottom: 1px solid #1f2937; }
.nav-links { list-style: none; margin: 0; padding: 10px 0; flex: 1; }
.nav-links li a {
    display: block;
    padding: 11px 18px;
    color: #cbd5e1;
    font-size: 0.95rem;
}
.nav-links li a:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav-links li a.active { background: var(--color-primary); color: #fff; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid #1f2937; font-size: 0.85rem; }
.admin-name { color: #94a3b8; margin-bottom: 6px; }
.logout-link { color: #f87171; }

.content { flex: 1; padding: 28px 34px; max-width: 1200px; }

/* --- Composants --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h1 { margin: 0; font-size: 1.5rem; }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: #f1f5f9; color: var(--color-text); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--color-success); }
.btn-sm { padding: 5px 10px; font-size: 0.82rem; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 0.92rem; }
th { color: var(--color-text-muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-planifiee { background: #dbeafe; color: #1d4ed8; }
.badge-en_cours { background: #fef3c7; color: #b45309; }
.badge-terminee { background: #dcfce7; color: #15803d; }
.badge-annulee { background: #fee2e2; color: #b91c1c; }
.badge-signed { background: #dcfce7; color: #15803d; }
.badge-unsigned { background: #f1f5f9; color: #64748b; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.88rem; }
.form-group .hint { color: var(--color-text-muted); font-size: 0.8rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=tel], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
}
textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 200px; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 16px; padding: 14px 16px; }
legend { font-weight: 600; padding: 0 6px; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.92rem; }
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.flash-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--color-text-muted); }

.checkbox-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-weight: normal; }
.checkbox-list label:hover { background: #f1f5f9; }

.token-box {
    background: #f8fafc;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    font-family: monospace;
    word-break: break-all;
    font-size: 0.85rem;
}

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 36px; width: 100%; max-width: 380px; }
.login-box h1 { text-align: center; font-size: 1.3rem; margin-bottom: 22px; }

/* --- Borne d'émargement (public) --- */
.borne-body { background: #0f172a; min-height: 100vh; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.borne-wrap { max-width: 760px; margin: 0 auto; padding: 30px 18px 60px; }
.borne-header { text-align: center; color: #fff; margin-bottom: 24px; }
.borne-header h1 { font-size: 1.4rem; margin-bottom: 4px; }
.borne-header p { color: #94a3b8; margin: 2px 0; }
.creneau-block { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.creneau-block h2 { font-size: 1.05rem; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; }
.person-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid var(--color-border);
}
.person-row:last-child { border-bottom: none; }
.person-name { font-weight: 600; }
.sign-modal-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(15,23,42,0.7);
    align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.sign-modal-overlay.open { display: flex; }
.sign-modal {
    background: #fff; border-radius: 12px; padding: 20px; max-width: 520px; width: 100%;
}
.sign-modal h3 { margin-top: 0; }
.sign-canvas-wrap { border: 2px dashed var(--color-border); border-radius: 8px; touch-action: none; }
#signature-pad { width: 100%; height: 220px; display: block; background: #fff; border-radius: 6px; }
.sign-modal-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .content { padding: 18px; }
}
