/**
 * Calendly Widget - LD Solutions
 * Widget flottant pour prise de rendez-vous
 *
 * @package ldsolutions
 * @version 1.0.0
 */

/* ============================================================
   WIDGET FLOTTANT
   ============================================================ */

.lds-calendly-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.lds-calendly-widget__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 56px;
    height: 56px;
    padding: 0;
    background: linear-gradient(135deg, #0a3fd0 0%, #1a6aff 100%);
    color: rgba(255, 255, 255, 0.95);
    border: 2.5px solid rgba(100, 170, 255, 0.5);
    border-radius: 28px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    box-shadow:
        0 4px 12px rgba(18, 90, 248, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                gap 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                border-color 0.3s ease,
                transform 0.3s ease,
                box-shadow 0.3s ease;
}

.lds-calendly-widget__trigger:hover {
    width: 200px;
    gap: 0.75rem;
    padding: 0 20px;
    background: linear-gradient(135deg, #0d45da 0%, #2575ff 100%);
    border-color: rgba(130, 190, 255, 0.6);
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(18, 90, 248, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.15);
}

.lds-calendly-widget__trigger:focus {
    outline: 2px solid rgba(100, 170, 255, 0.5);
    outline-offset: 2px;
}

.lds-calendly-widget__trigger:active {
    transform: translateY(1px);
    box-shadow:
        0 2px 8px rgba(18, 90, 248, 0.2),
        0 1px 4px rgba(0, 0, 0, 0.1);
}

.lds-calendly-widget__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lds-calendly-widget__icon svg {
    width: 24px;
    height: 24px;
}

.lds-calendly-widget__text {
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    width: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
                width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lds-calendly-widget__trigger:hover .lds-calendly-widget__text {
    opacity: 1;
    width: 100px;
}

/* ============================================================
   POPUP CALENDLY
   ============================================================ */

.lds-calendly-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lds-calendly-popup.is-open {
    opacity: 1;
    visibility: visible;
}

.lds-calendly-popup__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 27, 80, 0.7);
    backdrop-filter: blur(4px);
}

.lds-calendly-popup__container {
    position: relative;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    max-height: 700px;
    background: var(--lds-white, #ffffff);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.lds-calendly-popup.is-open .lds-calendly-popup__container {
    transform: scale(1) translateY(0);
}

.lds-calendly-popup__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--lds-color-dark, var(--lds-black, #151E28));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.lds-calendly-popup__close:hover {
    background: var(--lds-white, #ffffff);
    transform: scale(1.05);
}

.lds-calendly-popup__close:focus {
    outline: 2px solid var(--lds-color-primary, var(--lds-blue, #125AF8));
    outline-offset: 2px;
}

.lds-calendly-popup__content {
    width: 100%;
    height: 100%;
}

.lds-calendly-popup__content iframe {
    display: block;
}

/* Placeholder quand URL non configurée */
.lds-calendly-popup__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    background: linear-gradient(135deg, #F8FAFF 0%, var(--lds-white, #ffffff) 100%);
}

.lds-calendly-popup__placeholder i,
.lds-calendly-popup__placeholder svg {
    width: 64px;
    height: 64px;
    stroke: var(--lds-color-primary, var(--lds-blue, #125AF8));
    margin-bottom: 1.5rem;
}

.lds-calendly-popup__placeholder h3 {
    font-family: 'Chillax', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--lds-navy, #021B50);
    margin: 0 0 1rem;
}

.lds-calendly-popup__placeholder p {
    font-family: Arial, sans-serif;
    font-size: 1rem;
    color: rgba(21, 30, 40, 0.6);
    margin: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .lds-calendly-widget {
        bottom: 1.5rem;
        right: 1.5rem;
    }

    .lds-calendly-widget__trigger {
        font-size: 0.875rem;
    }

    .lds-calendly-widget__trigger:hover {
        padding: 0 1.25rem;
    }

    .lds-calendly-popup__container {
        width: 95%;
        height: 90vh;
        max-height: none;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .lds-calendly-widget {
        bottom: 1rem;
        right: 1rem;
    }

    /* Sur mobile, on garde uniquement l'icône même au hover */
    .lds-calendly-widget__text {
        display: none;
    }

    .lds-calendly-widget__trigger,
    .lds-calendly-widget__trigger:hover {
        width: 56px;
        height: 56px;
        padding: 0 16px;
        border-radius: 28px;
    }

    .lds-calendly-popup__container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .lds-calendly-popup__close {
        top: 0.75rem;
        right: 0.75rem;
    }
}

/* ============================================================
   ANIMATION PULSE (pour attirer l'attention)
   ============================================================ */

@keyframes calendly-pulse {
    0%, 100% {
        box-shadow:
            0 4px 12px rgba(18, 90, 248, 0.25),
            0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow:
            0 4px 12px rgba(18, 90, 248, 0.25),
            0 2px 4px rgba(0, 0, 0, 0.1),
            0 0 0 8px rgba(18, 90, 248, 0.15);
    }
}

/* Activer l'animation après quelques secondes sur la page */
.lds-calendly-widget__trigger {
    animation: calendly-pulse 2s ease-in-out 5s 3;
}
