/* ==========================================================================
   TidyCal Floating Bubble v1.1 - Frontend Styles
   ========================================================================== */

/* Container */
.tcfb-container {
    position: fixed;
    z-index: var(--tcfb-z-index, 9999);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   BULLE STANDARD (avec icône SVG)
   ============================================ */
.tcfb-bubble {
    position: fixed;
    width: var(--tcfb-bubble-size, 60px);
    height: var(--tcfb-bubble-size, 60px);
    background: var(--tcfb-bubble-color, #6366f1);
    border: none;
    border-radius: var(--tcfb-bubble-border-radius, 50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--tcfb-bubble-shadow, 0 4px 20px rgba(0, 0, 0, 0.25));
    transition: all 0.3s ease;
    z-index: var(--tcfb-z-index, 9999);
    outline: none;
    padding: 0;
}

.tcfb-bubble:hover {
    background: var(--tcfb-bubble-hover-color, #4f46e5);
    transform: scale(1.1);
}

.tcfb-bubble:focus {
    box-shadow: var(--tcfb-bubble-shadow), 0 0 0 4px rgba(99, 102, 241, 0.3);
}

/* Icône SVG standard */
.tcfb-icon {
    width: 50%;
    height: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tcfb-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   BULLE PERSONNALISÉE (avec image)
   ============================================ */
.tcfb-bubble.tcfb-bubble-custom {
    /* Reset complet - pas de fond, pas de forme */
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    
    /* Taille auto basée sur l'image */
    width: auto !important;
    height: auto !important;
}

.tcfb-bubble.tcfb-bubble-custom:hover {
    background: none !important;
    transform: scale(1.05);
}

.tcfb-bubble.tcfb-bubble-custom:focus {
    box-shadow: none !important;
    outline: 2px solid var(--tcfb-bubble-color, #6366f1);
    outline-offset: 4px;
}

/* Image personnalisée */
.tcfb-custom-image {
    display: block;
    max-width: var(--tcfb-custom-icon-size, 200px);
    max-height: var(--tcfb-custom-icon-size, 200px);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ============================================
   BADGE
   ============================================ */
.tcfb-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--tcfb-badge-color, #ef4444);
    color: var(--tcfb-badge-text-color, #ffffff);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   TOOLTIP
   ============================================ */
.tcfb-tooltip {
    position: absolute;
    background: var(--tcfb-tooltip-bg, #1f2937);
    color: var(--tcfb-tooltip-text, #ffffff);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tcfb-tooltip::before {
    content: '';
    position: absolute;
    border: 6px solid transparent;
}

/* Positions du tooltip */
.tcfb-tooltip-left {
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}
.tcfb-tooltip-left::before {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: var(--tcfb-tooltip-bg, #1f2937);
}

.tcfb-tooltip-right {
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}
.tcfb-tooltip-right::before {
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: var(--tcfb-tooltip-bg, #1f2937);
}

.tcfb-tooltip-top {
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
}
.tcfb-tooltip-top::before {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--tcfb-tooltip-bg, #1f2937);
}

.tcfb-tooltip-bottom {
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
}
.tcfb-tooltip-bottom::before {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--tcfb-tooltip-bg, #1f2937);
}

/* Afficher le tooltip au survol */
.tcfb-bubble:hover .tcfb-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.tcfb-animate-pulse {
    animation: tcfb-pulse 2s infinite;
}
@keyframes tcfb-pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.tcfb-animate-bounce {
    animation: tcfb-bounce 2s infinite;
}
@keyframes tcfb-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.tcfb-animate-shake {
    animation: tcfb-shake 4s infinite;
}
@keyframes tcfb-shake {
    0%, 90%, 100% { transform: rotate(0deg); }
    92%, 96% { transform: rotate(5deg); }
    94%, 98% { transform: rotate(-5deg); }
}

/* Pas d'animation pulse/shadow sur image custom */
.tcfb-bubble.tcfb-bubble-custom.tcfb-animate-pulse {
    animation: none;
}

/* État caché */
.tcfb-bubble.tcfb-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
    pointer-events: none;
}

/* ============================================
   MODAL
   ============================================ */
.tcfb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--tcfb-z-index, 9999) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tcfb-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.tcfb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--tcfb-popup-overlay, rgba(0, 0, 0, 0.5));
}

.tcfb-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.tcfb-modal[aria-hidden="false"] .tcfb-modal-content {
    transform: scale(1);
}

.tcfb-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.tcfb-modal-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.tcfb-modal-close svg {
    width: 18px;
    height: 18px;
    color: #374151;
}

#tcfb-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .tcfb-modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .tcfb-tooltip {
        display: none !important;
    }
}

@media print {
    .tcfb-container,
    .tcfb-bubble,
    .tcfb-modal {
        display: none !important;
    }
}
