/*
 * Redirects Checker : styles scopes sous .rdc.
 * Reimplemente le sous-ensemble Bootstrap utilise (grille, onglets, collapse,
 * formulaires, boutons, table, badges, utilitaires) + composants specifiques,
 * aux couleurs de la charte. Le theme ne charge pas Bootstrap framework.
 */

.rdc { color: var(--text-primary); }
.rdc *, .rdc *::before, .rdc *::after { box-sizing: border-box; }

/* Titres de section (liseré doré, signature charte) */
.rdc .rdc-section-titre {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 0.5rem;
    margin: 0 0 1rem;
    border-bottom: 2.5px solid var(--brand-gold);
}
.rdc .rdc-section-titre > .bi:first-child { color: var(--brand-teal); }

/* Grille */
.rdc .row { display: flex; flex-wrap: wrap; gap: 1rem; }
.rdc .row.g-2 { gap: 0.5rem; }
.rdc .row.g-3 { gap: 1rem; }
.rdc .col { flex: 1 1 0; min-width: 0; }
.rdc .col-auto { flex: 0 0 auto; }
.rdc .col-sm-4 { flex: 1 1 200px; }
.rdc .col-sm-6 { flex: 1 1 260px; }
.rdc .col-md-3 { flex: 1 1 180px; }
.rdc .col-md-4 { flex: 1 1 220px; }

/* Onglets */
.rdc .nav-tabs { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; border-bottom: 2px solid var(--border-color); flex-wrap: wrap; }
.rdc .nav-item { list-style: none; }
.rdc .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    border-radius: 6px 6px 0 0;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s;
}
.rdc .nav-link:hover { color: var(--brand-dark); border-bottom-color: var(--brand-teal-light); }
.rdc .nav-link.active { color: var(--brand-dark); font-weight: 600; border-bottom-color: var(--brand-teal); }
.rdc .tab-pane { display: none; }
.rdc .tab-pane.active { display: block; }
.rdc .collapse { display: none; }
.rdc .collapse.show { display: block; }

