/* ==========================================================================
   EasyHomeo Bodymap - Carte corporelle interactive
   ========================================================================== */

.eh-bodymap {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

/* ---------- Onglets profil ---------- */
.eh-bodymap__tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.eh-bodymap__tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: var(--eh-radius, 12px);
    cursor: pointer;
    font-family: var(--eh-font, 'Inter', sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--eh-text, #212121);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.eh-bodymap__tab:hover {
    border-color: var(--tab-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.eh-bodymap__tab.is-active {
    border-color: var(--tab-color);
    background: color-mix(in srgb, var(--tab-color) 8%, white);
    box-shadow: 0 2px 12px color-mix(in srgb, var(--tab-color) 20%, transparent);
}

.eh-bodymap__tab-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tab-color);
    flex-shrink: 0;
}

/* ---------- SVG Container ---------- */
.eh-bodymap__svg-container {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* ---------- Couleurs profil ---------- */
.eh-bodymap__figure--femme,
.eh-bodymap__card--femme  { --eh-profile-color: #E91E63; }
.eh-bodymap__figure--homme,
.eh-bodymap__card--homme  { --eh-profile-color: #1A237E; }
.eh-bodymap__figure--enfant,
.eh-bodymap__card--enfant { --eh-profile-color: #4CAF50; }

/* ---------- Carte 3D (flip) ---------- */
.eh-bodymap__card {
    perspective: 1200px;
    flex: 0 0 auto;
    max-width: 440px;
    width: 100%;
}

.eh-bodymap__card[hidden] {
    display: none;
}

.eh-bodymap__card-inner {
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.eh-bodymap__card-inner.is-flipped {
    transform: rotateY(180deg);
}

.eh-bodymap__card-front,
.eh-bodymap__card-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    width: 100%;
}

.eh-bodymap__card-front {
    position: relative;
}

.eh-bodymap__card-front svg {
    width: 100%;
    max-width: 340px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.eh-bodymap__card-back {
    transform: rotateY(180deg);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: var(--eh-radius, 12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- Face arriere : header ---------- */
.eh-bodymap__back-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--eh-profile-color);
    color: #fff;
    text-align: left;
}

.eh-bodymap__back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--eh-font, 'Inter', sans-serif);
    transition: background 0.2s;
    flex-shrink: 0;
}

.eh-bodymap__back-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.eh-bodymap__back-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

/* ---------- Face arriere : contenu ---------- */
.eh-bodymap__back-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    text-align: left;
}

.eh-bodymap__loading {
    text-align: center;
    color: #999;
    padding: 2rem 0;
}

/* ---------- Cercles animes (zone-dot) ---------- */
.eh-bodymap__card-front a.zone-dot {
    cursor: pointer;
    text-decoration: none;
}

.zone-center {
    fill: var(--eh-profile-color);
    filter: drop-shadow(0 0 3px var(--eh-profile-color));
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.zone-ripple {
    fill: var(--eh-profile-color);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: eh-ripple-expand 2.4s ease-out infinite;
}

@keyframes eh-ripple-expand {
    0%   { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(2); opacity: 0; }
}

/* Cascade temporelle tete -> pieds */
.eh-bodymap__card-front a:nth-of-type(1) .zone-ripple  { animation-delay: 0s; }
.eh-bodymap__card-front a:nth-of-type(2) .zone-ripple  { animation-delay: 0.2s; }
.eh-bodymap__card-front a:nth-of-type(3) .zone-ripple  { animation-delay: 0.4s; }
.eh-bodymap__card-front a:nth-of-type(4) .zone-ripple  { animation-delay: 0.6s; }
.eh-bodymap__card-front a:nth-of-type(5) .zone-ripple  { animation-delay: 0.8s; }
.eh-bodymap__card-front a:nth-of-type(6) .zone-ripple  { animation-delay: 1.0s; }
.eh-bodymap__card-front a:nth-of-type(7) .zone-ripple  { animation-delay: 1.2s; }
.eh-bodymap__card-front a:nth-of-type(8) .zone-ripple  { animation-delay: 1.4s; }
.eh-bodymap__card-front a:nth-of-type(9) .zone-ripple  { animation-delay: 1.6s; }
.eh-bodymap__card-front a:nth-of-type(10) .zone-ripple { animation-delay: 1.8s; }
.eh-bodymap__card-front a:nth-of-type(11) .zone-ripple { animation-delay: 2.0s; }


/* Labels — infobulles au survol (technique paint-order) */
.eh-bodymap__card-front .zone-label {
    font-size: 10px;
    font-weight: 600;
    fill: #fff;
    stroke: rgba(33, 33, 33, 0.88);
    stroke-width: 7px;
    paint-order: stroke;
    stroke-linejoin: round;
    font-family: var(--eh-font, 'Inter', sans-serif);
    pointer-events: none;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Hover : cercle grandit + infobulle visible */
.eh-bodymap__card-front a.zone-dot:hover .zone-center,
.eh-bodymap__card-front a.zone-dot:focus .zone-center {
    transform: scale(1.5);
    filter: drop-shadow(0 0 6px var(--eh-profile-color));
}

.eh-bodymap__card-front a.zone-dot:hover .zone-label,
.eh-bodymap__card-front a.zone-dot:focus .zone-label {
    opacity: 1;
    transform: translateY(0);
}

/* Zone active (apres clic) */
.eh-bodymap__card-front a.zone-dot.is-active .zone-center {
    transform: scale(1.6);
    filter: drop-shadow(0 0 8px var(--eh-profile-color));
}

.eh-bodymap__card-front a.zone-dot.is-active .zone-ripple {
    animation: none;
    opacity: 0;
}

/* ---------- Listes d'affections (face arriere) ---------- */
.eh-bodymap__ailment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.eh-bodymap__ailment-item {
    border-bottom: 1px solid #f0f0f0;
}

.eh-bodymap__ailment-item:last-child {
    border-bottom: none;
}

.eh-bodymap__ailment-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    text-decoration: none;
    color: var(--eh-text, #212121);
    transition: color 0.2s;
}

.eh-bodymap__ailment-link:hover {
    color: var(--eh-primary, #2E7D32);
}

.eh-bodymap__ailment-count {
    font-size: 0.8rem;
    color: #999;
    white-space: nowrap;
}

.eh-bodymap__med-list {
    list-style: none;
    padding: 0;
}

.eh-bodymap__med-list li {
    padding: 0.375rem 0;
}

.eh-bodymap__med-list a {
    text-decoration: none;
    color: var(--eh-primary, #2E7D32);
}

/* ---------- Version mobile - liste ---------- */
.eh-bodymap__zone-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.eh-bodymap__zone-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.875rem;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: var(--eh-radius, 12px);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-align: left;
}

.eh-bodymap__zone-btn:hover,
.eh-bodymap__zone-btn:focus {
    border-color: var(--zone-color, var(--eh-primary, #2E7D32));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.eh-bodymap__zone-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--zone-color, #2E7D32) 15%, white);
    color: var(--zone-color, var(--eh-primary, #2E7D32));
    font-size: 1rem;
}

.eh-bodymap__zone-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--eh-text, #212121);
}

.eh-bodymap__zone-badge {
    flex-shrink: 0;
    background: var(--zone-color, var(--eh-primary, #2E7D32));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    min-width: 1.5rem;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .eh-bodymap__tabs {
        gap: 0.25rem;
    }

    .eh-bodymap__tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .eh-bodymap__zone-list {
        grid-template-columns: 1fr;
    }
}

/* ---------- Mode sombre ---------- */
[data-theme="dark"] .eh-bodymap__tab {
    background: var(--eh-surface, #1E293B);
    border-color: var(--eh-border, #334155);
    color: var(--eh-text, #F1F5F9);
}

[data-theme="dark"] .eh-bodymap__tab.is-active {
    background: color-mix(in srgb, var(--tab-color) 15%, var(--eh-surface, #1E293B));
}

[data-theme="dark"] .eh-bodymap__card-back {
    background: var(--eh-surface, #1E293B);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .eh-bodymap__ailment-item {
    border-bottom-color: var(--eh-border-light, #2D3748);
}

[data-theme="dark"] .eh-bodymap__ailment-count,
[data-theme="dark"] .eh-bodymap__loading {
    color: var(--eh-text-muted, #94A3B8);
}

[data-theme="dark"] .eh-bodymap__zone-btn {
    background: var(--eh-surface, #1E293B);
    border-color: var(--eh-border, #334155);
}

[data-theme="dark"] .eh-bodymap__zone-icon {
    background: color-mix(in srgb, var(--zone-color, #2E7D32) 20%, var(--eh-surface, #1E293B));
}

[data-theme="dark"] .eh-bodymap__zone-name {
    color: var(--eh-text, #F1F5F9);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .eh-bodymap__tab {
        background: var(--eh-surface, #1E293B);
        border-color: var(--eh-border, #334155);
        color: var(--eh-text, #F1F5F9);
    }
    :root:not([data-theme="light"]) .eh-bodymap__tab.is-active {
        background: color-mix(in srgb, var(--tab-color) 15%, var(--eh-surface, #1E293B));
    }
    :root:not([data-theme="light"]) .eh-bodymap__card-back {
        background: var(--eh-surface, #1E293B);
    }
    :root:not([data-theme="light"]) .eh-bodymap__ailment-item {
        border-bottom-color: var(--eh-border-light, #2D3748);
    }
    :root:not([data-theme="light"]) .eh-bodymap__zone-btn {
        background: var(--eh-surface, #1E293B);
        border-color: var(--eh-border, #334155);
    }
    :root:not([data-theme="light"]) .eh-bodymap__zone-icon {
        background: color-mix(in srgb, var(--zone-color, #2E7D32) 20%, var(--eh-surface, #1E293B));
    }
    :root:not([data-theme="light"]) .eh-bodymap__zone-name {
        color: var(--eh-text, #F1F5F9);
    }
}
