/**
 * Plugin Name: Agronavti AI Chatbot V3 (Assistants)
 * Styles for the modern welcome experience and chat interface.
 * Version: 5.0.4 (Complete Redesign from Scratch)
 */

/* ============================================ */
/* ==   GLOBAL STYLES & CSS VARIABLES V5.0   == */
/* ============================================ */
:root {
    --background-dark: #101419;
    --background-darker: #0D1014;
    --text-primary: #FFFFFF;
    --text-secondary: #a0a0a0;
    --accent-green: #A8E063;
    --accent-green-darker: #56AB2F;
    --border-color: #30363D;
    --font-primary: 'BPG Nino Mtavruli', 'Poppins', sans-serif;
    --font-secondary: 'Poppins', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================ */
/* ==      MAIN PLUGIN CONTAINER             == */
/* ============================================ */
#agronavti-ai-root-v3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available; /* For mobile Safari */
    z-index: 99999;
    font-family: var(--font-primary);
    background-color: var(--background-dark);
    color: var(--text-primary);
    overflow: hidden;
}

#agronavti-chat-widget-v3 {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================ */
/* ==   INTERACTIVE WELCOME SCREEN (V5.0)    == */
/* ============================================ */

/* --- Main Welcome Container --- */
#agronavti-interactive-welcome-v3 {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Decorative Background Circles --- */
.welcome-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.welcome-background > div {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
}
.circle-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-green-darker), transparent 60%);
    top: -150px;
    right: -150px;
    animation: spin 30s linear infinite alternate;
}
.circle-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #4a5a42, transparent 70%);
    bottom: -100px;
    right: 50px;
    animation: spin 25s linear infinite;
}
.circle-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #727272, transparent 80%);
    bottom: 50px;
    left: -150px;
    animation: spin 35s linear infinite alternate-reverse;
}
@keyframes spin {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(360deg) scale(1.1); }
}

/* --- Welcome Step Management --- */
.welcome-step {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease-in-out, visibility 0.6s;
    z-index: 5;
}
.welcome-step.active {
    opacity: 1;
    visibility: visible;
}

/* --- Two-Column Layout --- */
.welcome-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
}

/* --- Text & Button Content --- */
.welcome-text-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    animation: fadeInContent 1s ease-out forwards;
    position: relative;
    height: 100%;
}
@keyframes fadeInContent {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

#welcome-step-2-v3 .welcome-main-title {
    font-family: var(--font-primary);
}
.welcome-main-title {
    font-family: var(--font-secondary);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.welcome-subtitle {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 450px;
}

/* --- Main Action Button (Step 1) --- */
.welcome-button {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    border-radius: 50px;
    padding: 0.75rem 0.75rem 0.75rem 1.5rem;
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}
.welcome-button .arrow-circle {
    background-color: var(--text-primary);
    color: var(--background-dark);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
.welcome-button:hover {
    background-color: var(--text-primary);
    color: var(--background-dark);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}
.welcome-button:hover .arrow-circle {
    transform: translateX(5px);
}

/* --- Language Buttons (Step 2) --- */
.language-buttons { display: flex; gap: 1rem; }
.lang-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-family: var(--font-primary);
    border: 2px solid var(--accent-green);
    background-color: transparent;
    color: var(--accent-green);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.lang-btn:hover {
    background-color: var(--accent-green);
    color: var(--background-dark);
    box-shadow: 0 0 20px rgba(168, 224, 99, 0.4);
}

/* --- Image Content --- */
.welcome-image-content {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.robot-image {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    z-index: 3;
    animation: floatRobot 4s ease-in-out infinite;
}
@keyframes floatRobot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.wheat-image {
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 200px;
    opacity: 0.6;
    z-index: 2;
    transform: none;
}

/* --- Step Indicators --- */
.step-indicators {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    gap: 0.75rem;
    z-index: 10;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition: all 0.3s ease;
}
.dot.active {
    background-color: var(--text-primary);
    transform: scale(1.2);
}

/* ============================================ */
/* ==        CHAT INTERFACE STYLES (V5.0)    == */
/* ============================================ */
#agronavti-chat-area-v3 {
    display: none;
    grid-template-rows: auto auto 1fr auto;
    height: 100%;
    width: 100%;
    background-color: var(--background-darker);
}

#chat-top-header-v3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background-color: var(--background-dark);
    border-bottom: 1px solid var(--border-color);
}
#chat-header-title-v3 { font-size: 1.1rem; font-weight: 700; }
#chat-top-header-v3 .header-btn {
    background: none; border: none;
    color: var(--text-primary); font-size: 2rem;
    cursor: pointer; padding: 0 12px;
}

