/* ─────────────────────────────────────
   ADCOM + Doctolib v1.1.0 — Front CSS
   Inline block + Off-canvas panel
───────────────────────────────────── */

/* ══════════════════════════════════
   BLOC INLINE
══════════════════════════════════ */
.adcd-block {
    --adcd-color: #0596DE;
    --adcd-offset: 0px;
    width: 100%;
    margin-bottom: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/*
 * Le clip masque le header Doctolib :
 * overflow:hidden + height calculée = (height iframe) - offset
 * L'iframe est décalée de -offset via margin-top inline
 */
.adcd-iframe-clip {
    width: 100%;
    overflow: hidden;   /* coupe la bande bleue Doctolib */
    border-radius: 8px;
    border: 1.5px solid rgba(0,0,0,.08);
    /* La hauteur visible sera gérée dynamiquement par JS */
    position: relative;
}

/* Spinner de chargement */
.adcd-iframe-clip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #f5f7fa
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%230596DE' stroke-width='3' stroke-dasharray='80' stroke-dashoffset='60'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.9s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E")
        center / 36px no-repeat;
    z-index: 1;
    transition: opacity .4s ease;
    pointer-events: none;
    border-radius: 8px;
}
.adcd-iframe-clip.adcd-loaded::before { opacity: 0; }

.adcd-iframe {
    width: 100%;
    display: block;
    border: none;
    /* margin-top négatif et height ajoutée sont définis en inline style */
}


/* ══════════════════════════════════
   OVERLAY
══════════════════════════════════ */
.adcd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 45, 0.55);
    z-index: 99998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .3s ease;
    cursor: pointer;
}
.adcd-overlay.is-visible {
    display: block;
    opacity: 1;
}


/* ══════════════════════════════════
   PANNEAU OFF-CANVAS
   Architecture :
   .adcd-panel (fixed, flex col)
     └ .adcd-panel-topbar (bouton fermer flottant, z-index élevé)
     └ .adcd-panel-body (flex:1, overflow:hidden)
         └ .adcd-panel-iframe-wrap (100% x 100%)
             └ iframe (100% x 100%, scrolling=auto)
   
   Le scroll est géré par Doctolib en interne.
   Aucune coupure de hauteur.
══════════════════════════════════ */
.adcd-panel {
    --adcd-color: #0596DE;
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 100vw);
    height: 100dvh;          /* dynamic viewport height, fallback 100vh */
    height: 100vh;
    background: #fff;
    box-shadow: -6px 0 40px rgba(0,0,0,.2);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(110%);
    transition: transform .38s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    overflow: hidden;
}
@supports (height: 100dvh) {
    .adcd-panel { height: 100dvh; }
}
.adcd-panel.is-open {
    transform: translateX(0);
}

/*
 * Barre flottante avec le bouton fermer uniquement.
 * Elle est positionnée en absolute sur le panneau
 * pour ne pas réduire la hauteur de l'iframe.
 * Le bouton fermer est visible par-dessus l'iframe
 * grâce au z-index.
 */
.adcd-panel-topbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 10px 12px;
}

.adcd-panel-close {
    width: 34px;
    height: 34px;
    border: none;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #343a40;
    transition: background .15s, transform .15s;
}
.adcd-panel-close:hover {
    background: #fff;
    transform: scale(1.08);
}
.adcd-panel-close:active {
    transform: scale(.95);
}

/* Header "nom praticien" supprimé — Doctolib a le sien */
.adcd-panel-header { display: none; }

/*
 * Body = toute la hauteur disponible.
 * L'iframe prend 100% x 100%.
 * overflow:hidden sur le body pour éviter double scrollbar.
 */
.adcd-panel-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.adcd-panel-iframe-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Spinner centré pendant le chargement */
.adcd-panel-iframe-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #f5f7fa
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%230596DE' stroke-width='3' stroke-dasharray='80' stroke-dashoffset='60'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.9s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E")
        center / 36px no-repeat;
    z-index: 1;
    transition: opacity .5s ease;
    pointer-events: none;
}
.adcd-panel-iframe-wrap.adcd-loaded::before { opacity: 0; }

/*
 * L'iframe remplit entièrement le panneau.
 * scrolling="auto" permet à Doctolib de gérer
 * son propre scroll interne.
 * height=100% + min-height=100% garantit qu'elle
 * ne se coupe pas.
 */
.adcd-panel-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}


/* ══════════════════════════════════
   BOUTON TRIGGER [adcom_doctolib_trigger]
══════════════════════════════════ */
.adcd-trigger-btn {
    --adcd-color: #0596DE;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--adcd-color);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none !important;
    cursor: pointer;
    border: none;
    transition: filter .2s ease, transform .15s ease;
    line-height: 1.3;
}
.adcd-trigger-btn::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center/contain no-repeat;
    flex-shrink: 0;
}
.adcd-trigger-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: #fff !important;
}
.adcd-trigger-btn:active {
    transform: translateY(0);
    filter: brightness(.95);
}


/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 600px) {
    .adcd-panel { width: 100vw; }
    .adcd-trigger-btn { width: 100%; justify-content: center; }
}

/* Lock scroll body quand panneau ouvert */
body.adcd-panel-open {
    overflow: hidden;
}
