/* ============================================
   ASK IPOH AI — Page Layout
   ============================================ */

.ipoh-ai-wrapper {
    max-width: 820px;
    margin: 40px auto 60px;
    padding: 0 20px;
    font-family: inherit;
}

/* --- Header --- */
.ipoh-ai-header {
    text-align: center;
    margin-bottom: 30px;
}

.ipoh-ai-title {
    font-size: 2.4rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.ipoh-ai-subtitle {
    font-size: 1.05rem;
    color: #666;
    margin: 0 auto;
    max-width: 600px;
    line-height: 1.6;
}

/* --- Chat Container: Stronger, Visible Outline --- */
#ipoh-chat-container {
    background: #ffffff;
    /* Thicker, more visible border */
    border: 2px solid #0073aa;
    border-radius: 16px;
    overflow: hidden;
    /* Stronger, branded shadow for depth */
    box-shadow: 
        0 0 0 4px rgba(0, 115, 170, 0.08),
        0 12px 40px rgba(0, 115, 170, 0.18);
    display: flex;
    flex-direction: column;
    height: 560px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Subtle highlight when the chat is focused/active */
#ipoh-chat-container:focus-within {
    border-color: #005a87;
    box-shadow: 
        0 0 0 4px rgba(0, 115, 170, 0.15),
        0 12px 44px rgba(0, 115, 170, 0.25);
}

/* --- Messages Area --- */
#ipoh-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #fafafa;
    scroll-behavior: smooth;
}

#ipoh-chat-messages::-webkit-scrollbar {
    width: 8px;
}

#ipoh-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ipoh-chat-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 4px;
}

#ipoh-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* --- Message Bubbles --- */
.ipoh-chat-message {
    margin-bottom: 16px;
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 78%;
    word-wrap: break-word;
    line-height: 1.55;
    font-size: 0.97rem;
    animation: ipohFadeIn 0.25s ease-out;
}

@keyframes ipohFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ipoh-chat-user {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #ffffff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.25);
}

.ipoh-chat-assistant {
    background: #ffffff;
    color: #333333;
    margin-right: auto;
    border: 1px solid #ebebeb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* --- Typing Indicator --- */
#ipoh-chat-typing {
    font-style: italic;
    color: #999;
    background: #ffffff;
    border: 1px dashed #e0e0e0;
    padding: 10px 18px;
    position: relative;
}

#ipoh-chat-typing::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 6px;
    border-radius: 50%;
    background: #999;
    animation: ipohDots 1.2s infinite;
    box-shadow: 8px 0 0 #999, 16px 0 0 #999;
}

@keyframes ipohDots {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* --- Input Area --- */
#ipoh-chat-input-area {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border-top: 2px solid #e0e0e0;
    gap: 12px;
}

/* --- Input Field: Visible Cursor & Focus Ring --- */
#ipoh-chat-input {
    flex: 1;
    padding: 13px 18px;
    border: 2px solid #d0d0d0;
    border-radius: 24px;
    font-size: 0.97rem;
    font-family: inherit;
    outline: none;
    background: #f9f9f9;
    transition: all 0.2s ease;
    color: #333;

    /* Make the text caret (blinking cursor) more visible */
    caret-color: #0073aa;
    caret-shape: bar;
}

/* WebKit-specific cursor tweaks (Chrome, Safari, Edge) */
#ipoh-chat-input::-webkit-input-placeholder {
    color: #aaa;
}

#ipoh-chat-input:focus {
    border-color: #0073aa;
    background: #ffffff;
    box-shadow: 
        0 0 0 4px rgba(0, 115, 170, 0.15),
        inset 0 0 0 1px rgba(0, 115, 170, 0.05);
}

#ipoh-chat-input::placeholder {
    color: #aaa;
}

#ipoh-chat-input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    caret-color: transparent;
}

/* --- Send Button --- */
#ipoh-chat-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
    padding: 0;
}

#ipoh-chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 115, 170, 0.4);
}

#ipoh-chat-send:active:not(:disabled) {
    transform: translateY(0);
}

#ipoh-chat-send:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- Footer --- */
.ipoh-ai-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.82rem;
    color: #999;
}

.ipoh-ai-footer span {
    display: inline-block;
    padding: 6px 14px;
    background: #f5f5f5;
    border-radius: 20px;
}

/* ============================================
   RESPONSIVE — Mobile Adjustments
   ============================================ */

@media (max-width: 768px) {
    .ipoh-ai-wrapper {
        margin: 20px auto 40px;
        padding: 0 16px;
    }
    
    .ipoh-ai-title {
        font-size: 1.8rem;
    }
    
    .ipoh-ai-subtitle {
        font-size: 0.95rem;
    }
    
    #ipoh-chat-container {
        height: calc(100vh - 320px);
        min-height: 400px;
        border-radius: 12px;
        border-width: 2px;
    }
    
    #ipoh-chat-messages {
        padding: 16px;
    }
    
    .ipoh-chat-message {
        max-width: 88%;
        font-size: 0.93rem;
        padding: 10px 14px;
    }
    
    #ipoh-chat-input-area {
        padding: 12px 14px;
        gap: 8px;
    }
    
    #ipoh-chat-input {
        padding: 11px 16px;
        font-size: 0.93rem;
    }
    
    #ipoh-chat-send {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .ipoh-ai-title {
        font-size: 1.5rem;
    }
    
    #ipoh-chat-container {
        height: calc(100vh - 280px);
    }
}
.ipoh-chat-assistant strong { font-weight: 700; color: #000; }
.ipoh-chat-assistant em     { font-style: italic; }
.ipoh-chat-assistant ul,
.ipoh-chat-assistant ol     { margin: 6px 0 6px 20px; padding-left: 4px; }
.ipoh-chat-assistant li     { margin-bottom: 4px; }
.ipoh-chat-assistant code   {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}
.ipoh-chat-assistant a {
    color: #0073aa;
    text-decoration: underline;
}