
/* ─────────────────────────────────────────────────────────────
   PREMIUM FLOATING AI CHATBOT SYSTEM
───────────────────────────────────────────────────────────── */
:root {
    --cb-primary: #1e3c72;
    --cb-secondary: #2a5298;
    --cb-accent: #ff9800; /* Vibrant Orange border accent */
    --cb-glow: rgba(255, 152, 0, 0.4);
    --cb-white: #ffffff;
    --cb-radius: 16px;
    --cb-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}

/* Tablet */
@media (max-width: 768px) {
    .floating-chat-card {
        top: 10px;
        right: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        max-width: none;
    }

    .launcher-tooltip {
        display: none;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .floating-chat-card {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        border-radius: 0;
        border-top: none;
    }

    .chat-card-header {
        padding: 12px;
    }

    .chat-header-title {
        font-size: 14px;
    }

    .floating-chat-launcher {
        width: 56px;
        height: 56px;
        bottom: 15px;
        right: 15px;
    }

    .floating-chat-launcher .launcher-icon {
        font-size: 22px;
    }

    .launcher-tooltip {
        display: none;
    }
}

/* Very Small Phones */
@media (max-width: 360px) {
    .chat-header-title {
        font-size: 13px;
    }

    .chat-card-header {
        padding: 10px;
    }

    .floating-chat-launcher {
        width: 50px;
        height: 50px;
    }
}

/* Floating Launcher Button */
.floating-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9800 0%, #e65100 100%);
    border: 2px solid var(--cb-white);
    color: var(--cb-white);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
    cursor: pointer;
    z-index: 100000; /* Float securely on top of the full-height card */
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.floating-chat-launcher:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 8px 24px rgba(255, 152, 0, 0.5), 0 0 0 4px var(--cb-glow);
}

.floating-chat-launcher:active {
    transform: scale(0.95);
}

.floating-chat-launcher .launcher-icon {
    font-size: 26px;
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Pulsing Decorative Ring */
.launcher-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--cb-accent);
    opacity: 0.8;
    animation: launcherPulse 2s infinite ease-out;
    pointer-events: none;
}

@keyframes launcherPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Action Tooltip Badge */
.launcher-tooltip {
    position: absolute;
    right: 76px;
    background: #2c3e50;
    color: var(--cb-white);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateX(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.floating-chat-launcher:hover .launcher-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* Floating Card Window */
.floating-chat-card {
    position: fixed;
    top: 24px;
    bottom: 24px;
    right: 24px;
    /* width: 385px; */
     width: min(385px, calc(100vw - 24px));
    height: calc(100vh - 48px);
    max-width: calc(100vw - 48px);
    background: var(--cb-white);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    /* Premium Orange Accent Top Border */
    border-top: 4px solid var(--cb-accent);
    
    /* Animation Initial State */
    opacity: 0;
    transform: scale(0.9) translateY(24px);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card Opened State */
.floating-chat-card.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Card Header */
.chat-card-header {
    background: linear-gradient(135deg, var(--cb-primary) 0%, var(--cb-secondary) 100%);
    color: var(--cb-white);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.chat-pulsing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--cb-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--cb-accent);
    animation: dotPulse 1.5s infinite ease-in-out;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.chat-header-btn {
    background: transparent;
    border: none;
    color: var(--cb-white);
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Iframe Body Container */
.chat-iframe-body {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #f8fafc;
}

.chat-iframe-body iframe {
    width: 100%;
    height: 100%;
      min-height: 0;
    border: none;
    display: block;
}

/* Lazy Load Spinner Placeholder */
.chat-iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cb-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid #e2e8f0;
    border-top: 3.5px solid var(--cb-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-iframe-loading p {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* Mobile Screen Responsiveness */
@media (max-width: 480px) {
    .floating-chat-card {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        max-width: 100%;
        border-radius: 0;
        border-top: none;
    }
    .floating-chat-launcher {
        bottom: 16px;
        right: 16px;
    }
}
