/**
 * PraisonAI Chat Widget Styles
 * Scoped under .ai-chat-wrapper — only affects AI pages, no site-wide impact
 */

/* ================================
   Wrapper (scoped)
   ================================ */
.ai-chat-wrapper {
    font-family: 'Inter', 'Noto Sans Tamil', system-ui, -apple-system, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px 40px;
    -webkit-font-smoothing: antialiased;
}

/* ================================
   Hero Section
   ================================ */
.ai-chat-wrapper .ai-hero {
    text-align: center;
    padding: 40px 0 28px;
    position: relative;
}

.ai-chat-wrapper .ai-hero-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 180px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.ai-chat-wrapper .ai-hero-bible .ai-hero-glow {
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
}

.ai-chat-wrapper .ai-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 8px;
    position: relative;
    z-index: 1;
}

.ai-chat-wrapper .ai-hero-bible .ai-title {
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.ai-chat-wrapper .ai-subtitle {
    color: #6b7280;
    font-size: 14px;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* ================================
   Chat Container
   ================================ */
.ai-chat-wrapper .ai-chat-container {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fafbfc;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ================================
   Messages
   ================================ */
.ai-chat-wrapper .ai-messages {
    padding: 20px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.ai-chat-wrapper .ai-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: praison-fade-in 0.3s ease;
}

@keyframes praison-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-wrapper .ai-message-user {
    flex-direction: row-reverse;
}

.ai-chat-wrapper .ai-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.ai-chat-wrapper .ai-message-user .ai-avatar {
    background: #ede9fe;
    border-color: #c4b5fd;
}

.ai-chat-wrapper .ai-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    line-height: 1.6;
    font-size: 14px;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ai-chat-wrapper .ai-message-user .ai-bubble {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.ai-chat-wrapper .ai-bubble p {
    margin: 0 0 8px;
}

.ai-chat-wrapper .ai-bubble p:last-child {
    margin: 0;
}

.ai-chat-wrapper .ai-bubble strong {
    font-weight: 600;
}

.ai-chat-wrapper .ai-bubble a {
    color: #6366f1;
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

.ai-chat-wrapper .ai-bubble a:hover {
    border-color: #6366f1;
}

.ai-chat-wrapper .ai-message-user .ai-bubble a {
    color: #e0e7ff;
    border-bottom-color: rgba(224, 231, 255, 0.4);
}

.ai-chat-wrapper .ai-bubble ol,
.ai-chat-wrapper .ai-bubble ul {
    padding-left: 18px;
    margin: 6px 0;
}

.ai-chat-wrapper .ai-bubble li {
    margin-bottom: 3px;
}

/* ================================
   Suggestions
   ================================ */
.ai-chat-wrapper .ai-suggestions {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-chat-wrapper .ai-suggestions li {
    padding: 7px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-chat-wrapper .ai-suggestions li:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #5b21b6;
    transform: translateY(-1px);
}

/* ================================
   Typing Indicator
   ================================ */
.ai-chat-wrapper .ai-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.ai-chat-wrapper .ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: praison-bounce 1.4s ease-in-out infinite;
}

.ai-chat-wrapper .ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-wrapper .ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes praison-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ================================
   Input Form
   ================================ */
.ai-chat-wrapper .ai-input-form {
    padding: 12px 16px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.ai-chat-wrapper .ai-input-wrapper {
    display: flex;
    gap: 8px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 3px 3px 3px 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-wrapper .ai-input-wrapper:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ai-chat-wrapper #aiInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #1f2937;
    font-size: 14px;
    font-family: inherit;
    padding: 8px 0;
}

.ai-chat-wrapper #aiInput::placeholder {
    color: #9ca3af;
}

.ai-chat-wrapper #aiSend {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.ai-chat-wrapper #aiSend:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.ai-chat-wrapper #aiSend:active {
    transform: scale(0.95);
}

.ai-chat-wrapper #aiSend:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-wrapper .ai-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin: 8px 0 0;
}

/* ================================
   Responsive (96% mobile)
   ================================ */
@media (max-width: 640px) {
    .ai-chat-wrapper {
        padding: 0 8px 24px;
    }

    .ai-chat-wrapper .ai-hero {
        padding: 24px 0 16px;
    }

    .ai-chat-wrapper .ai-title {
        font-size: 22px;
    }

    .ai-chat-wrapper .ai-subtitle {
        font-size: 13px;
    }

    .ai-chat-wrapper .ai-bubble {
        max-width: 90%;
        font-size: 13px;
        padding: 10px 12px;
    }

    .ai-chat-wrapper .ai-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .ai-chat-wrapper .ai-suggestions li {
        font-size: 12px;
        padding: 5px 10px;
    }

    .ai-chat-wrapper .ai-messages {
        min-height: 200px;
        max-height: 400px;
        padding: 12px;
    }
}

/* ================================
   Scrollbar
   ================================ */
.ai-chat-wrapper .ai-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-wrapper .ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-wrapper .ai-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}