/* AI Chatbot Styles */
:root {
    --ai-primary-yellow: #FFBD2E;
    --ai-primary-green: #0d6b39;
    --ai-secondary-green: #278237;
    --ai-bg-gradient: linear-gradient(180deg, #F9FBF9 0%, #FFFFFF 100%);
    --ai-text-dark: #272E26;
    --ai-text-gray: #4b5563;
}

.ai-offcanvas {
    width: 450px !important;
    border-left: none;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    font-family: 'nihal', sans-serif !important;
    z-index: 1070 !important;
    /* Higher than history sidebar and backdrop */
}




.ai-offcanvas .offcanvas-header {
    background-color: var(--ai-primary-yellow);
    padding: 15px 20px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 10px 10px 0 0;
}

.ai-offcanvas .offcanvas-title {
    color: var(--ai-text-dark);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
    flex-grow: 1;
    text-align: right;
}

.ai-offcanvas .btn-close-custom {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--ai-text-dark);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-top-sub-header {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-history-btn {
    background-color: var(--ai-primary-green);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: 0.3s;
}

.ai-lang-dropdown {
    background-color: var(--ai-primary-green);
    color: white;
    border-radius: 6px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    border: none;
}

.ai-chat-body {
    /* background: var(--ai-bg-gradient); */
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    /* Adjust based on header/footer */
    overflow-y: auto;
    position: relative;
}

/* Welcome Screen Specifics */
.ai-welcome-content {
    text-align: center;
    margin-top: 40px;
}

.ai-welcome-text {
    font-size: 1rem;
    color: var(--ai-text-gray);
    margin-bottom: 40px;
    line-height: 1.8;
}

.ai-mic-btn-large {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    /* box-shadow: 0 10px 20px rgba(255, 189, 46, 0.3); */
    cursor: pointer;
    transition: 0.3s;
    background: transparent;
    border: 0;
}

.ai-mic-btn-large img {
    width: 90px;
    height: 90px;

}

.ai-mic-btn-large:hover {
    transform: scale(1.05);
}

/* Suggestion Cards */
.ai-suggestions-container {
    margin-top: auto;
    padding-bottom: 20px;
}

.ai-suggestions-scroll {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.ai-suggestions-scroll::-webkit-scrollbar {
    display: none;
}

.ai-suggestion-card {
    background: #f7f7f7;
    border: 1px solid #f7f7f7;
    border-radius: 6px 0 0 6px;
    padding: 10px 12px;
    min-width: 120px;
    text-align: right;
    cursor: pointer;
    transition: 0.3s;
    border-right: 4px solid var(--ai-primary-yellow);
    flex-shrink: 0;
}

.ai-suggestion-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-color: var(--ai-primary-yellow);
}

.ai-suggestion-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ai-text-dark);
    font-weight: 600;
}

/* Chat Footer / Input Area */
.ai-chat-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-top: 1px solid #F3F4F6;
    border-radius: 0 0 10px 10px;
}

.ai-input-wrapper {
    display: flex;
    align-items: center;
    background: #F9FBF9;
    border-radius: 10px;
    padding: 6px 12px;
    gap: 10px;
}

.ai-input-wrapper input {
    border: none;
    background: transparent;
    flex-grow: 1;
    text-align: right;
    font-size: 0.9rem;
    padding: 5px 0;
    font-family: 'nihal', sans-serif !important;
}

.ai-input-wrapper input::placeholder {
    font-family: 'nihal', sans-serif !important;
}


.ai-input-wrapper input:focus {
    outline: none;
}

.ai-send-btn {
    background-color: var(--ai-primary-green);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 0.85rem;
}

.ai-mic-btn-input {
    background-color: var(--ai-primary-yellow);
    color: var(--ai-text-dark);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 0.85rem;
}

/* Chat Messages */
.ai-message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.ai-message.user {
    align-items: flex-start;
    /* Right side in RTL */
}


.ai-message.ai {
    align-items: flex-end;
    /* Left side in RTL */
}


.ai-bubble {
    max-width: 90%;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: right;
}

.ai-message.user .ai-bubble {
    background-color: var(--ai-primary-yellow);
    color: var(--ai-text-dark);
    border-top-right-radius: 2px;
}

.ai-message.ai .ai-bubble {
    background-color: transparent;
    color: var(--ai-text-dark);
}