/* Formulaires */
.rdc .form-label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.rdc .form-control, .rdc .form-select {
    display: block; width: 100%;
    padding: 0.45rem 0.7rem; font-size: 14px;
    color: var(--text-primary); background: #fff;
    border: 1px solid var(--border-color); border-radius: 4px;
    font-family: inherit;
}
.rdc .form-control-sm, .rdc .form-select-sm { padding: 0.25rem 0.5rem; font-size: 13px; width: auto; }
.rdc .form-control:focus, .rdc .form-select:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 0.2rem rgba(102,178,178,0.25); }
.rdc .form-text { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.rdc .form-check { display: flex; align-items: center; gap: 0.4rem; }
.rdc .form-check-input { width: 1rem; height: 1rem; margin: 0; }
.rdc .form-check-label { font-size: 0.85rem; }
.rdc textarea.form-control { min-height: 160px; resize: vertical; }
.rdc .font-mono, .rdc .font-monospace { font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace; font-size: 13px; }

/* Boutons */
.rdc .btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: 600;
    border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; font-family: inherit; text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.rdc .btn:disabled { opacity: 0.6; cursor: default; }
.rdc .btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.rdc .btn-primary { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.rdc .btn-primary:hover { background: #006666; border-color: #006666; }
.rdc .btn-outline-secondary { background: #fff; border-color: var(--border-color); color: var(--text-secondary); }
.rdc .btn-outline-secondary:hover { border-color: var(--brand-dark); color: var(--brand-dark); }
.rdc .btn-outline-secondary.active { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.rdc .btn-outline-primary { background: #fff; border-color: var(--brand-teal); color: var(--brand-dark); }
.rdc .btn-outline-primary:hover, .rdc .btn-outline-primary.active { background: var(--brand-teal-light); }
.rdc .btn-outline-warning { background: #fff; border-color: var(--brand-gold); color: #9a6b00; }
.rdc .btn-outline-warning:hover, .rdc .btn-outline-warning.active { background: var(--brand-gold-light); }
.rdc .btn-outline-danger { background: #fff; border-color: #dc3545; color: #dc3545; }
.rdc .btn-outline-danger:hover, .rdc .btn-outline-danger.active { background: #dc3545; color: #fff; }
.rdc .btn-outline-success { background: #fff; border-color: #198754; color: #198754; }
.rdc .btn-outline-success:hover { background: #198754; color: #fff; }

/* Spinner */
.rdc .spinner-border { display: inline-block; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rdc-spin 0.7s linear infinite; vertical-align: -0.125em; }
@keyframes rdc-spin { to { transform: rotate(360deg); } }

/* Table */
.rdc .table-responsive { overflow-x: auto; }
.rdc .table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rdc .table thead th { background: rgb(241, 245, 249); color: var(--text-primary); text-align: left; font-weight: 600; }
.rdc .table th, .rdc .table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.rdc .table.table-sm th, .rdc .table.table-sm td { padding: 0.4rem 0.6rem; }
.rdc .table.table-hover tbody tr:hover { background: var(--brand-teal-light); }
.rdc .sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.rdc .sortable-th:hover { color: var(--brand-dark); }

/* Badges */
.rdc .badge { display: inline-block; padding: 0.35em 0.6em; font-size: 0.72rem; font-weight: 600; line-height: 1; border-radius: 4px; }
.rdc .bg-secondary { background: #64748b; color: #fff; }
.rdc .bg-danger { background: #dc3545; color: #fff; }
.rdc .bg-warning { background: var(--brand-gold); color: #3a2a00; }
.rdc .bg-info { background: var(--brand-teal); color: #fff; }
.rdc .badge-chaine { background: var(--brand-gold-light); color: #9a6b00; border: 1px solid var(--brand-gold); }
.rdc .badge-boucle { background: #fdecea; color: #b02a37; border: 1px solid #dc3545; }
.rdc .badge-auto { background: var(--brand-teal-light); color: var(--brand-dark); border: 1px solid var(--brand-teal); }

/* KPI */
.rdc .kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.rdc .kpi-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: 1rem;
    padding: 1.1rem 1.25rem; text-align: center;
    box-shadow: rgba(0,76,76,0.06) 0px 2px 8px, rgba(0,0,0,0.04) 0px 1px 3px;
}
.rdc .kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--brand-dark); }
.rdc .kpi-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.3rem; }
.rdc .kpi-dark .kpi-value { color: var(--brand-dark); }
.rdc .kpi-gold .kpi-value { color: #c8860a; }
.rdc .kpi-red .kpi-value { color: #dc3545; }
.rdc .kpi-green .kpi-value { color: #198754; }

/* Affichage d'une chaine de redirections */
.rdc .chaine-fleche { color: var(--text-muted); margin: 0 0.3rem; }
.rdc .chaine-url { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.82rem; }
.rdc .chaine-finale { color: #198754; font-weight: 600; }
.rdc .url-copiable { cursor: pointer; border-bottom: 1px dotted var(--border-color); }
.rdc .url-copiable:hover { color: var(--brand-dark); border-bottom-color: var(--brand-teal); }
.rdc .correction-cellule { color: #198754; font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.82rem; }

/* Message de statut */
.rdc .status-msg { padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.9rem; }
.rdc .status-msg.loading { background: var(--brand-teal-light); color: var(--brand-dark); }
.rdc .status-msg.success { background: #e8f6ee; color: #15663f; }
.rdc .status-msg.error { background: #fdecea; color: #b02a37; }

/* Liste d'avertissements */
.rdc .avertissements-liste { margin: 0; padding-left: 1.2rem; font-size: 0.85rem; color: #9a6b00; }
.rdc .avertissements-liste li { margin-bottom: 0.3rem; }

/* Pagination */
.rdc .pagination-barre { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 0; }
.rdc .pagination-boutons { display: flex; gap: 0.25rem; flex-wrap: wrap; }

/* Utilitaires */
.rdc .d-flex { display: flex; }
.rdc .d-none { display: none; }
.rdc .d-block { display: block; }
.rdc .flex-wrap { flex-wrap: wrap; }
.rdc .justify-content-between { justify-content: space-between; }
.rdc .align-items-center { align-items: center; }
.rdc .align-items-end { align-items: flex-end; }
.rdc .gap-1 { gap: 0.25rem; }
.rdc .gap-2 { gap: 0.5rem; }
.rdc .gap-3 { gap: 1rem; }
.rdc .mb-0 { margin-bottom: 0; }
.rdc .mb-1 { margin-bottom: 0.25rem; }
.rdc .mb-2 { margin-bottom: 0.5rem; }
.rdc .mb-3 { margin-bottom: 1rem; }
.rdc .mt-2 { margin-top: 0.5rem; }
.rdc .ms-auto { margin-left: auto; }
.rdc .text-muted { color: var(--text-muted); }
.rdc .text-success { color: #198754; }
.rdc .text-danger { color: #dc3545; }
.rdc .small { font-size: 0.82rem; }
.rdc .fw-semibold { font-weight: 600; }
.rdc .w-100 { width: 100%; }

/* Dark mode : aplats clairs rejoues */
[data-theme="dark"] .rdc .form-control, [data-theme="dark"] .rdc .form-select { background: #1f2937; color: var(--text-primary); }
[data-theme="dark"] .rdc .table thead th { background: rgba(102,178,178,0.12); }
[data-theme="dark"] .rdc .kpi-card { background: #1f2937; }
[data-theme="dark"] .rdc .btn-outline-secondary, [data-theme="dark"] .rdc .btn-outline-primary { background: #1f2937; }
[data-theme="dark"] .rdc .table.table-hover tbody tr:hover { background: rgba(102,178,178,0.12); }

@media (max-width: 640px) {
    .rdc .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
