/* 
 * UI/UX Layer for AgricultureNovel AI Assistant
 * Theme: Modern, Forest, Glassmorphism
 */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600&display=swap');

:root {
    --ag-primary: #10b981; /* Forest green */
    --ag-primary-hover: #059669;
    --ag-bg-glass: rgba(255, 255, 255, 0.85);
    --ag-text-dark: #064e3b;
    --ag-text-light: #f8fafc;
    --ag-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --ag-border: rgba(16, 185, 129, 0.2);
}

.agnovel-ai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Bricolage Grotesque', sans-serif;
}

.agnovel-ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ag-primary), #34d399);
    color: white;
    border: none;
    box-shadow: var(--ag-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.agnovel-ai-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px -5px rgba(16, 185, 129, 0.4);
}

.agnovel-ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--ag-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ag-border);
    border-radius: 20px;
    box-shadow: var(--ag-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.agnovel-ai-chat-window.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.agnovel-ai-header {
    background: linear-gradient(to right, var(--ag-primary), #059669);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.agnovel-ai-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.agnovel-ai-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.agnovel-ai-close-btn:hover {
    opacity: 1;
}

.agnovel-ai-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Scrollbar for chat body */
.agnovel-ai-body::-webkit-scrollbar {
    width: 6px;
}
.agnovel-ai-body::-webkit-scrollbar-track {
    background: transparent;
}
.agnovel-ai-body::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 10px;
}

.agnovel-ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: ag-fade-in-up 0.3s ease forwards;
}

.agnovel-ai-message.ai {
    background: #ecfdf5;
    color: var(--ag-text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.agnovel-ai-message.user {
    background: var(--ag-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.agnovel-ai-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--ag-border);
    display: flex;
    gap: 8px;
    align-items: center;
}

#agnovel-ai-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

#agnovel-ai-input:focus {
    border-color: var(--ag-primary);
}

#agnovel-ai-send-btn {
    background: var(--ag-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

#agnovel-ai-send-btn:hover {
    background: var(--ag-primary-hover);
    transform: scale(1.05);
}

/* Typing Indicator */
.agnovel-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #ecfdf5;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    align-items: center;
    width: fit-content;
}

.agnovel-typing-dot {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    animation: agnovel-typing 1.4s infinite ease-in-out both;
}

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

@keyframes agnovel-typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes ag-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .agnovel-ai-chat-window {
        width: calc(100vw - 32px);
        right: -8px; /* Adjusted to sit nicely on mobile */
        bottom: 70px;
    }
}
