/**
 * AI Chatbot Styles
 * Simple and clean chatbot interface
 */

/* =========================================
   Chatbot Container
   ========================================= */
.zargar-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--font-body);
}

/* =========================================
   Toggle Button
   ========================================= */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block !important;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-accent);
    color: var(--color-accent-foreground);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* =========================================
   Chat Window
   ========================================= */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Header
   ========================================= */
.chatbot-header {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

.chatbot-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Messages
   ========================================= */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chatbot-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInMessage 0.3s ease;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent-foreground);
    font-weight: 600;
    font-size: 0.875rem;
}

.message-content {
    background: white;
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    max-width: 75%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
}

.message-content p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-content p + p {
    margin-top: 0.5rem;
}

.message-content ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

.message-content li {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.message-content a {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}

.user-message .message-content a {
    color: var(--color-accent);
}

.message-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* =========================================
   Quick Actions
   ========================================= */
.chatbot-quick-actions {
    padding: 1rem 1.25rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* =========================================
   Input Area
   ========================================= */
.chatbot-input-area {
    padding: 1.25rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary), 0.1);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-send-btn:hover {
    background: var(--color-primary-light);
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   Typing Indicator
   ========================================= */
.chatbot-typing {
    padding: 0.5rem 1.5rem;
    background: #f9fafb;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 16px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    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% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* =========================================
   Mobile Responsive
   ========================================= */
@media (max-width: 480px) {
    .zargar-chatbot {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .message-content {
        max-width: 85%;
    }

    .chatbot-quick-actions {
        flex-direction: column;
    }

    .quick-action-btn {
        width: 100%;
    }
}

/* =========================================
   Scrollbar
   ========================================= */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
