/* Farmrio Chatbot - Pixel Perfect Styles */

:root {
    --fr-bg: #F3F3F3;
    --fr-white: #FFFFFF;
    --fr-black: #000000;
    --fr-text: #000000;
    --fr-text-muted: #555555;
    --fr-card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --fr-window-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --fr-transition: all 0.25s ease;
}

#farmrio-chatbot-root {
    font-family: 'Montserrat', sans-serif;
    z-index: 999999;
}

/* Launcher */
.fr-chatbot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--fr-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--fr-window-shadow);
    z-index: 1000000;
    transition: var(--fr-transition);
}

.fr-chatbot-launcher:hover {
    transform: scale(1.05);
}

/* Chat Window */
.fr-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    /* Standard compact width */
    height: 600px;
    max-height: calc(100vh - 120px);
    background: rgba(243, 243, 243, 0.9);
    /* Slightly translucent */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--fr-window-shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition: var(--fr-transition);
    z-index: 999999;
}

.fr-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.fr-chat-header {
    padding: 24px 24px 16px;
}

.fr-brand-name {
    font-family: 'Playfair Display', serif;
    /* Elegant serif to match Yaropa logo */
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0 0 12px 0;
    letter-spacing: 1px;
}

.fr-greeting {
    font-size: 18px;
    /* More compact */
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    color: var(--fr-text);
}

/* Chat Body */
.fr-chat-body {
    flex: 1;
    /* This ensures the body takes up all space between header and footer input */
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.fr-chat-body::-webkit-scrollbar {
    width: 6px;
}

.fr-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Options Container */
.fr-options-container {
    width: 100%;
}

/* Cards */
.fr-options-card,
.fr-track-card,
.fr-msg-card {
    background: var(--fr-white);
    border-radius: 12px;
    box-shadow: var(--fr-card-shadow);
    overflow: hidden;
}

/* Option Items */
.fr-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
    cursor: pointer;
    transition: background 0.2s;
}

.fr-option-item:last-child {
    border-bottom: none;
}

.fr-option-item:hover {
    background: #F9F9F9;
}

.fr-option-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--fr-text);
}

.fr-arrow {
    font-size: 18px;
    color: #999;
    font-weight: 300;
}

/* Track Card */
.fr-track-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--fr-transition);
}

.fr-track-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.fr-track-icon {
    width: 44px;
    height: 44px;
    background: #F2F2F2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 16px;
}

.fr-track-text {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

/* Message Card */
.fr-msg-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--fr-transition);
}

.fr-bot-avatar {
    width: 40px;
    height: 40px;
    border: 1px solid #EEE;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
}

.fr-msg-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.fr-msg-info p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--fr-text-muted);
}

.fr-send-plane {
    margin-left: auto;
    color: #000;
    transform: rotate(-10deg);
}

/* Input Area */
.fr-input-wrapper {
    margin-top: 8px;
    padding: 10px;
    background: var(--fr-white);
    border-radius: 12px;
    box-shadow: var(--fr-card-shadow);
}

.fr-input-container {
    display: flex;
    align-items: center;
}

.fr-input-container input {
    flex: 1;
    border: none;
    padding: 10px 0;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

#fr-send-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #CCC;
    cursor: pointer;
    padding: 0 10px;
}

.fr-char-count {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 5px;
}

/* Message Bubbles */
.fr-message-bot,
.fr-message-user {
    padding: 12px 16px;
    font-size: 14px;
    max-width: 85%;
    line-height: 1.5;
    animation: slideIn 0.3s ease-out forwards;
    position: relative;
    margin-bottom: 15px;
}

.fr-message-user {
    background: #000;
    color: #fff;
    border-radius: 18px 18px 0 18px;
    align-self: flex-end;
}

.fr-message-bot {
    background: var(--fr-white);
    color: var(--fr-text);
    border-radius: 18px 18px 18px 0;
    align-self: flex-start;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-left: 35px;
    /* Space for avatar */
}

/* Bot Avatar in Chat */
.fr-bot-msg-avatar {
    position: absolute;
    left: -35px;
    bottom: 0;
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Typing Indicator */
.fr-typing {
    display: none;
    align-self: flex-start;
    background: #fff;
    padding: 10px 16px;
    border-radius: 18px 18px 18px 0;
    margin-left: 35px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.fr-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.fr-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.fr-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
.fr-chat-body::-webkit-scrollbar {
    width: 4px;
}

.fr-chat-body::-webkit-scrollbar-thumb {
    background: #DDD;
    border-radius: 10px;
}

@media (max-width: 480px) {
    .fr-chat-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 90px;
    }
}