/* RFG Studios AI Chatbot Styles */

input[type="text"],
textarea {
    font-size: 16px; 
}

/* Chatbot Button */
#rfg-chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E90FF, #32CD32);
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(30, 144, 255, 0.25);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, box-shadow;
    overflow: hidden;
}

#rfg-chatbot-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 40px rgba(30, 144, 255, 0.35);
}

#rfg-chatbot-button:active {
    transform: scale(0.95);
}

#rfg-chatbot-button svg {
    width: 28px;
    height: 28px;
}

/* Pulse animation for the chatbot button */
.rfg-chatbot-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #1E90FF;
    opacity: 0.6;
    animation: rfg-chatbot-pulse 2s infinite;
    pointer-events: none;
}

@keyframes rfg-chatbot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(1.1);
        opacity: 0;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

/* Chatbot Container */
#rfg-chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 450px;
    max-width: calc(100vw - 40px);
    height: 700px;
    max-height: calc(100vh - 100px);
    background-color: white;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
    border: 1px solid rgba(30, 144, 255, 0.1);
}

#rfg-chatbot-container.rfg-chatbot-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

/* Chatbot Header */
.rfg-chatbot-header {
    background: linear-gradient(135deg, #1E90FF 0%, #32CD32 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    position: relative;
    overflow: hidden;
}

.rfg-chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.rfg-chatbot-title {
    display: flex;
    align-items: center;
}

.rfg-chatbot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    background-color: white;
    object-fit: contain;
}

.rfg-chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.rfg-chatbot-title p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

#rfg-chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#rfg-chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.rfg-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
}

/* Scrollbar Styling */
.rfg-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.rfg-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.rfg-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.rfg-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Message Bubbles */
.rfg-chatbot-message {
    display: flex;
    margin-bottom: 10px;
}

.rfg-chatbot-user-message {
    justify-content: flex-end;
}

.rfg-chatbot-bot-message {
    justify-content: flex-start;
}

.rfg-chatbot-bubble {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    will-change: transform;
    animation: bubbleAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bubbleAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Improved formatting for structured content */
.rfg-chatbot-bubble ul,
.rfg-chatbot-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.rfg-chatbot-bubble li {
    margin-bottom: 6px;
}

/* Style for numbered lists with custom counter display */
.rfg-chatbot-bubble ol {
    counter-reset: item;
    list-style-type: none;
}

.rfg-chatbot-bubble ol li {
    counter-increment: item;
    position: relative;
    padding-left: 8px;
}

.rfg-chatbot-bubble ol li::before {
    content: counter(item) ".";
    position: absolute;
    left: -18px;
    font-weight: bold;
    color: #1E90FF;
}

/* Style for unordered lists */
.rfg-chatbot-bubble ul li {
    position: relative;
    padding-left: 8px;
}

.rfg-chatbot-bubble ul {
    list-style-type: none;
}

.rfg-chatbot-bubble ul li::before {
    content: "•";
    position: absolute;
    left: -15px;
    color: #1E90FF;
    font-weight: bold;
}

/* Paragraph spacing in messages */
.rfg-chatbot-bubble p {
    margin: 8px 0;
}

/* Style for message with numeric steps (using pattern matching) */
.rfg-chatbot-bubble .numeric-step {
    font-weight: bold;
    color: #1E90FF;
    display: inline-block;
    margin-right: 6px;
}

/* Basic text formatting */
.rfg-chatbot-bubble strong,
.rfg-chatbot-bubble b {
    font-weight: bold;
    color: #333;
}

.rfg-chatbot-bubble em,
.rfg-chatbot-bubble i {
    font-style: italic;
}

.rfg-chatbot-user-message .rfg-chatbot-bubble {
    background: linear-gradient(135deg, #1E90FF, #32CD32);
    color: white;
    border-bottom-right-radius: 6px;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.2);
}

.rfg-chatbot-bot-message .rfg-chatbot-bubble {
    background-color: #f8f9fa;
    color: #2c3e50;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(30, 144, 255, 0.1);
    margin-right: auto;
}

.rfg-chatbot-user-message .rfg-chatbot-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    border-radius: inherit;
    pointer-events: none;
}

