/* Chat Widget Styles for Flayri Website */
.flayri-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: 'Montserrat', sans-serif;
}

.flayri-chat-toggle {
    background-color: var(--primary-color); /* Using site's purple color */
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
    transition: all 0.3s ease;
}

.flayri-chat-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(124, 58, 237, 0.4);
    background-color: #6D28D9; /* Slightly darker on hover */
}

.flayri-chat-toggle i {
    font-size: 24px;
    margin-bottom: 3px;
}

.flayri-chat-toggle span {
    font-size: 0;
    transition: all 0.3s ease;
}

.flayri-chat-toggle:hover span {
    font-size: 10px;
}

.flayri-chat-container {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 350px;
    height: 450px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.flayri-chat-container.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* Chat Interface Styles */
.flayri-chat-ui {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Add CSS variables for color scheme */
:root {
  --primary-color: #7C3AED; /* Purple color used in Flayri site */
  --secondary-color: #333;
  --text-light: #666;
  --border-color: #e0e0e0;
  --danger-color: #E53E3E;
}

.flayri-chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flayri-chat-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flayri-chat-header-logo {
    width: 30px;
    height: 30px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-color);
}

.flayri-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.flayri-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
}

.flayri-chat-close:hover {
    opacity: 0.8;
}

.flayri-chat-stages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.flayri-chat-stage {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.flayri-chat-qualification-stage {
    overflow-y: auto;
}

.flayri-chat-stage.active {
    display: flex;
}

.flayri-chat-welcome {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 15px;
}

.flayri-chat-welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.flayri-chat-welcome-icon i {
    font-size: 40px;
    color: var(--primary-color);
}

.flayri-chat-welcome h2 {
    font-size: 20px;
    color: var(--secondary-color);
    margin: 0 0 5px 0;
}

.flayri-chat-welcome p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.flayri-chat-form {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    max-height: 100%;
    overscroll-behavior: contain;
}

.flayri-form-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.flayri-form-description {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.flayri-form-group {
    margin-bottom: 15px;
}

.flayri-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.flayri-form-group input,
.flayri-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
}

.flayri-form-group input:focus,
.flayri-form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.flayri-form-group input::placeholder {
    color: #aaa;
}

.flayri-form-error {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 5px;
}

.flayri-form-buttons {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.flayri-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.flayri-btn-secondary {
    background-color: #f0f0f0;
    color: var(--secondary-color);
}

.flayri-btn-secondary:hover {
    background-color: #e0e0e0;
}

.flayri-btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

.flayri-btn-primary:hover {
    background-color: #6D28D9;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(124, 58, 237, 0.4);
}

.flayri-btn-primary:disabled {
    background-color: #a0afd7;
    cursor: not-allowed;
}

.flayri-chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.flayri-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100% - 60px); /* Adjust for input area height */
    overscroll-behavior: contain;
}

.flayri-message {
    padding: 12px 15px;
    border-radius: 18px;
    max-width: 80%;
    word-break: break-word;
    line-height: 1.4;
    position: relative;
    font-size: 14px;
}

.flayri-message.system {
    background-color: rgba(124, 58, 237, 0.1);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

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

.flayri-message.system.greeting {
    width: 95%;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 500;
}

.flayri-chat-input {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.flayri-chat-input textarea {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    resize: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    height: 60px;
    transition: border-color 0.3s;
}

.flayri-chat-input textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.flayri-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    align-self: flex-end;
    margin-bottom: 10px;
}

.flayri-typing {
    align-self: flex-start;
    background-color: rgba(124, 58, 237, 0.05);
    padding: 12px 15px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.flayri-typing span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #aaa;
    border-radius: 50%;
    animation: flayri-typing 1s infinite ease-in-out;
}

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

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

@keyframes flayri-typing {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .flayri-chat-container {
        width: 300px;
        height: 400px;
        bottom: 70px;
    }
}

/* Animation for new messages */
@keyframes flayri-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flayri-message {
    animation: flayri-message-appear 0.3s ease-out;
}