#progress-container-v3 { background-color: #000; }
#progress-text-v3 { font-size: 0.8rem; color: var(--text-secondary); text-align: center; padding: 6px 0 2px 0; }
#progress-bar-v3 {
    width: 0%; height: 4px;
    background: linear-gradient(90deg, var(--accent-green-darker), var(--accent-green));
    transition: width 0.5s;
}

#chat-log-v3 {
    overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column;
}

#chat-log-v3 .message {
    max-width: 85%; padding: 12px 18px;
    border-radius: 18px; line-height: 1.6;
    margin-bottom: 12px; word-break: break-word;
    animation: message-fade-in 0.4s ease-out;
}
@keyframes message-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

#chat-log-v3 .user-message {
    align-self: flex-end;
    background: linear-gradient(45deg, var(--accent-green-darker), var(--accent-green));
    color: #fff;
    border-bottom-right-radius: 6px;
}

#chat-log-v3 .bot-message {
    align-self: flex-start;
    background: #21262d;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
}

.recommendation-card-v3 {
    background: #21262d; border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-green); padding: 1.2rem;
    border-radius: 12px; margin-bottom: 15px;
}
.recommendation-card-v3 h3 {
    margin: 0 0 12px 0; color: var(--text-primary);
    font-size: 1.2rem;
}
.rec-field-v3 {
    display: flex; flex-wrap: wrap; gap: 8px;
    align-items: baseline; margin-bottom: 8px;
    font-size: 0.95rem; border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.rec-field-v3 .label {
    font-weight: 600; color: var(--text-secondary);
    margin-right: auto; padding-right: 10px;
}
.rec-field-v3 .value {
    color: var(--text-primary); font-weight: 600;
    text-align: right; word-break: break-word;
}
.rec-field-v3.justification .value {
    text-align: left; flex-basis: 100%;
    margin-top: 4px; color: var(--text-secondary);
}
.disclaimer-box {
    background: #21262d; border: 1px solid var(--border-color);
    padding: 1rem; margin-top: 1rem;
    border-radius: 12px; font-size: 0.9rem;
    color: var(--text-secondary);
}

#chat-input-row-v3 {
    display: flex; gap: 10px; padding: 10px;
    background-color: var(--background-dark);
    border-top: 1px solid var(--border-color);
}
#chat-input-v3 {
    width: 100%; padding: 14px 16px;
    border-radius: 24px; border: 1px solid var(--border-color);
    background: var(--background-darker); font-size: 1rem;
    color: var(--text-primary); outline: none;
}
#chat-input-v3:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(168, 224, 99, 0.2);
}

#chat-send-v3 {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 48px; height: 48px;
    font-size: 1.5rem; color: #fff;
    background: var(--accent-green); border: none;
    border-radius: 50%; cursor: pointer;
    transition: background-color 0.2s;
}
#chat-send-v3:hover { background-color: var(--accent-green-darker); }

#download-pdf-v3, .opt-btn {
    display: block; width: calc(100% - 30px);
    margin: 15px auto 5px auto; padding: 13px 0;
    border-radius: 9px; background: transparent;
    color: var(--accent-green); font-weight: 700;
    font-size: 1rem; border: 1px solid var(--accent-green);
    transition: all 0.2s; text-align: center;
    text-decoration: none; cursor: pointer;
}
#download-pdf-v3:hover, .opt-btn:hover {
    background: var(--accent-green);
    color: var(--background-dark);
}

.typing-indicator { display: flex; align-items: center; padding: 10px 0; }
.typing-indicator span {
    height: 8px; width: 8px; margin: 0 2px;
    background-color: var(--text-secondary); border-radius: 50%;
    display: inline-block; animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-of-type(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-of-type(2) { animation-delay: -0.16s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* ============================================ */
/* ==        RESPONSIVE ADJUSTMENTS          == */
/* ============================================ */
@media (max-width: 768px) {
    .welcome-content-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .welcome-text-content {
        align-items: center;
        order: 2;
    }
    .welcome-image-content {
        order: 1;
        height: 300px;
    }
    .robot-image {
        max-height: 300px;
    }
    .wheat-image {
        width: 180px;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
    }
    .welcome-main-title {
        font-size: 2.2rem;
    }
    .welcome-subtitle {
        font-size: 1rem;
    }
    .language-buttons {
        flex-direction: column;
        width: 100%;
    }
}