/* Tip bubbles styling */
.rfg-chatbot-tip {
    background-color: rgba(50, 205, 50, 0.1) !important;
    border-left: 3px solid #32CD32;
    color: #333;
    font-style: italic;
}

/* Hint bubbles styling */
.rfg-chatbot-hints-bubble {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #f0f7ff !important;
    width: 100%;
    max-width: 90%;
    box-sizing: border-box;
}

.rfg-chatbot-hint-button {
    background: white;
    border: 1px solid #1E90FF;
    color: #1E90FF;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    width: 100%;
    box-sizing: border-box;
}

.rfg-chatbot-hint-button:hover {
    background: #1E90FF;
    color: white;
    transform: translateY(-1px);
}

/* Suggested Questions */
.rfg-chatbot-suggestions {
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.rfg-chatbot-suggestion {
    background-color: rgba(30, 144, 255, 0.05);
    color: #1E90FF;
    border: 1px solid rgba(30, 144, 255, 0.2);
    border-radius: 18px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
}

.rfg-chatbot-suggestion::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(30, 144, 255, 0.1), rgba(50, 205, 50, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rfg-chatbot-suggestion:hover,
.rfg-chatbot-suggestion:focus {
    background: linear-gradient(135deg, #1E90FF, #32CD32);
    color: white;
    border-color: transparent;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 15px rgba(30, 144, 255, 0.2);
}

.rfg-chatbot-suggestion:hover::before {
    opacity: 1;
}

.rfg-chatbot-suggestion:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(30, 144, 255, 0.15);
}

/* Add a subtle animation for suggestion buttons */
@keyframes suggestAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rfg-chatbot-suggestion {
    animation: suggestAppear 0.3s ease forwards;
}

.rfg-chatbot-suggestion:nth-child(1) {
    animation-delay: 0s;
}

.rfg-chatbot-suggestion:nth-child(2) {
    animation-delay: 0.1s;
}

.rfg-chatbot-suggestion:nth-child(3) {
    animation-delay: 0.2s;
}

/* Hide suggestions container when empty */
.rfg-chatbot-suggestions.hidden {
    display: none;
}

/* Typing Indicator */
.rfg-chatbot-typing-bubble {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.rfg-chatbot-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: rfg-chatbot-typing 1.4s infinite ease-in-out both;
}

.rfg-chatbot-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.rfg-chatbot-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

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

/* Input Area */
.rfg-chatbot-input-container {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid #e9ecef;
    background-color: white;
    position: relative;
    align-items: center;
}

.rfg-chatbot-input-wrapper {
    position: relative;
    flex: 1;
}

#rfg-chatbot-input {
    width: 100%;
    border: 2px solid rgba(30, 144, 255, 0.1);
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    background-color: white;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    color: #2c3e50;
}

#rfg-chatbot-input:hover {
    border-color: rgba(30, 144, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#rfg-chatbot-input:focus {
    border-color: #1E90FF;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.1);
    transform: translateY(-1px);
}

#rfg-chatbot-input:focus {
    border-color: #1E90FF;
}

.rfg-chatbot-input-hints {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1;
}

/* Hide input hints when input is focused */
#rfg-chatbot-input:focus + .rfg-chatbot-input-hints,
#rfg-chatbot-input:not(:placeholder-shown) + .rfg-chatbot-input-hints {
    opacity: 0;
    visibility: hidden;
}

#rfg-chatbot-send {
    background-color: #1E90FF;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#rfg-chatbot-send:hover {
    background-color: #0078E7;
}

#rfg-chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Helper chips styling */
.rfg-chatbot-helper-text {
    padding: 8px 12px;
    background: #f5f5f5;
    border-top: 1px solid #eee;
    font-size: 13px;
}

