/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

.nw_ia_chat_section {
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    min-height: 480px;
    box-sizing: border-box;
}

.nw_ia_chat_container {
    width: 100%;
    max-width: 1100px;
    height: 75vh;
    min-height: 500px;
    max-height: 750px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    display: grid;
    grid-template-columns: 320px 1fr;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Styling */
.nw_ia_chat_sidebar {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.nw_ia_sidebar_header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nw_ia_sidebar_logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(165, 180, 252, 0.2);
}

.nw_ia_sidebar_logo svg {
    width: 20px;
    height: 20px;
    fill: #4f46e5;
}

.nw_ia_sidebar_title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.nw_ia_sidebar_desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

.nw_ia_suggestions_box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.nw_ia_suggestions_label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nw_ia_suggestions_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nw_ia_suggestion_chip {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nw_ia_suggestion_chip:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #1e1b4b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.06);
}

/* Chat Main Area */
.nw_ia_chat_main {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    min-height: 0;
    overflow: hidden;
}

/* Header */
.nw_ia_chat_header {
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

.nw_ia_chat_avatar {
    width: 42px;
    height: 42px;
    border-radius: 50px;
    background: linear-gradient(135deg, #c7d2fe 0%, #818cf8 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(129, 140, 248, 0.15);
    position: relative;
}

.nw_ia_chat_avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.nw_ia_chat_avatar svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

.nw_ia_chat_title_container {
    display: flex;
    flex-direction: column;
}

.nw_ia_chat_title {
    color: #0f172a;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin: 0;
}

.nw_ia_chat_status {
    color: #64748b;
    font-size: 12px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Chat History Area */
.nw_ia_chat_history {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff;
    scroll-behavior: smooth;
    min-height: 0;
}

/* Custom Scrollbar */
.nw_ia_chat_history::-webkit-scrollbar {
    width: 6px;
}
.nw_ia_chat_history::-webkit-scrollbar-track {
    background: transparent;
}
.nw_ia_chat_history::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 10px;
}
.nw_ia_chat_history::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

/* Message Bubbles */
.nw_ia_msg_row {
    display: flex;
    width: 100%;
    animation: fadeInSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.nw_ia_msg_row.user {
    justify-content: flex-end;
}

.nw_ia_msg_row.assistant {
    justify-content: flex-start;
}

.nw_ia_msg_bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.nw_ia_msg_row.user .nw_ia_msg_bubble {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #1e1b4b;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(199, 210, 254, 0.3);
}

.nw_ia_msg_row.assistant .nw_ia_msg_bubble {
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Skeleton Loading State */
.nw_ia_skeleton_container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.nw_ia_skeleton_bubble {
    width: 70%;
    height: 60px;
    background: linear-gradient(90deg, rgba(0,0,0,0.02) 25%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.02) 75%);
    background-size: 200% 100%;
    animation: loadingSkeleton 1.5s infinite;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.nw_ia_typing_indicator {
    display: flex;
    gap: 5px;
    padding: 6px 10px;
    align-items: center;
    justify-content: center;
}

.nw_ia_typing_dot {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.nw_ia_typing_dot:nth-child(1) { animation-delay: -0.32s; }
.nw_ia_typing_dot:nth-child(2) { animation-delay: -0.16s; }

/* Input Container */
.nw_ia_chat_footer {
    padding: 18px 24px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    align-items: center;
}

.nw_ia_chat_input_wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.nw_ia_chat_input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50px;
    padding: 14px 24px;
    padding-right: 50px;
    color: #0f172a;
    font-size: 16px; /* Prevents auto-zoom on mobile */
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.nw_ia_chat_input:focus {
    background: #ffffff;
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.15);
}

.nw_ia_chat_input::placeholder {
    color: #94a3b8;
}

/* Send Button */
.nw_ia_chat_send_btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.nw_ia_chat_send_btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.nw_ia_chat_send_btn:active {
    transform: scale(0.95);
}

.nw_ia_chat_send_btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transform: translate(1px, -0.5px);
}

/* Keyframes */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loadingSkeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Progress Log Styles */
.nw_ia_typing_indicator_container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 16px 20px;
    min-width: 260px;
    max-width: 85%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.01);
}

.nw_ia_typing_header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nw_ia_typing_dots {
    display: flex;
    gap: 4px;
}

.nw_ia_typing_dots .nw_ia_typing_dot {
    width: 6px;
    height: 6px;
    background-color: #4f46e5;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.nw_ia_typing_dots .nw_ia_typing_dot:nth-child(1) { animation-delay: -0.32s; }
.nw_ia_typing_dots .nw_ia_typing_dot:nth-child(2) { animation-delay: -0.16s; }

.nw_ia_status_label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.nw_ia_status_text {
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    animation: fadeInLog 0.2s ease-out forwards;
    line-height: 1.4;
    word-break: break-word;
}

.nw_ia_status_text.info {
    color: #3b82f6;
}

.nw_ia_status_text.success {
    color: #16a34a;
}

.nw_ia_status_text.warn {
    color: #d97706;
}

.nw_ia_status_text.error {
    color: #dc2626;
}

.nw_ia_status_text.critical {
    color: #2563eb;
}

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

/* Copy Button Styles */
.nw_ia_msg_row.assistant {
    align-items: flex-end;
    gap: 8px;
}

.nw_ia_msg_actions {
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding-bottom: 4px;
}

.nw_ia_msg_row.assistant:hover .nw_ia_msg_actions {
    opacity: 1;
}

.nw_ia_copy_btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 6px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.nw_ia_copy_btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.1);
}

.nw_ia_copy_btn.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
}

/* Responsive adjustments */
.nw_ia_mobile_suggestions {
    display: none;
}

@media (max-width: 900px) {
    .nw_ia_chat_container {
        grid-template-columns: 1fr;
        height: 80vh;
    }
    
    .nw_ia_chat_sidebar {
        display: none;
    }
    
    .nw_ia_mobile_suggestions {
        display: flex;
        gap: 8px;
        padding: 10px 16px;
        overflow-x: auto;
        white-space: nowrap;
        background: #ffffff;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        scrollbar-width: none; /* Firefox */
    }
    
    .nw_ia_mobile_suggestions::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    .nw_ia_mobile_suggestions .nw_ia_suggestion_chip {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 20px;
    }
}

@media (max-width: 768px) {
    .nw_ia_chat_section {
        padding: 12px;
    }
    .nw_ia_chat_container {
        border-radius: 16px;
    }
    .nw_ia_chat_header {
        padding: 14px 18px;
    }
    .nw_ia_chat_footer {
        padding: 14px 18px;
    }
}