/* Options / Chips */
.ai-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 15px;
}

.ai-option-chip {
    background-color: var(--ai-primary-yellow);
    color: var(--ai-text-dark);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.3s;
}

.ai-option-chip:hover {
    filter: brightness(0.95);
}

.ai-apply-btn {
    background-color: var(--ai-primary-yellow);
    color: var(--ai-text-dark);
    padding: 6px 25px;
    border-radius: 4px;
    font-weight: 700;
    border: none;
    margin-top: 15px;
    align-self: flex-start;
    font-size: 0.85rem;
}

/* Sidebar History */
.ai-history-sidebar {
    position: fixed;
    top: auto;
    bottom: 5px;
    right: -280px;
    /* Hidden outside right */
    width: 280px;
    height: calc(100% - 70px);
    background: white;
    z-index: 1055;
    /* Below 1060 (AI Boat) but above Backdrop */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);

    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 20px;
    font-family: 'nihal', sans-serif !important;
    border-radius: 12px 0 0 12px;
}



.ai-history-sidebar.active {
    right: 450px;
    /* Slides out exactly to the left of the 450px sidebar */
}


.ai-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

#closeHistory {
    width: 32px;
    height: 32px;
    background: #f3f7f4;
    border: none;
    border-radius: 50%;
    color: var(--ai-primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

#closeHistory:hover {
    background: var(--ai-primary-green);
    color: white;
    transform: translateX(3px);
}


.ai-new-chat-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid transparent;
    background-color: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: end;
    background: transparent;
    font-weight: 700;
    margin-bottom: 20px;
    gap: 12px;
    font-size: 24px;
}

/* Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.animate-on-scroll.fade-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.fade-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.animate-on-scroll.fade-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}



.ai_into {
    font-weight: 400;
    font-size: 17px;
    line-height: 24px;
    text-align: center;
    letter-spacing: 0.01em;
    color: #838E91;


}

/* Voice Recording Overlay */
.ai-voice-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    backdrop-filter: blur(10px);
}

.ai-voice-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.ai-voice-waves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 60px;
    margin-bottom: 40px;
}

.ai-voice-waves span {
    width: 6px;
    height: 10px;
    background: var(--ai-primary-green);
    border-radius: 3px;
    animation: voiceWave 1s infinite ease-in-out;
}

.ai-voice-waves span:nth-child(2) {
    animation-delay: 0.1s;
    height: 20px;
}

.ai-voice-waves span:nth-child(3) {
    animation-delay: 0.2s;
    height: 40px;
}

.ai-voice-waves span:nth-child(4) {
    animation-delay: 0.3s;
    height: 25px;
}

.ai-voice-waves span:nth-child(5) {
    animation-delay: 0.4s;
    height: 15px;
}

@keyframes voiceWave {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(2.5);
    }
}

.ai-voice-mic-circle {
    width: 100px;
    height: 100px;
    background: var(--ai-primary-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--ai-text-dark);
    box-shadow: 0 0 0 0 rgba(255, 189, 46, 0.4);
    animation: micPulse 1.5s infinite;
    cursor: pointer;
    margin-bottom: 20px;
}

@keyframes micPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 189, 46, 0.7);
    }

    70% {
        box-shadow: 0 0 0 30px rgba(255, 189, 46, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 189, 46, 0);
    }
}

.ai-voice-status {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ai-text-dark);
    margin-bottom: 30px;
}

.ai-voice-cancel {
    background: #f3f4f6;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    color: var(--ai-text-gray);
    cursor: pointer;
    transition: 0.3s;
}

.ai-voice-cancel:hover {
    background: #e5e7eb;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#aiChatOffcanvas {
    background: url('../images/offcanvas_bg.png') !important;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    border-left: 0;

    right: 5px;
    top: 5px;
    border-radius: 10px;
    bottom: 5px;
    height: calc(100% -10px);
}

@media (max-width: 768px) {
    #aiChatOffcanvas {
        width: 100% !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .ai-history-sidebar {
        width: 100% !important;
        height: 100% !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        z-index: 1100 !important;
        /* Extremely high to ensure it covers everything on mobile */
        right: -100% !important;
    }

    .ai-history-sidebar.active {
        right: 0 !important;
    }

    .ai-offcanvas .offcanvas-header,
    .ai-chat-footer {
        border-radius: 0 !important;
    }
}