/* AeroUnion Chat Widget - JivoSite Inspired Premium Design */
.aerounion-chat-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* === TOGGLE BUTTON - Как у Jivo === */
.au-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    color: #fff;
    padding: 12px 20px;
    border-radius: 28px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 191, 99, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    min-width: 140px;
    justify-content: center;
}

.au-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}

.au-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 191, 99, 0.4);
    background: linear-gradient(135deg, #00D46D 0%, #00BF63 100%);
}

.au-toggle:hover::before {
    left: 100%;
}

.au-toggle .au-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: pulse 2s infinite;
    position: relative;
}

.au-toggle .au-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: ripple 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* === CHAT PANEL - Премиум дизайн === */
.au-panel {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 380px;
    height: 580px;
    max-height: 70vh;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 32px 64px rgba(0, 0, 0, 0.15),
        0 16px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: panelAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

@keyframes panelAppear {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === HEADER - Стиль Jivo === */
.au-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    color: #fff;
    position: relative;
    min-height: 60px;
}

.au-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.au-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #00BF63;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.au-header-content {
    flex: 1;
}

.au-header-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.au-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.au-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ADE80;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.au-close-btn {
    background: none;
    border: none;
    color: #fff;
    opacity: 0.8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.au-close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* === CHAT BODY === */
.au-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.au-body::-webkit-scrollbar {
    width: 6px;
}

.au-body::-webkit-scrollbar-track {
    background: transparent;
}

.au-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.au-body::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* === MESSAGES === */
.au-msg {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.4;
    position: relative;
    animation: messageSlide 0.3s ease-out;
    font-size: 14px;
    word-wrap: break-word;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.au-bot {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    margin-right: 20%;
}

.au-user {
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    color: #FFFFFF;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 191, 99, 0.2);
    margin-left: 20%;
}

/* Message time */
.au-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.au-bot .au-time {
    text-align: left;
}

/* === TYPING INDICATOR === */
.au-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 18px;
    align-self: flex-start;
    max-width: 80px;
    margin-right: 20%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.au-typing-text {
    font-size: 12px;
    color: #64748B;
}

.au-typing-dots {
    display: flex;
    gap: 3px;
}

.au-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748B;
    animation: typingBounce 1.4s infinite;
}

.au-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.au-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
    }
    30% { 
        transform: translateY(-3px); 
    }
}

/* === INPUT AREA === */
.au-foot {
    border-top: 1px solid #E2E8F0;
    background: #FFFFFF;
    padding: 16px 20px;
}

.au-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.au-input-wrapper {
    flex: 1;
    position: relative;
}

.au-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #E2E8F0;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    transition: all 0.3s ease;
    background: #FFFFFF;
    font-family: inherit;
    line-height: 1.4;
    padding-right: 40px;
}

.au-input:focus {
    border-color: #00BF63;
    box-shadow: 0 0 0 3px rgba(0, 191, 99, 0.1);
}

.au-send {
    border: none;
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    color: #FFFFFF;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 191, 99, 0.3);
}

.au-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 191, 99, 0.4);
    background: linear-gradient(135deg, #00D46D 0%, #00BF63 100%);
}

.au-send:active {
    transform: translateY(0);
}

/* === QUICK BUTTONS === */
.au-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.au-quick-btn {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 8px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.au-quick-btn:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    transform: translateY(-1px);
}

/* === WELCOME SCREEN === */
.au-welcome {
    text-align: center;
    padding: 30px 20px;
}

.au-welcome-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 191, 99, 0.3);
}

.au-welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 8px;
}

.au-welcome-text {
    font-size: 14px;
    color: #64748B;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* === NOTIFICATION BADGE === */
.au-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    animation: notificationPulse 2s infinite;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

@keyframes notificationPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* === LOADING STATES === */
.au-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 18px;
    align-self: flex-start;
    max-width: 120px;
    margin-right: 20%;
}

.au-loading-text {
    font-size: 12px;
    color: #64748B;
}

.au-loading-dots {
    display: flex;
    gap: 3px;
}

.au-loading-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #64748B;
    animation: loading 1.4s infinite;
}

.au-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.au-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1.2);
        opacity: 1;
    }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 480px) {
    .aerounion-chat-container {
        right: 10px;
        bottom: 10px;
        left: 10px;
    }
    
    .au-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        bottom: 70px;
        height: 70vh;
        border-radius: 12px;
    }
    
    .au-toggle {
        min-width: auto;
        padding: 14px 20px;
    }
    
    .au-msg {
        max-width: 85%;
    }
    
    .au-bot {
        margin-right: 15%;
    }
    
    .au-user {
        margin-left: 15%;
    }
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
    .au-panel {
        background: #1F2937;
        border-color: #374151;
    }
    
    .au-body {
        background: #111827;
    }
    
    .au-bot {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }
    
    .au-input {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }
    
    .au-input:focus {
        background: #4B5563;
    }
    
    .au-foot {
        background: #1F2937;
        border-color: #374151;
    }
    
    .au-quick-btn {
        background: #374151;
        border-color: #4B5563;
        color: #D1D5DB;
    }
    
    .au-quick-btn:hover {
        background: #4B5563;
    }
    
    .au-typing,
    .au-loading {
        background: #374151;
        border-color: #4B5563;
        color: #D1D5DB;
    }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    .au-toggle,
    .au-send,
    .au-msg,
    .au-panel,
    .au-quick-btn {
        animation: none;
        transition: none;
    }
    
    .au-typing-dots span,
    .au-loading-dots span,
    .au-dot,
    .au-status-dot,
    .au-notification {
        animation: none;
    }
}

/* === CUSTOM BRANDING VARIABLES === */
.aerounion-chat-container {
    --au-primary: #00BF63;
    --au-primary-dark: #00A857;
    --au-primary-light: #00D46D;
    --au-shadow: rgba(0, 191, 99, 0.3);
}

/* Focus styles for accessibility */
.au-toggle:focus-visible,
.au-send:focus-visible,
.au-input:focus-visible,
.au-quick-btn:focus-visible,
.au-close-btn:focus-visible {
    outline: 2px solid #00BF63;
    outline-offset: 2px;
}
/* === CHAT CONTROLS === */
.au-chat-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.au-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.au-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

.au-control-btn.minimize svg {
    transform: rotate(180deg);
}

/* Chat states */
.au-panel.minimized {
    height: 60px;
    overflow: hidden;
    animation: minimizePanel 0.3s ease forwards;
}

.au-panel.hidden {
    display: none;
}

@keyframes minimizePanel {
    to {
        height: 60px;
        transform: translateY(0) scale(1);
    }
}

/* Minimized state */
.au-minimized-header {
    display: none;
}

.au-panel.minimized .au-minimized-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #00BF63 0%, #00A857 100%);
    color: #fff;
    cursor: pointer;
}

.au-panel.minimized .au-header,
.au-panel.minimized .au-body,
.au-panel.minimized .au-foot {
    display: none;
}

/* Icons */
.au-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Notification in minimized state */
.au-panel.minimized .au-notification {
    top: 12px;
    right: 12px;
}