/**
 * Sources Médicales — Style frontend
 * Design médical bleu professionnel — accordéon repliable
 */

.sm-sources-block {
    --sm-blue-primary: #0B5FA5;
    --sm-blue-deep: #073D6B;
    --sm-blue-bright: #1E88E5;
    --sm-blue-light: #E3F2FD;
    --sm-blue-pale: #F0F7FC;
    --sm-blue-accent: #00A8E8;
    --sm-text-dark: #1A2942;
    --sm-text-medium: #4A5A7A;
    --sm-border: #D6E4F2;
    --sm-shadow: 0 4px 14px rgba(11, 95, 165, 0.10);
    --sm-shadow-hover: 0 8px 24px rgba(11, 95, 165, 0.18);

    margin: 3em 0 2em 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--sm-shadow);
    transition: box-shadow 0.3s ease;
    border: 1px solid var(--sm-border);
}

.sm-sources-block:hover {
    box-shadow: var(--sm-shadow-hover);
}

/* === Bouton toggle (en-tête de l'accordéon) === */
.sm-sources-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--sm-blue-primary) 0%, var(--sm-blue-deep) 100%);
    border: none;
    cursor: pointer;
    text-align: left;
    color: #ffffff;
    transition: background 0.3s ease, transform 0.2s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.sm-sources-toggle::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--sm-blue-accent);
}

.sm-sources-toggle:hover {
    background: linear-gradient(135deg, #0d6cb8 0%, #0a4a82 100%);
}

.sm-sources-toggle:focus {
    outline: 2px solid var(--sm-blue-accent);
    outline-offset: -2px;
}

.sm-sources-icon-left {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.sm-sources-icon-left svg {
    color: #ffffff;
}

.sm-sources-toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.3;
}

.sm-sources-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #ffffff;
}

.sm-sources-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.1px;
}

.sm-sources-icon-right {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.3s ease, background 0.3s ease;
    color: #ffffff;
}

.sm-sources-toggle[aria-expanded="true"] .sm-sources-icon-right {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.25);
}

/* === Contenu de l'accordéon === */
.sm-sources-content {
    background: #ffffff;
    padding: 0;
    animation: sm-slide-down 0.4s ease;
}

.sm-sources-content[hidden] {
    display: none;
}

@keyframes sm-slide-down {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Liste des sources === */
.sm-sources-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    counter-reset: none;
}

.sm-source-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 22px;
    border-bottom: 1px solid var(--sm-border);
    transition: background 0.2s ease;
    margin: 0;
}

.sm-source-item:last-child {
    border-bottom: none;
}

.sm-source-item:hover {
    background: var(--sm-blue-pale);
}

/* === Badge numéroté === */
.sm-source-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--sm-blue-bright) 0%, var(--sm-blue-primary) 100%);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(30, 136, 229, 0.3);
    margin-top: 2px;
}

/* === Contenu de la source === */
.sm-source-content {
    flex: 1;
    line-height: 1.55;
    font-size: 15px;
    color: var(--sm-text-dark);
    min-width: 0;
}

.sm-source-link {
    color: var(--sm-text-dark);
    text-decoration: none;
    display: inline;
    transition: color 0.2s ease;
    border-bottom: 1px solid transparent;
}

.sm-source-link:hover,
.sm-source-link:focus {
    color: var(--sm-blue-primary);
    text-decoration: none;
}

.sm-source-link:hover .sm-source-journal,
.sm-source-link:focus .sm-source-journal {
    color: var(--sm-blue-primary);
    text-decoration: underline;
}

.sm-source-journal {
    font-weight: 700;
    color: var(--sm-blue-deep);
    transition: color 0.2s ease;
}

.sm-source-year {
    font-weight: 500;
    color: var(--sm-text-medium);
    font-size: 14px;
}

.sm-source-title {
    color: var(--sm-text-medium);
    font-weight: 400;
}

.sm-source-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--sm-blue-light);
    color: var(--sm-blue-primary);
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sm-source-link:hover .sm-source-arrow {
    background: var(--sm-blue-primary);
    color: #ffffff;
    transform: translate(2px, -2px);
}

/* === Footer (note de validation) === */
.sm-sources-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: var(--sm-blue-pale);
    color: var(--sm-text-medium);
    font-size: 13px;
    font-style: italic;
    border-top: 1px solid var(--sm-border);
}

.sm-sources-footer svg {
    flex-shrink: 0;
    color: var(--sm-blue-primary);
}

/* === Responsive mobile === */
@media (max-width: 600px) {
    .sm-sources-toggle {
        padding: 14px 16px;
        gap: 12px;
    }

    .sm-sources-icon-left {
        width: 38px;
        height: 38px;
    }

    .sm-sources-icon-left svg {
        width: 18px;
        height: 18px;
    }

    .sm-sources-title {
        font-size: 15px;
    }

    .sm-sources-subtitle {
        font-size: 12px;
    }

    .sm-sources-icon-right {
        width: 30px;
        height: 30px;
    }

    .sm-source-item {
        padding: 12px 16px;
        gap: 12px;
    }

    .sm-source-badge {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .sm-source-content {
        font-size: 14px;
    }

    .sm-sources-footer {
        padding: 12px 16px;
        font-size: 12px;
    }
}

/* === Mode sombre (optionnel — s'adapte si le thème le supporte) === */
@media (prefers-color-scheme: dark) {
    .sm-sources-block {
        --sm-text-dark: #E8EEF7;
        --sm-text-medium: #A6B5CC;
        --sm-blue-pale: #0F1F35;
        --sm-blue-light: #1A2D4A;
        --sm-border: #1F3550;
    }

    .sm-sources-content {
        background: #0A1628;
    }
}
