.page-title {
    font-size: 26px;
    color: var(--navy);
    letter-spacing: -.02em;
}

/* Profile Card */
.profile-header {
    background: linear-gradient(135deg, var(--navy), #2a4a7a) !important;
}

.profile-avatar-wrap {
    width: 90px;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    background-image: url("https://cdn-icons-png.flaticon.com/512/3135/3135715.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 4px solid rgba(255, 255, 255, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.avatar-edit-btn {
    bottom: 2px;
    right: -4px;
    width: 28px;
    height: 28px;
    background: var(--bg);
    border: 2px solid #fff;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    transition: var(--t);
}

.avatar-edit-btn:hover {
    background: var(--gold2);
    transform: scale(1.1);
}

.profile-name {
    font-size: 18px;
}

.profile-role {
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
    letter-spacing: .08em;
}

.profile-info-icon {
    width: 36px;
    height: 36px;
    background: var(--bg);
    font-size: 16px;
}

.profile-info-label {
    font-size: 11px;
    letter-spacing: .06em;
}

.profile-info-value {
    font-size: 14px;
    color: var(--text);
}

/* Stats */
.stat-icon {
    width: 34px;
    height: 34px;
    background: var(--blue-bg);
    font-size: 18px;
}

.stat-value {
    font-size: 22px;
    color: var(--navy);
    letter-spacing: -.02em;
    line-height: 1.05;
}

.stat-label {
    font-size: 12px;
    line-height: 1.2;
}

/* Form */
.form-card-title {
    font-size: 17px;
    color: var(--navy);
}

.form-input {
    padding: 11px 14px;
    border-radius: 10px !important;
    font-size: 14px;
    transition: var(--t);
}

html.dark-mode .form-input.form-control,
html.dark-mode .form-input.form-select,
html.dark-mode .form-input {
    background-color: var(--bg2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html.dark-mode .form-input::placeholder {
    color: var(--text3) !important;
}

html.dark-mode #emailModal > div,
html.dark-mode #pwModal > div {
    background: var(--white) !important;
    color: var(--text) !important;
}

html.dark-mode #emailModal h5,
html.dark-mode #pwModal h5 {
    color: var(--text) !important;
}

.form-input:focus {
    border-color: var(--navy) !important;
    box-shadow: 0 0 0 3px rgba(52, 103, 231, .1) !important;
}

.form-input:disabled {
    background: var(--bg) !important;
    color: var(--text3);
}

.btn-primary {
    background: var(--navy) !important;
    border-color: var(--navy) !important;
    font-weight: 600;
}

.btn-primary:hover {
    background: #2a5ad4 !important;
    border-color: #2a5ad4 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(52, 103, 231, .3);
}

/* Progress */
.progress-title {
    font-size: 17px;
    color: var(--navy);
}

/* Badges */
.badges-title {
    font-size: 17px;
    color: var(--navy);
}

/* Loader centré dans "Mes badges" */
.badges-grid .loader-container.badges-loader{
    padding: 0;
    min-height: 120px;
    width: 100%;
}

.badge-card {
    background: var(--bg);
    border-color: var(--border) !important;
    transition: var(--t);
}

.badge-card.earned {
    border-color: var(--gold) !important;
    background: linear-gradient(160deg, #fff5ed, #fef1e6 80%);
}

.badge-card.locked {
    opacity: .5;
    filter: grayscale(.7);
}

.badge-card.earned:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(247, 149, 54, .2);
}

.badge-name {
    font-size: 13px;
    color: var(--navy);
}

.badge-desc {
    font-size: 11px;
    line-height: 1.4;
}

/* Badges mini (emoji + titre, tooltip au survol/clic) */
.badge-card--mini{
    padding: 10px 10px 12px !important;
    min-height: 88px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor: pointer;
    user-select: none;
    outline: none;
}
.badge-card--mini:focus-visible{
    box-shadow: 0 0 0 3px rgba(52,103,231,.18) !important;
}
.badge-mini{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
    pointer-events:none; /* le clic doit rester sur la card */
}
.badge-mini__icon{
    font-size: 26px;
    line-height: 1;
}
.badge-mini__title{
    font-size: 11px;
    line-height: 1.2;
    color: var(--navy);
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge-tip{
    position:absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    width: min(280px, calc(100vw - 32px));
    background: rgba(15,39,68,.98);
    color:#fff;
    border-radius: 14px;
    padding: 12px 12px;
    box-shadow: 0 16px 42px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 50;
    text-align:left;
}
.badge-tip::before{
    content:'';
    position:absolute;
    bottom:-6px;
    left:50%;
    transform:translateX(-50%) rotate(45deg);
    width:12px;
    height:12px;
    background: rgba(15,39,68,.98);
}
.badge-tip__title{
    font-weight: 800;
    font-size: 12px;
    margin-bottom: 4px;
}
.badge-tip__desc{
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255,255,255,.9);
    margin-bottom: 8px;
}
.badge-tip__date{
    font-size: 11px;
    color: rgba(255,255,255,.75);
}

/* Ouverture au survol (desktop) + au clic/tap (classe tip-open) */
.badge-card--mini:hover .badge-tip{
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.badge-card--mini.tip-open .badge-tip{
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.badge-earned-tag {
    background: var(--gold) !important;
    color: var(--white) !important;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    display: inline-block;
    width: auto;
    line-height: 1.4;
}

.badge-lock {
    font-size: 14px;
}

.badge-new-dot {
    width: 12px;
    height: 12px;
    background: #DC2626;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(220,38,38,.4);
}

/* Mes commentaires */
.my-comment-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: var(--t);
}

.my-comment-item.has-new {
    border-color: #DC2626;
    background: #fff5f5;
}

.my-comment-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.my-comment-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.my-comment-body {
    flex: 1;
    min-width: 0;
}

.my-comment-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 5px;
    line-height: 1.4;
}

.my-comment-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.my-comment-context {
    font-size: 12px;
    color: var(--text3);
}

.my-comment-date {
    font-size: 12px;
    color: var(--text3);
}

.new-reply-dot {
    width: 9px;
    height: 9px;
    background: #DC2626;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.my-comment-replies {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-comment-reply {
    background: var(--bg2);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
}

.my-comment-reply.reply-new {
    border-left: 3px solid #DC2626;
}

.reply-admin-name {
    font-weight: 600;
    color: var(--navy);
    margin-right: 6px;
}

.reply-admin-date {
    font-size: 11px;
    color: var(--text3);
}

.reply-content {
    margin-top: 4px;
    color: var(--text);
    line-height: 1.4;
}

/* Loading */
.card-loading-overlay {
    background: rgba(255, 255, 255, 0.9) !important;
}

/* Skeleton */
.skeleton-dark {
    background: linear-gradient(90deg, rgba(255,255,255,.1) 25%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg2) 25%, #ddd 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Badge ALL_BADGES (Légende) — particles & sparkles (style allbadge.html) ── */
.badge-card--legend {
    border-color: transparent !important;
    animation: legend-border-glow 3s linear infinite;
}

.legend-particles-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}

@keyframes legend-border-glow {
    0%   { box-shadow: 0 0 6px 2px rgba(248,  113, 113, .5); }
    14%  { box-shadow: 0 0 6px 2px rgba(251,  146,  60, .5); }
    28%  { box-shadow: 0 0 6px 2px rgba(250,  204,  21, .5); }
    42%  { box-shadow: 0 0 6px 2px rgba( 74,  222, 128, .5); }
    57%  { box-shadow: 0 0 6px 2px rgba( 56,  189, 248, .5); }
    71%  { box-shadow: 0 0 6px 2px rgba(129,  140, 248, .5); }
    85%  { box-shadow: 0 0 6px 2px rgba(232,  121, 249, .5); }
    100% { box-shadow: 0 0 6px 2px rgba(248,  113, 113, .5); }
}

.legend-inner-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 80%, rgba(251, 191, 36, .08), transparent 60%);
    animation: legend-inner-pulse 4s ease-in-out infinite;
    z-index: 0;
}

