:root {
    --ai-primary-dark: #0d2818;
    --ai-primary: #1a4d2e;
    --ai-primary-light: #4caf50;
    --ai-accent: #c9a227;
    --ai-accent-light: #d4af37;
    --ai-glass-bg: rgba(255, 255, 255, 0.18);
    --ai-glass-bg-strong: rgba(255, 255, 255, 0.25);
    --ai-glass-border: rgba(255, 255, 255, 0.3);
    --ai-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --ai-shadow-glow: 0 0 40px rgba(76, 175, 80, 0.3);
    --ai-radius-sm: 8px;
    --ai-radius-md: 16px;
    --ai-radius-lg: 24px;
    --ai-radius-xl: 32px;
    --ai-radius-full: 999px;
    --ai-transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --ai-transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chatbot-container {
    position: fixed;
    bottom: 150px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    transition: opacity 0.3s ease;
}

.ai-chatbot-button {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--ai-radius-full);
    background: linear-gradient(135deg, var(--ai-primary-dark) 0%, var(--ai-primary) 50%, var(--ai-primary-light) 100%);
    border: 3px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 40px rgba(46, 125, 50, 0.5),
                0 0 60px rgba(76, 175, 80, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--ai-transition-bounce);
    overflow: hidden;
}

.ai-chatbot-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.8s ease;
}

.ai-chatbot-button:hover::before {
    left: 100%;
}

.ai-chatbot-button:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 16px 50px rgba(46, 125, 50, 0.6),
                0 0 80px rgba(76, 175, 80, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

.ai-chatbot-button:active {
    transform: scale(1.05);
}

.ai-chatbot-icon {
    width: 36px;
    height: 36px;
    color: white;
    z-index: 1;
    animation: floatIcon 3s ease-in-out infinite;
}

.ai-chatbot-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.ai-chatbot-label {
    position: absolute;
    bottom: -38px;
    right: 0;
    background: var(--ai-glass-bg-strong);
    color: white;
    padding: 8px 16px;
    border-radius: var(--ai-radius-md);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--ai-transition-smooth);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--ai-glass-border);
    box-shadow: var(--ai-glass-shadow);
    pointer-events: none;
}

.ai-chatbot-button:hover .ai-chatbot-label {
    opacity: 1;
    transform: translateY(0);
}

.ai-chatbot-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(76, 175, 80, 0.5);
    animation: pulse 2s ease-out infinite;
    opacity: 0;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.ai-chatbot-tooltip {
    position: absolute;
    bottom: 88px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--ai-transition-smooth);
}

.ai-chatbot-container:hover .ai-chatbot-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.ai-chatbot-tooltip-text {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    white-space: nowrap;
}

.ai-chatbot-tooltip-arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid rgba(0, 0, 0, 0.7);
    margin-right: 24px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.ai-chatbot-panel {
    position: fixed;
    bottom: 112px;
    right: 30px;
    width: 420px;
    height: 580px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9998;
    transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
    transform-origin: center center;
}

.ai-chatbot-panel.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-chatbot-panel-header {
    padding: 20px 24px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.ai-chatbot-panel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.ai-chatbot-panel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-chatbot-panel-title {
    flex: 1;
}

.ai-chatbot-panel-title h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.ai-chatbot-panel-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.ai-chatbot-panel-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.ai-chatbot-panel-maximize {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.ai-chatbot-panel-maximize:hover {
    background: #e0e0e0;
}

.ai-chatbot-panel-maximize svg {
    width: 16px;
    height: 16px;
}

.ai-chatbot-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ai-chatbot-panel-close:hover {
    background: #e0e0e0;
}

.ai-chatbot-panel-close svg {
    width: 16px;
    height: 16px;
}

.ai-chatbot-panel.maximized {
    width: 100vw;
    height: 100vh;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
    .ai-chatbot-panel.maximized {
        width: 100vw;
        height: 100vh;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        border-radius: 0;
    }
}

.ai-chatbot-panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fefefe;
}

.ai-chatbot-panel-body::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chatbot-panel-body::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

.ai-chatbot-panel-body::-webkit-scrollbar-thumb:hover {
    background: #d0d0d0;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease-out;
}

.message.assistant {
    flex-direction: row;
    justify-content: flex-start;
}

.message.user {
    flex-direction: row;
    justify-content: flex-end;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.assistant .message-content {
    background: #c9e9d2;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: #f5f5f5;
    color: #333;
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.ai-chatbot-quick-actions {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    background: white;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.ai-chatbot-panel-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.ai-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chatbot-attach {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chatbot-attach:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.ai-chatbot-attach svg {
    width: 16px;
    height: 16px;
}

.ai-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    font-size: 14px;
    background: white;
    color: #333;
    transition: all 0.2s ease;
    outline: none;
}

.ai-chatbot-input::placeholder {
    color: #999;
}

.ai-chatbot-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.ai-chatbot-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2D8A4E;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chatbot-send:hover:not(:disabled) {
    background: #277442;
    transform: scale(1.05);
}

.ai-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chatbot-send svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 640px) {
    .ai-chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    .ai-chatbot-button {
        width: 64px;
        height: 64px;
    }

    .ai-chatbot-icon {
        width: 32px;
        height: 32px;
    }

    .ai-chatbot-panel {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 94px;
        height: 500px;
    }

    .ai-chatbot-panel-header {
        padding: 16px 20px;
    }

    .ai-chatbot-panel-body {
        padding: 16px;
    }

    .ai-chatbot-quick-actions {
        padding: 12px 16px;
    }

    .quick-action-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .ai-chatbot-panel-footer {
        padding: 12px 16px;
    }

    .ai-chatbot-input {
        padding: 10px 14px;
        font-size: 13px;
    }
}
