/**
 * RS Chatbot Frontend Styles - Unified
 */

/* CSS Variables for Dynamic Values */
:root {
    --rs-chatbot-accent-color: #007cba;
    --rs-chatbot-header-text-color: #fff;
    --rs-chatbot-chatbot-width: 400px;
    --rs-chatbot-chatbot-height: 500px;
    --rs-chatbot-chatbot-modal-bg-color: #d9d9d9;
    --rs-chatbot-theme-box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    --rs-chatbot-theme-backdrop-blur: 10px;
}

.rs-chatbot-form-group input {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #222;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    outline: none;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    display: block;
    font-family: inherit;
    font-weight: 400;

    /* Placeholder styling */
    &::placeholder {
        color: #aaa;
        opacity: 1;
    }

    &:focus {
        border-color: var(--rs-chatbot-accent-color);
        box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.10);
        background: #f9f9f9;
    }

    /* Validation styles */
    &.rs-chatbot-valid {
        border-color: #28a745;
        box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.10);
    }

    &.rs-chatbot-invalid {
        border-color: #dc3545;
        box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.10);
    }

}

.rs-chatbot-input-area input,
.rs-chatbot-input-area textarea {
    scrollbar-width: none;
    min-width: 0px;
    width: auto;
    border: none;
    padding-inline: 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background-color: transparent;
    flex: 1;

    resize: none;
}

/* Overlay */
.rs-chatbot-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 9990;
}

/* Chat Widget Container */
.rs-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Chat Icon */
.rs-chatbot-icon {
    width: 60px;
    height: 60px;
    background: var(--rs-chatbot-accent-color);
    background-image: var(--rs-chatbot-gold-texture);
    background-size: cover;
    border-radius: 50%;
    display: flex;
    border: none;

    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
    position: relative;
    user-select: none;
}

.rs-chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.rs-chatbot-icon:active {
    transform: scale(0.95);
}

.rs-chatbot-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.rs-chatbot-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Notification Badge */
.rs-chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: rs-chatbot-pulse 2s infinite;
}

@keyframes rs-chatbot-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Chat Modal */
.rs-chatbot-modal {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: var(--rs-chatbot-chatbot-width);
    height: var(--rs-chatbot-chatbot-height);
    background: var(--rs-chatbot-chatbot-modal-bg-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rs-chatbot-slide-up 0.3s ease;
}

@keyframes rs-chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Modal Header */
.rs-chatbot-modal-header {
    /*background-image: var(--rs-chatbot-gold-texture);
    background-size: cover;*/
    background: var(--rs-chatbot-accent-color);
    color: var(--rs-chatbot-header-text-color);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.rs-chatbot-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.rs-chatbot-close {
    background: none;
    border: none;
    color: var(--rs-chatbot-header-text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    user-select: none;
}

.rs-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.rs-chatbot-close:active {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Body */
.rs-chatbot-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Registration Form Styles */
.rs-chatbot-registration {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    border: 2px solid black;
    border-image: linear-gradient(0deg, var(--rs-chatbot-accent-color), transparent) 1;
    border-radius: 6px;
    z-index: 10;
    position: relative;
}

.rs-chatbot-registration-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    max-width: 300px;
    margin: 0 auto;
}

.rs-chatbot-registration-header {
    text-align: center;
    margin-bottom: 30px;
}

.rs-chatbot-registration-header h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.rs-chatbot-registration-header p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.rs-chatbot-registration-form {
    padding: 25px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.rs-chatbot-form-group {

    margin-bottom: 20px;
    text-align: left;
}

.rs-chatbot-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

/* 
.rs-chatbot-form-group input,
.rs-chatbot-form-group textarea {
    width: 100%;
    /* border: 1px solid #e9ecef; 
        padding: 12px 15px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.rs-chatbot-form-group input:focus,
.rs-chatbot-form-group textarea:focus {
    border: none;
    border-color: var(--rs-chatbot-accent-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
}

.rs-chatbot-form-group textarea {
    resize: vertical;
    min-height: 80px;
} */

.rs-chatbot-register-btn {
    /* width: 100%; */
    background: var(--rs-chatbot-accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 10px;
}

.rs-chatbot-register-btn:hover {
    filter: brightness(0.9);
}

.rs-chatbot-register-btn:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
}

/* Chat Interface */
.rs-chatbot-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    position: relative;
}

/* Preloader */
.rs-chatbot-preloader {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.rs-chatbot-preloader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--rs-chatbot-accent-color);
    border-radius: 50%;
    animation: rs-chatbot-spin 1s linear infinite;
    margin-bottom: 15px;
}

.rs-chatbot-preloader p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

/* Messages Area */
.rs-chatbot-messages {
    flex: 1;
    padding: 20px;
    padding-bottom: 40px;
    overflow-y: auto;
    scroll-behavior: smooth;

    border: 2px solid black;
    border-bottom: 0px solid black;
    border-top: none;
    border-image: linear-gradient(to bottom, var(--rs-chatbot-accent-color) 0%, transparent 100%) 1;
    display: flex;
    flex-direction: column;

}

.rs-chatbot-messages::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 2px;
    width: calc(100% - 4px);
    /* height: 100%; */
    height: calc(100% - 87px);
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.15) 0%, transparent 20%, transparent 90%, rgba(255, 255, 255, 0.336) 100%);
}

