/* ============================================================
   NIKA CHATBOT WIDGET
   Modern AI Assistant Chat Widget for Nika Website
   ============================================================ */

:root {
    --chatbot-primary: #0070F0;
    --chatbot-primary-hover: #0061d4;
    --chatbot-dark: #393939;
    --chatbot-gray: #72777A;
    --chatbot-light-gray: #F2F4F5;
    --chatbot-white: #FFFFFF;
    --chatbot-shadow: rgba(0, 0, 0, 0.1);
    --chatbot-shadow-lg: rgba(0, 0, 0, 0.15);
    --chatbot-success: #7DDE86;
    --chatbot-radius: 16px;
    --chatbot-radius-sm: 12px;
    --chatbot-transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================================
   FLOATING BUTTON (Closed State)
   ============================================================ */
.nika-chatbot-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #0061d4 100%);
    border: none;
    box-shadow: 0 8px 24px var(--chatbot-shadow-lg);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--chatbot-transition);
}

.nika-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 112, 240, 0.3);
}

.nika-chatbot-button.pulsing {
    animation: chatbotHeartbeat 2s ease-in-out infinite;
}

.nika-chatbot-button.pulsing::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 112, 240, 0.3) 0%, transparent 70%);
    animation: pulseRing 2s ease-in-out infinite;
}

.nika-chatbot-button:active {
    transform: scale(0.95);
}

.nika-chatbot-button svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Heartbeat Animation */
@keyframes chatbotHeartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.1);
    }
    20% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.1);
    }
    40% {
        transform: scale(1);
    }
}

/* Pulse Ring Animation */
@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Old Pulse Animation - Removed */
@keyframes chatbotPulse {
    0%, 100% {
        box-shadow: 0 8px 24px var(--chatbot-shadow-lg);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 112, 240, 0.4);
    }
}

/* Badge for notification */
.nika-chatbot-button .chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FF3B30;
    color: white;
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--chatbot-white);
    animation: badgePop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================================
   CHAT WIDGET CONTAINER (Open State)
   ============================================================ */
.nika-chatbot-widget {
    position: absolute;
    z-index: 10000000 !important;
    bottom: 4%;
    right: 24px;
    width: 420px;
    height: 90vh;
    background: var(--chatbot-white);
    border-radius: var(--chatbot-radius);
    box-shadow: 0 12px 48px var(--chatbot-shadow-lg);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all var(--chatbot-transition);
    overflow: hidden;

}

.nika-chatbot-widget.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ============================================================
   CHAT HEADER
   ============================================================ */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #0061d4 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-title {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--chatbot-white);
    margin: 0;
    line-height: 1.3;
}

.chatbot-header-subtitle {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 2px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: var(--chatbot-success);
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.chatbot-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* ============================================================
   CHAT BODY
   ============================================================ */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FAFBFC;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

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

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

.chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.chatbot-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   WELCOME MESSAGE
   ============================================================ */
.chatbot-welcome {
    background: var(--chatbot-white);
    border-radius: var(--chatbot-radius-sm);
    padding: 15px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: fadeInUp 0.5s ease;
    display: flex;
    gap: 11px;
    align-items: center;
}
.welcome-img img{
    border-radius: 50%;
    max-height: 200px;
}

.chatbot-welcome-title {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--chatbot-dark);
}

.chatbot-welcome-text {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--chatbot-gray);
    line-height: 1.7;
    margin: 0;
}

/* ============================================================
   BACK TO WELCOME BUTTON
   ============================================================ */
.chatbot-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid #E3E5E5;
    border-radius: var(--chatbot-radius-sm);
    padding: 10px 16px;
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--chatbot-dark);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    width: fit-content;
}

.chatbot-back-btn:hover {
    border-color: var(--chatbot-primary);
    background: rgba(0, 112, 240, 0.02);
    transform: translateX(2px);
}

.chatbot-back-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--chatbot-dark);
    transition: transform 0.2s;
}

.chatbot-back-btn:hover svg {
    transform: translateX(2px);
}

/* View states */
.chatbot-view-welcome {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-view-chat {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-hidden {
    display: none !important;
}

/* ============================================================
   QUICK QUESTIONS
   ============================================================ */
.chatbot-quick-questions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeInUp 0.5s ease 0.2s both;
}

.chatbot-quick-title {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--chatbot-gray);
    margin: 0 0 8px;
}

