/* ===== L7Chat floating widget styles ===== */

/* --- Layout --- */
#l7chat-window {
    display: none;
    position: fixed;
    z-index: 999999;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 25px 70px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 600px;
    height: 97vh;
    max-height: 900px;
    min-height: 500px;
    top: 2vh;
    right: 30px;
    bottom: 2vh;
    left: auto;
}

#l7chat-window .l7w-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    min-height: 76px;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
}

.l7w-header-spacer { width: 44px; opacity: 0; }

.l7w-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex: 1;
    text-align: center;
}

.l7w-header-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 3em;
}

.l7w-header-title {
    font-weight: 700;
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.l7w-header-status {
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 5px 14px;
    border-radius: 40px;
    margin-top: 5px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.25);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.l7w-online-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 20px #4ade80;
    animation: pulseOnline 1.5s infinite;
}

.l7w-header-sep { opacity: 0.6; }

#l7chat-close-btn {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    font-size: 22px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    margin-right: 0;
}
#l7chat-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1) rotate(90deg);
    border-color: white;
}
#l7chat-close-btn:active {
    transform: scale(0.95) rotate(90deg);
}

/* --- Loading indicator --- */
#l7chat-loading-indicator {
    display: none;
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    z-index: 10000;
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #eef2f6;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.l7w-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.l7w-loading-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.l7w-loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3498db;
    opacity: 0.6;
    animation: thinkingWave 1.8s infinite ease-in-out;
}
.l7w-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.l7w-loading-dot:nth-child(3) { animation-delay: 0.4s; }
.l7w-loading-dot:nth-child(4) { animation-delay: 0.6s; }
.l7w-loading-dot:nth-child(5) { animation-delay: 0.8s; }

.l7w-loading-text {
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
}

.l7w-loading-sub {
    font-size: 12px;
    color: #64748b;
}

/* --- Iframe body --- */
.l7w-iframe-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
    height: calc(100% - 76px);
    background: #f8fafc;
}

#l7chat-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: white;
}

.l7w-bottom-bar {
    height: 4px;
    background: linear-gradient(90deg, #2c3e50, #3498db, #2c3e50);
    width: 100%;
    opacity: 0.8;
}

/* --- Floating button --- */
#l7chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    border: 4px solid white;
    cursor: pointer;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(52,152,219,0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 32px;
    padding: 0;
}
#l7chat-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 12px 40px rgba(52,152,219,0.8);
    animation: shakeNudge 0.8s ease;
}
#l7chat-btn:active {
    transform: scale(0.95);
}

#chat-activity-indicator {
    display: none;
    position: absolute;
    top: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: #ff6b6b;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 15px rgba(255,107,107,0.6);
    animation: pulseActivity 1.5s infinite;
}

#l7chat-unread-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    border: 2px solid white;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(255,71,87,0.5);
}

/* --- Phrases container --- */
#l7chat-phrases-container {
    position: fixed;
    right: 120px;
    bottom: 120px;
    z-index: 999997;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* --- Keyframes --- */
@keyframes pulseOnline {
    0%   { opacity: 1; transform: scale(1);   box-shadow: 0 0 15px #4ade80; }
    50%  { opacity: 0.8; transform: scale(1.3); box-shadow: 0 0 30px #4ade80; }
    100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 15px #4ade80; }
}
@keyframes pulseActivity {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1);   opacity: 1; }
}
@keyframes thinkingWave {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.6; }
    30%           { transform: translateY(-12px); opacity: 1; }
}
@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); visibility: hidden; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); visibility: visible; }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes aggressivePulse {
    0%   { transform: scale(1);    box-shadow: 0 8px 30px rgba(52,152,219,0.6); }
    5%   { transform: scale(1.2);  box-shadow: 0 8px 40px rgba(52,152,219,0.9), 0 0 0 15px rgba(52,152,219,0.3); }
    10%  { transform: scale(1);    box-shadow: 0 8px 30px rgba(52,152,219,0.6); }
    15%  { transform: scale(1.15); box-shadow: 0 8px 35px rgba(52,152,219,0.8), 0 0 0 8px rgba(52,152,219,0.2); }
    20%  { transform: scale(1);    box-shadow: 0 8px 30px rgba(52,152,219,0.6); }
    30%  { transform: scale(1.1);  box-shadow: 0 8px 30px rgba(52,152,219,0.7); }
    40%  { transform: scale(1);    box-shadow: 0 8px 30px rgba(52,152,219,0.6); }
    70%  { transform: scale(1.05); box-shadow: 0 8px 30px rgba(52,152,219,0.7); }
    100% { transform: scale(1);    box-shadow: 0 8px 30px rgba(52,152,219,0.6); }
}
@keyframes shakeNudge {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-12deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-8deg); }
    50% { transform: rotate(6deg); }
    60% { transform: rotate(-4deg); }
    70% { transform: rotate(2deg); }
    80% { transform: rotate(-1deg); }
    90% { transform: rotate(0.5deg); }
}
@keyframes floatPhrase {
    0%   { opacity: 0; transform: translateX(30px) scale(0.8); }
    10%  { opacity: 1; transform: translateX(0) scale(1.1); }
    20%  { transform: translateX(0) scale(1); }
    80%  { opacity: 1; transform: translateX(0) scale(1); }
    100% { opacity: 0; transform: translateX(-20px) scale(0.8); }
}
@keyframes floatPhraseMobile {
    0%   { opacity: 0; transform: translateY(20px) scale(0.9); }
    15%  { opacity: 1; transform: translateY(0) scale(1.05); }
    25%  { transform: translateY(0) scale(1); }
    80%  { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-10px) scale(0.9); }
}

