/**
 * Scoped styles for OG Hemp — HempForm AI.
 * Complies with Project Rule 0.2.2 (Strict CSS Scoping & Isolation).
 */

.oghemp-webmcp-advisor-wrap {
    position: fixed;
    bottom: var(--oghemp-bottom-pos, 24px);
    right: 24px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1a1a1a;
    box-sizing: border-box;
    pointer-events: none; /* Do not block clicks beneath */
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1), right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Desktop & Tablet layout when Back-to-Top button is visible */
@media (min-width: 768px) {
    .oghemp-webmcp-advisor-wrap.has-top-btn {
        right: 88px !important;
        bottom: var(--oghemp-bottom-pos, 24px) !important;
    }

    .oghemp-webmcp-advisor-wrap.has-top-btn .advisor-dialog-card {
        right: -64px !important;
    }
}

.oghemp-webmcp-advisor-wrap * {
    box-sizing: border-box;
}

/* Floating AI Green Star Icon Launcher */
.oghemp-webmcp-advisor-wrap .advisor-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    filter: drop-shadow(0 4px 14px rgba(37, 211, 102, 0.55));
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    outline: none;
    pointer-events: auto; /* Clickable */
    animation: oghempStarFloat 3.5s ease-in-out infinite;
}

@keyframes oghempStarFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.04);
    }
}

.oghemp-webmcp-advisor-wrap .advisor-trigger-btn:hover {
    transform: scale(1.18) rotate(8deg);
    filter: drop-shadow(0 8px 20px rgba(37, 211, 102, 0.75));
    animation: none;
}

.oghemp-webmcp-advisor-wrap .advisor-trigger-btn .advisor-ai-star {
    width: 44px;
    height: 44px;
    transition: transform 0.3s ease;
}

.oghemp-webmcp-advisor-wrap .advisor-trigger-btn:active {
    transform: scale(0.95);
}

/* Advisor Dialog Card */
.oghemp-webmcp-advisor-wrap .advisor-dialog-card {
    display: none;
    position: absolute;
    bottom: 66px;
    right: 0;
    width: 390px;
    max-width: calc(100vw - 32px);
    max-height: 86vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(0, 0, 0, 0.08);
    pointer-events: auto; /* Fully clickable */
    animation: ogmcpFadeIn 0.25s ease-out forwards;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.oghemp-webmcp-advisor-wrap.is-open .advisor-dialog-card {
    display: block;
}

@keyframes ogmcpFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.oghemp-webmcp-advisor-wrap .advisor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.oghemp-webmcp-advisor-wrap .advisor-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oghemp-webmcp-advisor-wrap .advisor-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

.oghemp-webmcp-advisor-wrap .advisor-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
}

.oghemp-webmcp-advisor-wrap .advisor-close-btn:hover {
    color: #111;
}

/* Returning Visitor Banner */
.oghemp-webmcp-advisor-wrap .advisor-returning-banner {
    background: #eef7ee;
    border: 1px solid #cce5cc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    margin-bottom: 12px;
}

.oghemp-webmcp-advisor-wrap .advisor-mini-link {
    background: #2b5329;
    color: #fff;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
}

.oghemp-webmcp-advisor-wrap .advisor-mini-link.secondary {
    background: #e0e0e0;
    color: #333;
}

.oghemp-webmcp-advisor-wrap .advisor-subtitle {
    font-size: 13px;
    color: #555;
    margin: 0 0 14px 0;
    line-height: 1.4;
}

/* 2-Axis Selection Sections */
.oghemp-webmcp-advisor-wrap .advisor-section-block {
    margin-bottom: 16px;
}

.oghemp-webmcp-advisor-wrap .advisor-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.oghemp-webmcp-advisor-wrap .advisor-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #2b5329;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
}

.oghemp-webmcp-advisor-wrap .advisor-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #2b5329;
}