.legend-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(251, 191, 36, .9), rgba(249, 115, 22, .4));
    box-shadow: 0 0 6px rgba(251, 191, 36, .6);
    opacity: 0;
    animation-name: legend-particle-rise;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
    animation-duration: var(--dur, 4s);
    animation-delay: var(--delay, 0s);
}

.legend-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(251, 191, 36, .8), 0 0 16px rgba(251, 191, 36, .4);
    opacity: 0;
    animation: legend-sparkle-pop 1.2s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes legend-particle-rise {
    0%   { transform: translate(0, 0) scale(0.5); opacity: 0; }
    10%  { opacity: 1; }
    50%  { transform: translate(var(--dx, 0), -130px) scale(1); opacity: 1; }
    80%  { transform: translate(var(--dx, 0), -220px) scale(0.8); opacity: 0.7; }
    100% { transform: translate(var(--dx, 0), -260px) scale(0); opacity: 0; }
}

@keyframes legend-sparkle-pop {
    0%, 100% { opacity: 0; transform: scale(0); }
    50%      { opacity: 1; transform: scale(1.5); }
}

@keyframes legend-inner-pulse {
    0%, 100% { opacity: .5; }
    50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .legend-particle,
    .legend-sparkle,
    .legend-inner-glow { animation: none !important; opacity: 0 !important; }
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    /* Main padding */
    main.container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .page-title { font-size: 20px; }

    /* Stats : 2 colonnes côte à côte */
    .col-lg-4 .row.d-flex {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        gap: 0 !important;
    }
    .col-lg-4 .row.d-flex > div {
        width: 50% !important;
        padding: 6px !important;
    }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11px; }
}

@media (max-width: 767px) {
    /* Profile card header */
    .profile-header { padding: 20px 16px !important; }
    .profile-avatar { width: 72px; height: 72px; }
    .profile-avatar-wrap { width: 72px; }
    .profile-name { font-size: 16px; }
    .card-body.p-4 { padding: 16px !important; }

    /* Form */
    .form-card-title { font-size: 15px; }
    .form-input { padding: 9px 12px; font-size: 13px; }

    /* Boutons du formulaire : pleine largeur empilés */
    #profileForm .d-flex.gap-3 {
        flex-direction: column;
        gap: 10px !important;
    }
    #profileForm .d-flex.gap-3 .btn { width: 100%; }

    /* Progress & badges */
    .progress-title,
    .badges-title { font-size: 15px; }

    /* Badges : 2 colonnes sur mobile */
    .badges-grid .col-md-6 { width: 50% !important; }
    .badge-mini__icon{ font-size: 24px; }
    .badge-card--mini{ min-height: 84px; }

    /* Commentaires */
    .my-comment-text { font-size: 13px; }
    .my-comment-context { font-size: 11px; }
}