.rs-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.rs-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

.rs-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Welcome Message */
.rs-chatbot-welcome {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 20px;
}

.rs-chatbot-welcome p {
    margin: 0;
    font-size: 14px;
}

/* Individual Messages */
.rs-chatbot-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    animation: rs-chatbot-fade-in 0.3s ease;
}

@keyframes rs-chatbot-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.rs-chatbot-message.user {
    align-items: flex-end;
}

.rs-chatbot-message.assistant {
    align-items: flex-start;
}

.rs-chatbot-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.rs-chatbot-message.user .rs-chatbot-message-content {
    background: var(--rs-chatbot-accent-color);
    color: var(--rs-chatbot-user-chat-text-color);
    border-bottom-right-radius: 4px;
}

.rs-chatbot-message.assistant .rs-chatbot-message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Options Container */
.rs-chatbot-options {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
}

/* Options Dismiss Button */
.rs-chatbot-options-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 10;
}

.rs-chatbot-options-dismiss:hover {
    background: #495057;
}

/* Option Buttons */
.rs-chatbot-option-btn {
    background: white;
    color: var(--rs-chatbot-accent-color);
    border: 2px solid var(--rs-chatbot-accent-color);
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: left;
}

.rs-chatbot-option-btn:hover {
    background: var(--rs-chatbot-accent-color);
    color: var(--rs-chatbot-header-text-color);
    transform: scale(1.05);
}

/* Initial Options */
.rs-chatbot-initial-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 25px;
}

.rs-chatbot-initial-options .rs-chatbot-option-btn {
    margin: 0 8px 8px 0;
    background: white;
    color: var(--rs-chatbot-accent-color);
    border: 2px solid var(--rs-chatbot-accent-color);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    font-weight: 500;
}

.rs-chatbot-initial-options .rs-chatbot-option-btn:hover {
    background: var(--rs-chatbot-accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 186, 0.3);
}

/* Input Area */
.rs-chatbot-input-area {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* WhatsApp-style Input */
.rs-chatbot-input-wrapper {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    background: rgb(255, 255, 255);
    border-radius: 9999px;
    border: 1.4px solid var(--rs-chatbot-accent-color);
    width: 100%;
    overflow: hidden;
}

.rs-chatbot-input-wrapper:focus-within {
    border-color: var(--rs-chatbot-accent-color);
}

.rs-chatbot-input {
    flex: 1;
    border: none;
    background: transparent !important;
    padding: 8px 0;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    height: auto;
    min-height: 20px;
    max-height: 120px;
}

.rs-chatbot-input:focus {
    border: none !important;
    outline: none !important;
}

.rs-chatbot-send-btn {
    background: var(--rs-chatbot-accent-color);
    background-image: var(--rs-chatbot-gold-texture);
    background-size: cover;
    color: var(--rs-chatbot-header-text-color);
    border: none;
    padding-inline: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 44px;
    height: 44px;
    font-weight: 600;
}

.rs-chatbot-send-btn:hover {
    background: var(--rs-chatbot-accent-color);
    transform: scale(1.05);
}

.rs-chatbot-send-btn:active {
    background: var(--rs-chatbot-accent-color);
}

.rs-chatbot-send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.rs-chatbot-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Modal Footer */
.rs-chatbot-modal-footer {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* Status Indicator */
.rs-chatbot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
}

.rs-chatbot-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    transition: background 0.3s ease;
}

.rs-chatbot-status.connected .rs-chatbot-status-indicator {
    background: #28a745;
    animation: rs-chatbot-pulse 2s infinite;
}

.rs-chatbot-status.disconnected .rs-chatbot-status-indicator {
    background: #dc3545;
}

.rs-chatbot-status.connecting .rs-chatbot-status-indicator {
    background: #ffc107;
    animation: rs-chatbot-spin 1s linear infinite;
}

@keyframes rs-chatbot-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.rs-chatbot-status-text {
    font-weight: 500;
}

/* Links Styling */
.rs-chatbot-links {
    margin-top: 2px;
}

.rs-chatbot-links-divider {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 10px 0;
}

.rs-chatbot-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--rs-chatbot-accent-color);
    text-decoration: none;
    font-weight: 600;
    padding: 3px 0;
    transition: all 0.2s ease;
}

.rs-chatbot-link:hover {
    text-decoration: underline;
}

.rs-chatbot-link-arrow {
    flex-shrink: 0;
    margin-left: 8px;
}

/* Text Links */
.rs-chatbot-text-link {
    color: var(--rs-chatbot-accent-color);
    text-decoration: underline;
}

.rs-chatbot-text-link:hover {
    color: #005a87;
}

