/* =========================================
   HANA AI v1.3 - SWEET & CUTE PREMIUM STYLE
   ========================================= */

/* Main Chat Box Box */
#ai-chat-box {
    display: none;
    position: fixed;
    right: 30px;
    bottom: 100px;
    width: 380px;
    height: 600px;
    background: rgba(255, 255, 255, 0.9); /* Premium Glass Effect */
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border: 2px solid rgba(255, 182, 193, 0.5);
    border-radius: 35px;
    z-index: 100000;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(255, 105, 180, 0.2);
    font-family: 'Poppins', 'Comic Neue', sans-serif;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* PC Screens Adjustment */
@media screen and (min-width: 1024px) {
    #ai-chat-box {
        width: 420px;
        height: 680px;
        right: 40px;
        bottom: 110px;
    }
}

/* Header Style */
.ai-header {
    padding: 18px 25px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.hana-name {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    font-family: 'Indie Flower', cursive;
    text-shadow: 2px 2px 5px rgba(255, 105, 180, 0.5);
    letter-spacing: 1px;
}

#ai-close {
    background: rgba(255, 255, 255, 0.4);
    border: none;
    color: #ff69b4;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s ease;
}

#ai-close:hover {
    background: #ff4b4b;
    color: #fff;
    transform: rotate(90deg) scale(1.1);
}

/* Message Area Style */
.ai-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fffafa;
    background-image: radial-gradient(#ffc0cb 0.6px, transparent 0.6px);
    background-size: 18px 18px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.ai-msg.bot {
    background: #ffffff;
    color: #4a4a4a;
    border-radius: 20px 20px 20px 5px;
    padding: 12px 18px;
    max-width: 85%;
    align-self: flex-start;
    box-shadow: 4px 4px 15px rgba(255, 182, 193, 0.15);
    border: 1px solid #ffe4e1;
    font-size: 15px;
    line-height: 1.5;
}

.ai-msg.user {
    background: linear-gradient(135deg, #ff69b4, #ff85c1);
    color: #fff;
    border-radius: 20px 20px 5px 20px;
    padding: 12px 18px;
    max-width: 85%;
    align-self: flex-end;
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.25);
    font-size: 15px;
}

/* Input Area Style */
.ai-input {
    padding: 15px 20px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #ffe4e1;
    border-radius: 0 0 35px 35px;
}

#ai-plus {
    background: #fdf2f4;
    border: none;
    color: #ff69b4;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

#ai-input {
    flex: 1;
    background: #fdf2f4;
    border: 1px solid #ffdae0;
    padding: 12px 20px;
    border-radius: 25px;
    color: #333;
    outline: none;
    font-size: 14px;
}

#ai-send {
    background: linear-gradient(135deg, #ff69b4, #ff85c1);
    color: #fff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.3);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#ai-send:hover {
    transform: scale(1.1) rotate(-10deg);
}

/* Thinking/Status Animation */
.wa-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    padding: 10px 15px;
    border-radius: 15px;
    align-self: flex-start;
    border: 1px solid #ffe4e1;
}

.wa-typing span {
    width: 6px;
    height: 6px;
    background-color: #ff69b4;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.wa-typing span:nth-child(2) { animation-delay: 0.2s; }
.wa-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Floating Buttons Style */
.floating-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10000;
}

.float-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    background: #fff;
}

#ai-float-btn {
    background: linear-gradient(135deg, #ff69b4, #ffb6c1);
    animation: floatGlow 3s infinite ease-in-out;
}

@keyframes floatGlow {
    0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 8px 20px rgba(255, 105, 180, 0.4); }
    50% { transform: translateY(-8px) scale(1.05); box-shadow: 0 15px 30px rgba(255, 105, 180, 0.6); }
}

#science-btn {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    color: #fff;
    font-size: 22px;
}

/* Image Preview Style */
#image-preview-container {
    position: absolute;
    bottom: 85px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 18px;
    border: 2px solid #ffdae0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 101;
    display: flex;
    align-items: center;
}

#image-preview-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 12px;
}

/* Custom Pink Scrollbar */
.ai-messages::-webkit-scrollbar {
    width: 6px;
}
.ai-messages::-webkit-scrollbar-thumb {
    background: #ffc0cb;
    border-radius: 10px;
}
.ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* =========================================
   HANA AI v1.3 - MOBILE OPTIMIZATION
   ========================================= */

@media screen and (max-width: 768px) {
    #ai-chat-box {
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important; /* Mobile එකේදී Full Screen පෙන්වීමට */
        border-radius: 0 !important; /* Full screen නිසා වටකුරු බව අයින් කළා */
        border: none !important;
        z-index: 6000 !important; /* Bottom nav එකටත් වඩා උඩින් */
    }

    /* Header එක Mobile එකට ගැලපෙන්න උස වැඩි කළා */
    .ai-header {
        padding: 20px 15px;
        border-radius: 0;
    }

    .hana-name {
        font-size: 22px;
    }

    /* Message Area එක Mobile එකේදී Scroll කරන්න පහසු කළා */
    .ai-messages {
        padding: 15px;
        gap: 12px;
        background-size: 15px 15px; /* පොඩි තිත් රටාව */
    }

    /* Input Area එක Mobile එකේ යටටම ලස්සනට සෙට් කළා */
    .ai-input {
        padding: 10px 15px 25px 15px; /* යටින් වැඩිපුර ඉඩ තැබුවේ Phone gestures වලට හිර නොවෙන්න */
        border-radius: 0;
        background: #ffffff;
    }

    #ai-input {
        font-size: 16px; /* Mobile එකේදී Zoom වීම වැළැක්වීමට (Minimum 16px) */
    }

    #ai-plus, #ai-send {
        width: 42px;
        height: 42px;
    }

    /* Image Preview එක Mobile එකේදී පේන තැන වෙනස් කළා */
    #image-preview-container {
        bottom: 90px;
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }

    /* Mobile එකේදී Floating Buttons හංගන්න (Chat Box එක ඇතුලේ වැඩ නිසා) */
    .floating-container {
        display: none !important;
    }

    /* Message බුබුළු වල ප්‍රමාණය Mobile එකට ගැලපීම */
    .ai-msg.bot, .ai-msg.user {
        max-width: 90%;
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* ඉතා කුඩා Phones සඳහා (iPhone SE වගේ) */
@media screen and (max-width: 375px) {
    .hana-name {
        font-size: 18px;
    }
    
    #ai-input {
        padding: 10px 15px;
    }
}