/* ═══════════════════════════════════════════════════════
   FS94B1 DMR — Composants (cartes, badges, tables, boutons)
   ═══════════════════════════════════════════════════════ */

/* ─── Cartes ─── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 18px;
}

.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Cartes stats ─── */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.stat-card.parrot::before {
  background: linear-gradient(90deg, var(--parrot), transparent);
}

.stat-card.success::before {
  background: linear-gradient(90deg, var(--success), transparent);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--bg-tertiary);
  color: var(--text-dim);
}

.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge.err {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

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

.badge.parrot {
  background: rgba(124, 58, 237, 0.15);
  color: var(--parrot);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.no-dot::before { display: none; }

/* ─── Boutons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* ─── Champs input ─── */
.input, select.input, textarea.input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ─── Tables ─── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--bg-tertiary);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Badges département ─── */
.dept-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

/* ─── Toasts ─── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: 360px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: slideIn 220ms ease;
  font-size: 13px;
}

.toast.success { border-left-color: var(--success); }
.toast.warn    { border-left-color: var(--warning); }
.toast.err     { border-left-color: var(--danger); }
.toast.parrot  { border-left-color: var(--parrot); }

.toast strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.toast .toast-msg {
  color: var(--text-dim);
  font-size: 12px;
}

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─── Indicateurs ─── */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.dot.ok {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.dot.warn {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

.dot.err {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* ─── Séparateurs ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ─── Empty state ─── */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.empty-icon {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 8px;
}

/* ─── Section colorée par TG ─── */
.tg-section {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin-bottom: 20px;
}

.tg-section.tg9    { border-left-color: var(--accent); }
.tg-section.tg38   { border-left-color: var(--success); }
.tg-section.tg39   { border-left-color: var(--warning); }
.tg-section.tg9990 { border-left-color: var(--parrot); }

/* ═══════════════════════════════════════════════════════
   Tooltip personnalisé (pour les lignes Last Heard)
   ═══════════════════════════════════════════════════════ */

[data-tooltip] {
  position: relative;
}

.custom-tooltip {
  position: fixed;
  background: var(--bg-tertiary);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  z-index: 3000;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.custom-tooltip::before {
  content: '👆';
  font-size: 14px;
}

/* ===================== SECTION EN DIRECT (LIVE) ===================== */
#live-section {
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease;
}

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

.live-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

#live-duree {
    min-width: 60px;
    text-align: right;
    animation: blink-duree 1s infinite;
}

@keyframes blink-duree {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}
/* =================== FIN SECTION EN DIRECT =================== */

/* ── Menu utilisateur (topbar) ─────────────────────── */
.user-menu {
    position: relative;
    margin-left: 12px;
}
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.user-menu-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}
.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}
.user-menu-dropdown.open {
    display: block;
}
.user-menu-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-menu-header strong { font-size: 14px; }
.user-menu-header small { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.user-menu-section {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.user-menu-section:last-child { border-bottom: none; }
.user-menu-label {
    padding: 6px 16px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.user-menu-item {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}
.user-menu-item:hover { background: var(--bg-tertiary); }
.user-menu-item.active { color: var(--accent); font-weight: 600; }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: rgba(239,68,68,0.1); }


/* ── Header Public (mode visiteur) ─────────────────── */
.public-header {
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}
.public-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.public-header-logo {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.public-header-logo img {
    display: block !important;
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 0 20px var(--accent-dim);
}
.public-header-text h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.public-header-text small {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
@media (max-width: 700px) {
    .public-header {
        padding: 14px 16px;
        gap: 12px;
    }
    .public-header-logo,
    .public-header-logo img {
        width: 44px !important;
        height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
    }
    .public-header-text h1 { font-size: 18px; }
}