.chatbot-quick-btn {
    background: var(--chatbot-white);
    border: 1.5px solid #E3E5E5;
    border-radius: var(--chatbot-radius-sm);
    padding: 14px 16px;
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--chatbot-dark);
    text-align: right;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.chatbot-quick-btn:hover:not(:disabled) {
    border-color: var(--chatbot-primary);
    background: rgba(0, 112, 240, 0.02);
    transform: translateX(-2px);
}

.chatbot-quick-btn:active:not(:disabled) {
    transform: translateX(-2px) scale(0.98);
}

.chatbot-quick-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   MESSAGE BUBBLES
   ============================================================ */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-message.assistant {
    justify-content: flex-start;
}

/* Avatar for assistant messages */
.chatbot-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chatbot-light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.chatbot-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Bubble styling */
.chatbot-bubble {
    padding: 12px 16px;
    border-radius: var(--chatbot-radius-sm);
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap; /* Preserve line breaks */
    word-break: break-word;
    overflow-wrap: break-word;
}

.chatbot-message.user .chatbot-bubble {
    background: var(--chatbot-primary);
    color: var(--chatbot-white);
    border-bottom-left-radius: 4px;
}

.chatbot-message.assistant .chatbot-bubble {
    background: var(--chatbot-white);
    color: var(--chatbot-dark);
    border: 1px solid #E3E5E5;
    border-bottom-right-radius: 4px;
}

/* Timestamp */
.chatbot-message-time {
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 11px;
    color: var(--chatbot-gray);
    padding: 0 4px;
}

.chatbot-message.user .chatbot-message-time {
    text-align: left;
}

.chatbot-message.assistant .chatbot-message-time {
    text-align: right;
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.chatbot-typing {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

.chatbot-typing-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chatbot-light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.chatbot-typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-typing-bubble {
    background: var(--chatbot-white);
    border: 1px solid #E3E5E5;
    border-radius: var(--chatbot-radius-sm);
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-gray);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================================
   CHAT INPUT
   ============================================================ */
.chatbot-footer {
    padding: 16px 20px;
    background: var(--chatbot-white);
    border-top: 1px solid #E3E5E5;
    flex-shrink: 0;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-textarea-wrapper {
    flex: 1;
    position: relative;
}

.chatbot-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    padding-bottom: 32px; /* Space for character counter */
    border: 1.5px solid #E3E5E5;
    border-radius: var(--chatbot-radius-sm);
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--chatbot-dark);
    resize: none;
    overflow-y: auto;
    transition: border-color 0.2s;
    direction: rtl;
    scrollbar-width: none;
}

.chatbot-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #F9F9F9;
}

.chatbot-textarea::placeholder {
    color: #BDBDBD;
}

.chatbot-textarea:focus {
    outline: none;
    border-color: var(--chatbot-primary);
}

/* Character Counter */
.chatbot-char-counter {
    position: absolute;
    bottom: 8px;
    left: 16px;
    font-family: 'Peyda', Tahoma, sans-serif;
    font-size: 11px;
    color: var(--chatbot-gray);
    display: none; /* Hidden by default, shown via JS */
    transition: color 0.2s;
}

.chatbot-char-counter.char-limit-exceeded {
    color: #FF3B30;
    font-weight: 600;
}

.chatbot-textarea::-webkit-scrollbar {
    width: 4px;
}

.chatbot-textarea::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    padding: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    background: var(--chatbot-primary-hover);
    transform: scale(1.05);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chatbot-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 100%;
    height: 100%;
    fill: white;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   RESPONSIVE - MOBILE
   ============================================================ */
@media (max-width: 767px) {
    .nika-chatbot-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .nika-chatbot-button svg {
        width: 28px;
        height: 28px;
    }

    .nika-chatbot-widget {
        bottom: 0;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
    }

    .nika-chatbot-widget.active {
        transform: translateY(0);
    }

    .chatbot-header {
        padding: 16px 20px;
    }

    .chatbot-body {
        padding: 16px;
    }

    .chatbot-footer {
        padding: 12px 16px;
    }

    .chatbot-message-content {
        max-width: 85%;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.chatbot-hidden {
    display: none !important;
}

.chatbot-loading {
    pointer-events: none;
    opacity: 0.6;
}