/* Special Text */
.rs-chatbot-special-text {
    color: var(--rs-chatbot-accent-color);
    font-weight: bold;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .rs-chatbot-modal {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 120px) !important;
        right: 20px;
        left: 20px;
        bottom: 60px;
        max-height: calc(100vh - 120px);
    }

    .rs-chatbot-icon {
        width: 50px;
        height: 50px;
    }

    .rs-chatbot-icon svg,
    .rs-chatbot-icon img {
        width: 20px;
        height: 20px;
    }

    .rs-chatbot-modal-header {
        padding: 12px 16px;
    }

    .rs-chatbot-modal-header h3 {
        font-size: 15px;
    }

    .rs-chatbot-messages {
        padding: 15px;
    }

    .rs-chatbot-message-content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .rs-chatbot-input-area {
        padding: 15px;
    }

    .rs-chatbot-send-btn {
        min-width: 40px;
        height: 40px;
        padding-inline: 10px;
    }

    .rs-chatbot-registration {
        padding: 15px;
    }

    .rs-chatbot-registration-form {
        padding: 20px;
    }

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

    .rs-chatbot-options {
        padding: 12px 15px;
        gap: 6px;
    }

    .rs-chatbot-option-btn {
        font-size: 14px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .rs-chatbot-modal {
        width: calc(100vw - 20px) !important;
        right: 10px;
        left: 10px;
        bottom: 40px;
        height: calc(100vh - 100px) !important;
    }

    .rs-chatbot-icon {
        width: 45px;
        height: 45px;
        right: 10px;
        bottom: 10px;
    }

    .rs-chatbot-icon svg,
    .rs-chatbot-icon img {
        width: 18px;
        height: 18px;
    }

    .rs-chatbot-modal-header {
        padding: 10px 12px;
    }

    .rs-chatbot-modal-header h3 {
        font-size: 14px;
    }

    .rs-chatbot-messages {
        padding: 12px;
    }

    .rs-chatbot-message-content {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 13px;
    }

    .rs-chatbot-input-area {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
    }

    /* .rs-chatbot-send-btn {
        /* width: 100%; 
        border-radius: 99999px;
        min-width: auto;
        height: 40px;
    }
     */
    .rs-chatbot-registration {
        padding: 12px;
    }

    .rs-chatbot-registration-form {
        padding: 15px;
    }

    .rs-chatbot-registration-header h4 {
        font-size: 16px;
    }

    .rs-chatbot-registration-header p {
        font-size: 13px;
    }

    .rs-chatbot-form-group input,
    .rs-chatbot-form-group textarea {
        padding: 10px 12px;
        font-size: 13px;
    }

    .rs-chatbot-register-btn {
        padding: 12px;
        font-size: 14px;
    }

    .rs-chatbot-options {
        padding: 10px 12px;
        gap: 4px;
    }

    .rs-chatbot-option-btn {
        font-size: 14px;
        padding: 4px 8px;
    }
}

@media (max-width: 360px) {
    .rs-chatbot-modal {
        width: calc(100vw - 10px) !important;
        right: 5px;
        left: 5px;
        bottom: 20px;
        height: calc(100vh - 80px) !important;
    }

    .rs-chatbot-icon {
        width: 40px;
        height: 40px;
        right: 5px;
        bottom: 5px;
    }

    .rs-chatbot-icon svg,
    .rs-chatbot-icon img {
        width: 16px;
        height: 16px;
    }

    .rs-chatbot-modal-header {
        padding: 8px 10px;
    }

    .rs-chatbot-modal-header h3 {
        font-size: 13px;
    }

    .rs-chatbot-messages {
        padding: 10px;
    }

    .rs-chatbot-message-content {
        max-width: 95%;
        padding: 6px 10px;
        font-size: 12px;
    }

    .rs-chatbot-input-area {
        padding: 10px;
    }


    .rs-chatbot-send-btn {
        height: 36px;
        font-size: 12px;
    }

    .rs-chatbot-registration {
        padding: 10px;
    }

    .rs-chatbot-registration-form {
        padding: 12px;
    }

    .rs-chatbot-registration-header h4 {
        font-size: 15px;
    }

    .rs-chatbot-registration-header p {
        font-size: 12px;
    }

    .rs-chatbot-form-group {
        margin-bottom: 12px;
    }

    .rs-chatbot-form-group input,
    .rs-chatbot-form-group textarea {
        padding: 8px 10px;
        font-size: 12px;
    }

    .rs-chatbot-register-btn {
        padding: 10px;
        font-size: 13px;
    }
}


/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .rs-chatbot-icon,
    .rs-chatbot-modal,
    .rs-chatbot-message,
    .rs-chatbot-notification,
    .rs-chatbot-option-btn,
    .rs-chatbot-send-btn {
        animation: none;
        transition: none;
    }

    .rs-chatbot-icon:hover,
    .rs-chatbot-option-btn:hover,
    .rs-chatbot-send-btn:hover {
        transform: none;
    }
}


/* Print Styles */
@media print {
    .rs-chatbot-widget {
        display: none !important;
    }
}