/* --- Utility classes --- */
.aggressive-pulse {
    animation: aggressivePulse 2.2s infinite !important;
}
.l7chat-phrase {
    background: white;
    padding: 12px 20px 12px 28px;
    border-radius: 50px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #3498db;
    backdrop-filter: blur(10px);
    font-weight: 700;
    color: #000000 !important;
    animation: floatPhrase 4.5s ease forwards;
    pointer-events: auto;
    cursor: pointer;
    max-width: 400px;
    border-left: 6px solid #3498db;
    border-bottom: 3px solid #3498db;
    transform-origin: right center;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
    letter-spacing: 0.3px;
    position: relative;
}
.l7chat-phrase i {
    color: #3498db;
    font-size: 24px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}
.l7chat-phrase span {
    color: #000000;
    font-weight: 700;
    flex: 1;
}
.l7chat-btn-raised { bottom: 80px !important; }
.fade-out { animation: fadeOutDown 0.3s ease forwards !important; }
.fade-in  { animation: fadeInUp 0.3s ease forwards !important; }
.hidden   { display: none !important; }
.visible  { display: flex !important; }

/* --- Mobile --- */
@media (max-width: 768px) {
    #l7chat-window {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        min-height: auto !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
        border: none !important;
    }
    #l7chat-window .l7w-header {
        padding: 12px 16px !important;
        min-height: 68px !important;
    }
    .l7w-header-spacer { width: 38px !important; }
    .l7w-header-center { gap: 10px !important; }
    .l7w-header-title  { font-size: 18px !important; }
    .l7w-header-status { font-size: 12px !important; padding: 4px 12px !important; }
    #l7chat-close-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
    #l7chat-btn {
        width: 65px !important;
        height: 65px !important;
        bottom: 25px !important;
        right: 25px !important;
        border-width: 3px !important;
        font-size: 28px !important;
        z-index: 999999 !important;
        display: flex !important;
    }
    body.chat-open-mobile #l7chat-btn,
    #l7chat-btn.l7chat-btn-hidden {
        display: none !important;
    }
    #l7chat-phrases-container {
        display: block !important;
        position: fixed !important;
        right: 15px !important;
        bottom: 90px !important;
        left: 15px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 999997 !important;
        pointer-events: none !important;
    }
    .l7chat-phrase {
        padding: 14px 16px 14px 20px !important;
        font-size: 16px !important;
        gap: 10px !important;
        max-width: 100% !important;
        width: auto !important;
        white-space: normal !important;
        word-break: break-word !important;
        border-left-width: 6px !important;
        margin-bottom: 10px !important;
        box-shadow: 0 15px 35px rgba(0,0,0,0.4) !important;
        background: white !important;
        animation: floatPhraseMobile 4s ease forwards !important;
        color: #000000 !important;
        font-weight: 700 !important;
        border: 2px solid #3498db !important;
        text-shadow: 0 1px 2px rgba(255,255,255,0.5) !important;
        pointer-events: auto !important;
    }
    .l7chat-phrase i {
        font-size: 20px !important;
        color: #3498db !important;
    }
    .l7chat-phrase span {
        color: #000000 !important;
        font-weight: 700 !important;
        font-size: 15px !important;
    }
    #chat-activity-indicator {
        width: 18px !important;
        height: 18px !important;
        top: -2px !important;
        right: -2px !important;
        border-width: 2px !important;
    }
    .l7chat-phrases-hidden {
        display: none !important;
    }
}
body.chat-open-mobile #l7chat-btn,
#l7chat-btn.l7chat-btn-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
