/**
 * Alkhair Aldaem Pharmaceuticals - AI Chat Widget Styles
 * Modern glassmorphism chat interface
 * @version 1.0
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   AI CHAT TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════════ */
.ai-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 100px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B8B9A 0%, #2ECC71 100%);
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(27, 139, 154, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    font-size: 1rem;
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(27, 139, 154, 0.5);
}

.ai-chat-toggle.active {
    transform: scale(0.9);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AI CHAT WIDGET CONTAINER
   ═══════════════════════════════════════════════════════════════════════════════ */
.ai-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.ai-chat-widget.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CHAT HEADER
   ═══════════════════════════════════════════════════════════════════════════════ */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(27, 139, 154, 0.2) 0%, rgba(46, 204, 113, 0.1) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B8B9A 0%, #2ECC71 100%);
    border-radius: 12px;
    font-size: 1.25rem;
    color: white;
}

.ai-info h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #2ECC71;
}

.ai-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ECC71;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.ai-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CHAT MESSAGES
   ═══════════════════════════════════════════════════════════════════════════════ */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 3px;
}

.ai-message {
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    align-self: flex-end;
}

.ai-message.bot {
    align-self: flex-start;
}

.ai-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, #1B8B9A 0%, #2ECC71 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.bot .ai-message-content {
    background: rgba(51, 65, 85, 0.6);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════════════════════════════════════════════ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(51, 65, 85, 0.6);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   INPUT AREA
   ═══════════════════════════════════════════════════════════════════════════════ */
.ai-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(30, 41, 59, 0.5);
}

.ai-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 14px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.ai-input-wrapper:focus-within {
    border-color: #1B8B9A;
    box-shadow: 0 0 0 3px rgba(27, 139, 154, 0.1);
}

.ai-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

.ai-chat-input::placeholder {
    color: #64748b;
}

.ai-send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B8B9A 0%, #2ECC71 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(27, 139, 154, 0.3);
}

.ai-send-btn:active {
    transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .ai-chat-toggle {
        right: 80px;
        bottom: 20px;
        width: 52px;
        height: 52px;
        font-size: 0.95rem;
    }

    .ai-chat-widget {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        bottom: 80px;
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        border-radius: 16px;
    }

    .ai-chat-header {
        padding: 14px 16px;
    }

    .ai-avatar {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 10px;
    }

    .ai-info h3 {
        font-size: 0.9rem;
    }

    .ai-status {
        font-size: 11px;
    }

    .ai-chat-messages {
        padding: 16px;
        gap: 12px;
    }

    .ai-message-content {
        padding: 10px 14px;
        font-size: 14px;
        line-height: 1.55;
    }

    .ai-chat-input-area {
        padding: 12px 14px;
    }

    .ai-input-wrapper {
        padding: 6px 10px;
        gap: 10px;
    }

    .ai-chat-input {
        font-size: 16px; /* prevents iOS zoom */
    }

    .ai-send-btn {
        width: 38px;
        height: 38px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (fullscreen chat)
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .ai-chat-widget {
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .ai-chat-toggle {
        right: 74px;
        bottom: 16px;
        width: 48px;
        height: 48px;
        font-size: 0.85rem;
    }

    .ai-chat-header {
        border-radius: 0;
        padding: 16px;
    }

    .ai-close {
        width: 40px;
        height: 40px;
    }
}