/* ================================================================
   AEM UX Quick Wins — Styles
   Hérite des variables CSS définies dans aem-carte.css (:root)
   ================================================================ */

/* ----------------------------------------------------------------
   Variables de fallback si aem-carte.css n'est pas chargé
   ---------------------------------------------------------------- */
:root {
    --aem-primary: var(--aem-primary, #ba0031);
    --aem-accent:  var(--aem-accent,  #e31e44);
    --aem-border:  var(--aem-border,  #e8eaed);
    --aem-radius:  var(--aem-radius,  10px);
    --aem-text:    var(--aem-text,    #1a1c1c);
    --aem-text-muted: var(--aem-text-muted, #666);
    --aem-bg-light:   var(--aem-bg-light,   #fdf2f4);
}

/* ----------------------------------------------------------------
   Barre de progression de lecture
   ---------------------------------------------------------------- */
#aem-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: #e31e44;
    z-index: 10000;
    transition: width 0.1s linear;
    pointer-events: none;
    /* Empêche tout CLS */
    transform: translateZ(0);
}

/* ----------------------------------------------------------------
   CTA flottant mobile — base commune
   ---------------------------------------------------------------- */
.aem-floating-cta {
    display: none;
    position: fixed;
    bottom: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

@media (max-width: 768px) {
    .aem-floating-cta {
        display: block;
    }

    body {
        padding-bottom: 80px;
    }
}

/* CTA recherche — version sobre */
.aem-floating-cta:not(.aem-floating-cta--rappel) a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: #ba0031;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(186, 0, 49, 0.40);
    white-space: nowrap;
    min-height: 44px;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.aem-floating-cta:not(.aem-floating-cta--rappel) a:hover,
.aem-floating-cta:not(.aem-floating-cta--rappel) a:focus {
    background: #9a0028;
    box-shadow: 0 6px 28px rgba(186, 0, 49, 0.55);
    transform: translateX(-50%) translateY(-2px);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.aem-floating-cta:not(.aem-floating-cta--rappel) a svg {
    flex-shrink: 0;
}

/* ----------------------------------------------------------------
   CTA "Être rappelé" — fiches auto-école
   Design : urgence éditoriale, gradient, animation téléphone
   ---------------------------------------------------------------- */
@keyframes aem-slide-up {
    from {
        transform: translateX(-50%) translateY(72px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes aem-ring-pulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    55%  { transform: scale(1.6); opacity: 0;   }
    100% { transform: scale(1.6); opacity: 0;   }
}

@keyframes aem-phone-ring {
    0%, 100% { transform: rotate(0deg); }
    10%       { transform: rotate(-18deg); }
    20%       { transform: rotate(18deg); }
    30%       { transform: rotate(-12deg); }
    40%       { transform: rotate(12deg); }
    50%       { transform: rotate(0deg); }
}

.aem-floating-cta--rappel {
    /* Entrée slide-up au chargement */
    animation: aem-slide-up 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.aem-rappel-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 22px 12px 14px;
    background: linear-gradient(135deg, #ba0031 0%, #e31e44 100%);
    color: #fff;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
    border-radius: 50px;
    text-decoration: none;
    /* Bordure translucide pour donner de la profondeur */
    border: 1px solid rgba(255, 255, 255, 0.22);
    /* Ombre colorée forte */
    box-shadow:
        0 8px 32px rgba(186, 0, 49, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    min-height: 52px;
    transition: box-shadow 0.25s, transform 0.2s;
}

.aem-rappel-btn:hover,
.aem-rappel-btn:focus {
    box-shadow:
        0 12px 40px rgba(186, 0, 49, 0.65),
        0 4px 12px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateX(-50%) translateY(-3px);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

/* Icône téléphone dans un cercle */
.aem-rappel-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Anneau pulsé autour de l'icône */
.aem-rappel-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    animation: aem-ring-pulse 2.8s ease-out infinite;
}

/* Le SVG sonne */
.aem-rappel-icon svg {
    animation: aem-phone-ring 3.5s ease-in-out infinite;
    transform-origin: center;
    flex-shrink: 0;
}

/* Deux lignes de texte */
.aem-rappel-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aem-rappel-main {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #fff;
}

.aem-rappel-sub {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.80);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ----------------------------------------------------------------
   Widget "Articles similaires" (fiches auto-école)
   ---------------------------------------------------------------- */
.aem-articles-similaires {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid #e8eaed;
}

.aem-articles-similaires h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 1.25rem;
    color: #1a1c1c;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
}

.aem-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .aem-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .aem-articles-grid {
        grid-template-columns: 1fr;
    }
}

.aem-article-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.aem-article-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.aem-article-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.aem-article-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.aem-article-card-body h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1c1c;
}

.aem-article-card-body h4 a {
    color: inherit;
    text-decoration: none;
}

.aem-article-card-body h4 a:hover {
    color: #ba0031;
}

.aem-article-card-link {
    display: inline-block;
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    color: #ba0031;
    text-decoration: none;
}

.aem-article-card-link:hover {
    text-decoration: underline;
}

/* ----------------------------------------------------------------
   Encart "S'abonner" — articles du blog
   ---------------------------------------------------------------- */
.aem-abonnement {
    margin: 3rem 0 2rem;
    padding: 2rem 2.25rem;
    background: linear-gradient(135deg, #fdf2f4 0%, #fff6f8 100%);
    border: 1.5px solid rgba(186, 0, 49, 0.18);
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(186, 0, 49, 0.07);
}

.aem-abonnement-inner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 1.25rem;
}

.aem-abonnement-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: #ba0031;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(186, 0, 49, 0.30);
}

.aem-abonnement-title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
    color: #1a1c1c;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
}

.aem-abonnement-desc {
    margin: 0;
    font-size: 14px;
    color: #555;
    line-height: 1.55;
}

.aem-abonnement-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aem-abonnement-fields {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aem-abonnement-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid #d8dade;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1c1c;
    background: #fff;
    min-height: 48px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.aem-abonnement-input::placeholder {
    color: #aaa;
}

.aem-abonnement-input:focus {
    border-color: #ba0031;
    box-shadow: 0 0 0 3px rgba(186, 0, 49, 0.12);
}

.aem-abonnement-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 24px;
    background: #ba0031;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
    border: none;
    border-radius: 10px;
    min-height: 48px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 3px 12px rgba(186, 0, 49, 0.32);
}

.aem-abonnement-btn:hover,
.aem-abonnement-btn:focus-visible {
    background: #9a0028;
    box-shadow: 0 5px 18px rgba(186, 0, 49, 0.42);
    transform: translateY(-1px);
    outline: 2px solid #9a0028;
    outline-offset: 2px;
}

.aem-abonnement-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Spinner de chargement */
.aem-abonnement-btn-loading {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aem-spin 0.7s linear infinite;
}

.aem-abonnement-btn.is-loading .aem-abonnement-btn-label {
    display: none;
}

.aem-abonnement-btn.is-loading .aem-abonnement-btn-loading {
    display: block;
}

@keyframes aem-spin {
    to { transform: rotate(360deg); }
}

.aem-abonnement-legal {
    margin: 0;
    font-size: 12px;
    color: #999;
}

/* Messages de feedback */
.aem-abonnement-feedback {
    font-size: 14px;
    font-weight: 600;
    min-height: 0;
}

.aem-abonnement-feedback.is-success {
    color: #1a7a3f;
}

.aem-abonnement-feedback.is-error {
    color: #ba0031;
}

@media (max-width: 600px) {
    .aem-abonnement {
        padding: 1.5rem 1.25rem;
    }

    .aem-abonnement-inner {
        flex-direction: column;
        gap: 12px;
    }

    .aem-abonnement-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .aem-abonnement-btn {
        width: 100%;
    }

    .aem-abonnement-title {
        font-size: 17px;
    }
}

/* ----------------------------------------------------------------
   Shortcode [aem_guides_populaires]
   ---------------------------------------------------------------- */
.aem-guides-wrap {
    margin: 2rem 0;
}

.aem-guides-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .aem-guides-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .aem-guides-grid {
        grid-template-columns: 1fr;
    }
}

.aem-guide-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.aem-guide-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

.aem-guide-card-img {
    display: block;
    overflow: hidden;
}

.aem-guide-card-img img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.aem-guide-card:hover .aem-guide-card-img img {
    transform: scale(1.03);
}

.aem-guide-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.aem-guide-card-body h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1c1c;
    font-family: 'Plus Jakarta Sans', 'Poppins', -apple-system, sans-serif;
}

.aem-guide-card-body h3 a {
    color: inherit;
    text-decoration: none;
}

.aem-guide-card-body h3 a:hover {
    color: #ba0031;
}

.aem-guide-card-body p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    flex: 1;
}

.aem-guide-card-cta {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    padding: 10px 16px;
    background: #ba0031;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    justify-content: center;
    min-height: 40px;
    transition: background 0.2s;
}

.aem-guide-card-cta:hover {
    background: #9a0028;
    color: #fff;
}