.oghemp-webmcp-advisor-wrap .advisor-pills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fbfdfb;
    border: 1px solid #dce9dc;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn:hover {
    background: #eef7ee;
    border-color: #2b5329;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(43, 83, 41, 0.12);
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn.is-selected {
    background: #2b5329;
    border-color: #2b5329;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(43, 83, 41, 0.3);
    transform: translateY(-2px);
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn.is-selected .pill-label,
.oghemp-webmcp-advisor-wrap .advisor-pill-btn.is-selected .pill-desc {
    color: #ffffff;
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn .pill-icon {
    font-size: 18px;
    margin-bottom: 4px;
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn .pill-label {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin-bottom: 2px;
}

.oghemp-webmcp-advisor-wrap .advisor-pill-btn .pill-desc {
    font-size: 9px;
    color: #666;
    line-height: 1.2;
}

/* Screen 2 & 3 Navigation Bar */
.oghemp-webmcp-advisor-wrap .advisor-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e5e5e5;
}

.oghemp-webmcp-advisor-wrap .advisor-back-btn {
    background: transparent;
    border: none;
    color: #2b5329;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}

.oghemp-webmcp-advisor-wrap .advisor-back-btn:hover {
    text-decoration: underline;
}

.oghemp-webmcp-advisor-wrap .advisor-selected-badge {
    background: #eaf5ea;
    color: #2b5329;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Form Styles */
.oghemp-webmcp-advisor-wrap .form-group {
    margin-bottom: 14px;
}

.oghemp-webmcp-advisor-wrap label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.oghemp-webmcp-advisor-wrap select,
.oghemp-webmcp-advisor-wrap input[type="number"],
.oghemp-webmcp-advisor-wrap input[type="text"],
.oghemp-webmcp-advisor-wrap input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 13px;
    background: #fafafa;
    color: #111;
    transition: border-color 0.2s;
}

.oghemp-webmcp-advisor-wrap select:focus,
.oghemp-webmcp-advisor-wrap input:focus {
    outline: none;
    border-color: #2b5329;
    background: #fff;
}

.oghemp-webmcp-advisor-wrap .field-hint {
    display: block;
    font-size: 11px;
    color: #777;
    margin-top: 4px;
    line-height: 1.3;
}

.oghemp-webmcp-advisor-wrap .advisor-submit-btn {
    width: 100%;
    background: #2b5329;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.oghemp-webmcp-advisor-wrap .advisor-submit-btn:hover:not(:disabled) {
    background: #1f3d1e;
    transform: translateY(-1px);
}

.oghemp-webmcp-advisor-wrap .advisor-submit-btn:disabled {
    background: #c3d9c2;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Results Panel */
.oghemp-webmcp-advisor-wrap .advisor-results-panel {
    margin-top: 8px;
}

.oghemp-webmcp-advisor-wrap .advisor-rec-card {
    background: #f8faf8;
    border: 1px solid #dceedd;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.oghemp-webmcp-advisor-wrap .advisor-rec-card h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #2b5329;
}

.oghemp-webmcp-advisor-wrap .advisor-rec-card p {
    font-size: 12px;
    color: #444;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.oghemp-webmcp-advisor-wrap .advisor-action-btn {
    display: inline-block;
    background: #2b5329;
    color: #fff !important;
    text-decoration: none;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
}

.oghemp-webmcp-advisor-wrap .advisor-action-btn:hover {
    background: #1f3d1e;
}

/* Dual-Mode Switcher Tabs */
.oghemp-webmcp-advisor-wrap .advisor-mode-tabs {
    display: flex;
    background: #f1f5f1;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 14px;
    gap: 4px;
}

.oghemp-webmcp-advisor-wrap .advisor-tab-btn {
    flex: 1 1 50%;
    background: transparent;
    border: none;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #4b634a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.oghemp-webmcp-advisor-wrap .advisor-tab-btn.active {
    background: #ffffff;
    color: #1b381a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Chat Screen Layout */
.oghemp-webmcp-advisor-wrap #hempform-screen-chat {
    display: flex;
    flex-direction: column;
    height: 380px;
}

.oghemp-webmcp-advisor-wrap .advisor-chat-stream {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}

/* Chat Bubbles */
.oghemp-webmcp-advisor-wrap .chat-bubble {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.45;
    animation: oghempBubbleIn 0.25s ease-out;
}

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

.oghemp-webmcp-advisor-wrap .chat-bubble.assistant {
    align-self: flex-start;
    background: #f4f8f4;
    border: 1px solid #dceedd;
    color: #1d2b1c;
    border-bottom-left-radius: 4px;
}

.oghemp-webmcp-advisor-wrap .chat-bubble.user {
    align-self: flex-end;
    background: #25d366;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.oghemp-webmcp-advisor-wrap .chat-bubble .bubble-sender {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    opacity: 0.8;
}

.oghemp-webmcp-advisor-wrap .chat-bubble.assistant .bubble-sender {
    color: #2b5329;
}

.oghemp-webmcp-advisor-wrap .chat-bubble.user .bubble-sender {
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
}

.oghemp-webmcp-advisor-wrap .chat-bubble .bubble-body p {
    margin: 0 0 6px 0;
}

.oghemp-webmcp-advisor-wrap .chat-bubble .bubble-body p:last-child {
    margin-bottom: 0;
}

/* Typing indicator */
.oghemp-webmcp-advisor-wrap .typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    background: #2b5329;
    border-radius: 50%;
    animation: oghempDotPulse 1.2s infinite ease-in-out;
}

.oghemp-webmcp-advisor-wrap .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.oghemp-webmcp-advisor-wrap .typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes oghempDotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* Prompt Chips */
.oghemp-webmcp-advisor-wrap .advisor-prompt-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.oghemp-webmcp-advisor-wrap .advisor-prompt-chips::-webkit-scrollbar {
    display: none;
}

.oghemp-webmcp-advisor-wrap .chip-btn {
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid #d0e2d0;
    color: #2b5329;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

.oghemp-webmcp-advisor-wrap .chip-btn:hover {
    background: #eaf5ea;
    border-color: #25d366;
}

/* Chat Input Bar */
.oghemp-webmcp-advisor-wrap .advisor-chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #d0e2d0;
    border-radius: 12px;
    padding: 4px 6px 4px 12px;
    transition: border-color 0.2s ease;
}

.oghemp-webmcp-advisor-wrap .advisor-chat-input-bar:focus-within {
    border-color: #25d366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.15);
}

.oghemp-webmcp-advisor-wrap .advisor-chat-input-bar input {
    flex: 1 1 auto;
    border: none !important;
    outline: none !important;
    font-size: 12.5px !important;
    padding: 6px 0 !important;
    background: transparent !important;
    color: #1a1a1a !important;
    margin: 0 !important;
}

.oghemp-webmcp-advisor-wrap .advisor-chat-input-bar button {
    background: #25d366;
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

/* Inline Quote Capture Card in Chat */
.oghemp-webmcp-advisor-wrap .chat-quote-card {
    background: #ffffff;
    border: 1.5px solid #25d366;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.12);
    animation: oghempBubbleIn 0.3s ease-out;
}

.oghemp-webmcp-advisor-wrap .chat-quote-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: #132e24;
    margin-bottom: 4px;
}

.oghemp-webmcp-advisor-wrap .chat-quote-card-desc {
    font-size: 11px;
    color: #4b5563;
    line-height: 1.35;
    margin-bottom: 10px;
}

.oghemp-webmcp-advisor-wrap .chat-quote-input-group {
    display: flex;
    gap: 6px;
}

.oghemp-webmcp-advisor-wrap .chat-quote-input {
    flex: 1 1 auto;
    background: #f9fbf9 !important;
    border: 1px solid #c7e0c7 !important;
    border-radius: 8px !important;
    padding: 7px 10px !important;
    font-size: 12px !important;
    color: #1a1a1a !important;
    outline: none !important;
}

.oghemp-webmcp-advisor-wrap .chat-quote-input:focus {
    border-color: #25d366 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2) !important;
}

.oghemp-webmcp-advisor-wrap .chat-quote-submit-btn {
    background: #132e24;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.oghemp-webmcp-advisor-wrap .chat-quote-submit-btn:hover {
    background: #1e4637;
    transform: translateY(-1px);
}

.oghemp-webmcp-advisor-wrap .chat-quote-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.oghemp-webmcp-advisor-wrap .chat-quote-confirmed {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #eef7ee;
    border: 1px solid #bfe3bf;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #144d18;
    line-height: 1.4;
}

/* AI Inaccuracy Disclaimer (Subtle 10px) */
.oghemp-webmcp-advisor-wrap .advisor-ai-disclaimer {
    text-align: center !important;
    font-size: 10px !important;
    line-height: 1.3 !important;
    color: #9ba89b !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
    padding: 0 4px !important;
    letter-spacing: 0.05px !important;
    font-weight: 400 !important;
    display: block !important;
    width: 100% !important;
    opacity: 0.9 !important;
}

/* ==============================================================================
   Mobile Layout (Resting in bottom-right corner, dynamically shifts up when Back-to-Top appears)
   ============================================================================== */
@media (max-width: 767px) {
    .oghemp-webmcp-advisor-wrap {
        right: 16px !important;
        bottom: var(--oghemp-bottom-pos, 16px) !important;
    }

    .oghemp-webmcp-advisor-wrap.has-top-btn {
        bottom: calc(var(--oghemp-bottom-pos, 16px) + 56px) !important;
    }

    .oghemp-webmcp-advisor-wrap .advisor-trigger-btn .advisor-ai-star {
        width: 40px !important;
        height: 40px !important;
    }

    .oghemp-webmcp-advisor-wrap .advisor-dialog-card {
        right: 0 !important;
        bottom: 54px !important;
        width: calc(100vw - 32px) !important;
        max-width: 380px !important;
        max-height: 80vh !important;
        border-radius: 16px !important;
        padding: 16px !important;
    }
}