.rfg-helper-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rfg-helper-chip {
    background: #1E90FF;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rfg-helper-chip:hover {
    background: #0078e7;
    transform: translateY(-1px);
}

/* Links in chat bubbles */
.rfg-chatbot-bubble a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.rfg-chatbot-bot-message .rfg-chatbot-bubble a {
    color: #1E90FF;
}

.rfg-chatbot-user-message .rfg-chatbot-bubble a {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.7);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #rfg-chatbot-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        bottom: 0;
        right: 0;
        transform: translateY(0);
    }
    
    .rfg-chatbot-suggestions {
        flex-wrap: wrap;
        padding: 8px;
    }
    
    .rfg-chatbot-suggestion {
        margin: 4px;
        max-width: calc(100% - 8px);
        white-space: normal;
        height: auto;
        padding: 8px 12px;
    }
    
    .rfg-chatbot-input-container {
        padding: 10px;
    }
    
    .rfg-chatbot-messages {
        max-height: calc(100% - 180px); /* Adjusted to account for helper chips */
    }
    
    /* Adjust sizing for smaller screens */
    #rfg-chatbot-input {
        padding: 12px;
    }
    
    #rfg-chatbot-send {
        width: 40px;
        height: 40px;
    }
    
    /* Fix for hint buttons on mobile */
    .rfg-chatbot-hints-bubble {
        max-width: 85%;
    }
    
    .rfg-chatbot-hint-button {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    /* Fix for helper chips on mobile */
    .rfg-helper-chips {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .rfg-helper-chip {
        flex-grow: 1;
        text-align: center;
        max-width: calc(50% - 8px);
    }
    
    /* Mobile adjustments for lists */
    .rfg-chatbot-bubble ol,
    .rfg-chatbot-bubble ul {
        padding-left: 16px;
        margin: 6px 0;
    }
    
    .rfg-chatbot-bubble ol li::before {
        left: -16px;
    }
    
    .rfg-chatbot-bubble ul li::before {
        left: -13px;
    }
    
    .rfg-chatbot-bubble li {
        margin-bottom: 5px;
        font-size: 13px;
        line-height: 1.3;
    }
    
    .rfg-chatbot-bubble .numeric-step {
        margin-right: 4px;
    }
}

@media (max-width: 480px) {
    #rfg-chatbot-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    #rfg-chatbot-button svg {
        width: 24px;
        height: 24px;
    }
    
    #rfg-chatbot-container {
        padding-bottom: 0;
    }
    
    .rfg-chatbot-header {
        padding: 12px;
    }
    
    .rfg-chatbot-suggestions {
        padding: 6px;
    }
    
    .rfg-chatbot-suggestion {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    /* Fix for hint buttons on small mobile */
    .rfg-chatbot-hints-bubble {
        max-width: 85%;
    }
    
    .rfg-chatbot-hint-button {
        font-size: 12px;
        padding: 6px 8px;
        border-radius: 6px;
    }
    
    /* Better spacing for input field */
    .rfg-chatbot-input-hints {
        font-size: 13px;
    }
    
    /* Further adjustments for lists on small screens */
    .rfg-chatbot-bubble ol,
    .rfg-chatbot-bubble ul {
        padding-left: 14px;
    }
    
    .rfg-chatbot-bubble ol li::before {
        left: -14px;
        font-size: 12px;
    }
    
    .rfg-chatbot-bubble ul li::before {
        left: -12px;
    }
    
    .rfg-chatbot-bubble li {
        font-size: 12px;
        padding-left: 5px;
    }
    
    /* Handle iOS keyboard appearance */
    @supports (-webkit-touch-callout: none) {
        /* Target iOS devices specifically */
        #rfg-chatbot-container {
            height: -webkit-fill-available;
            max-height: -webkit-fill-available;
        }
        
        .rfg-chatbot-messages {
            max-height: calc(100vh - 180px - 50px); /* Account for iOS keyboard */
        }
    }
} 