/* Recommendation Chat Plugin Styles */

.rcp-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.rcp-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    text-align: center;
}

.rcp-chat-header h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.rcp-chat-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.rcp-context-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-context-section {
    flex: 1;
    min-width: 200px;
}

.rcp-context-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

.rcp-context-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    margin-bottom: 8px;
}

.rcp-context-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.rcp-context-btn:hover {
    background: #45a049;
}

.rcp-active-contexts {
    flex: 2;
    min-width: 250px;
}

.rcp-active-contexts h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

#rcp-active-contexts-list {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    min-height: 40px;
    font-size: 14px;
    color: #666;
}

.rcp-preferences {
    padding: 20px;
    background: #f0f7ff;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-preferences h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

.rcp-preference-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rcp-pref-input {
    flex: 1;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid #b8d4ff;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.rcp-pref-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.rcp-pref-btn:hover {
    background: #0b7dda;
}

#rcp-current-preferences {
    background: white;
    border: 1px solid #b8d4ff;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    color: #666;
}

.rcp-chat-main {
    display: flex;
    flex-direction: column;
    height: 1000px;
}

.rcp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-message {
    margin-bottom: 16px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in;
}

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

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

.rcp-user-message {
    margin-left: auto;
}

.rcp-assistant-message {
    margin-right: auto;
}

.rcp-message-content {
    padding: 4px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
}

.rcp-user-message .rcp-message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

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

.rcp-message-content a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 123, 255, 0.3);
    transition: color 0.2s, border-color 0.2s;
}

.rcp-message-content a:hover {
    color: #0056b3;
    border-color: #0056b3;
}

.rcp-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.rcp-user-message .rcp-message-time {
    text-align: right;
}

.rcp-assistant-message .rcp-message-time {
    text-align: left;
}

.rcp-chat-input-area {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-message-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 12px;
    transition: border 0.2s;
}

.rcp-message-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.rcp-chat-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.rcp-send-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
    flex: 1;
    max-width: 150px;
}

.rcp-send-btn:hover {
    background: #0056b3;
}

.rcp-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rcp-clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
    flex: 1;
    max-width: 150px;
}

.rcp-clear-btn:hover {
    background: #545b62;
}

.rcp-debug-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    margin-left: auto;
}

.rcp-recommendations {
    padding: 20px;
    background: #f8f9fa;
    max-height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-recommendation-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

.rcp-recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rcp-product-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.rcp-product-score {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.rcp-product-details {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.rcp-product-reasoning {
    font-size: 13px;
    color: #888;
    font-style: italic;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.rcp-chat-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    font-size: 13px;
}

#rcp-status-message {
    color: #666;
    font-weight: 500;
}

.rcp-status-indicators {
    display: flex;
    gap: 16px;
}

.rcp-status-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.rcp-status-api {
    background: #e7f3ff;
    color: #0066cc;
}

.rcp-status-context {
    background: #f0f9ff;
    color: #009688;
}

/* Loading animation */
.rcp-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .rcp-context-selector {
        flex-direction: column;
    }

    .rcp-context-section,
    .rcp-active-contexts {
        min-width: 100%;
    }

    .rcp-chat-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .rcp-send-btn,
    .rcp-clear-btn {
        max-width: 100%;
    }

    .rcp-debug-toggle {
        margin-left: 0;
        justify-content: center;
    }

    .rcp-chat-status {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .rcp-status-indicators {
        justify-content: center;
    }
}

/* Typing indicator */
.rcp-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    width: fit-content;
    margin-bottom: 16px;
    border-bottom-left-radius: 4px;
}

.rcp-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {

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

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced recommendation styles */
.rcp-recommendation {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.rcp-recommendation:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rcp-recommendation-with-image {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.rcp-recommendation-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.rcp-recommendation-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.rcp-recommendation:hover .rcp-recommendation-image img {
    transform: scale(1.05);
}

.rcp-recommendation-content {
    flex: 1;
    min-width: 0;
    /* Prevent flex item from overflowing */
}

.rcp-recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.rcp-recommendation-header strong {
    font-size: 16px;
    color: #333;
    flex: 1;
    margin-right: 10px;
    line-height: 1.4;
}

.rcp-recommendation-score {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rcp-recommendation-rating {
    color: #ffc107;
    font-size: 13px;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rcp-recommendation-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.rcp-recommendation-reasoning {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    margin: 10px 0;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 6px;
    border-left: 3px solid #17a2b8;
}

.rcp-recommendation-link {
    margin-top: 12px;
    text-align: right;
}

.rcp-recommendation-link a {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.rcp-recommendation-link a:hover {
    background: #0056b3;
    text-decoration: none;
}

/* Responsive adjustments for product images */
@media (max-width: 768px) {
    .rcp-recommendation-with-image {
        flex-direction: column;
    }

    .rcp-recommendation-image {
        width: 100%;
        height: 180px;
    }

    .rcp-recommendation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .rcp-recommendation-score {
        align-self: flex-start;
    }
}

/* Questionnaire styles */
.rcp-questionnaire-question {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    position: relative;
    z-index: 10;
}

.rcp-question-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

.rcp-question-options {
    display: flex;
    flex-direction: column;
    gap: 0px;
    position: relative;
    z-index: 11;
}

.rcp-question-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 4px 16px;
    margin: 4px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #ffffff;
    font-size: 15px;
    color: #333;
    position: relative;
    overflow: hidden;
    z-index: 12;
    pointer-events: auto !important;
}

.rcp-question-option:hover {
    border-color: #007bff;
    background-color: #e7f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.1);
}

.rcp-question-option.rcp-option-selected {
    border-color: #28a745;
    background-color: #d4edda;
    color: #155724;
}

.rcp-question-option.rcp-option-selected:hover {
    border-color: #1e7e34;
    background-color: #c3e6cb;
}

.rcp-question-option.rcp-option-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.rcp-question-option.rcp-option-disabled:hover {
    border-color: #e0e0e0;
    background-color: #f8f9fa;
    transform: none;
    box-shadow: none;
}

/* Ensure questionnaire options are always clickable */
.rcp-chat-messages .rcp-question-option {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Prevent JavaScript from disabling pointer events */
.rcp-chat-messages .rcp-question-option[style*="pointer-events"] {
    pointer-events: auto !important;
}

.rcp-question-text-input {
    margin-top: -35px;
}

.rcp-question-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.rcp-question-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.rcp-question-submit-text {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.rcp-question-submit-text:hover {
    background: #0056b3;
}

/* Markdown styles in messages */
.rcp-message-content strong {
    font-weight: 600;
    color: #333;
}

.rcp-message-content em {
    font-style: italic;
    color: #555;
}

.rcp-message-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e83e8c;
}

.rcp-message-content a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 123, 255, 0.3);
    transition: color 0.2s, border-color 0.2s;
}

.rcp-message-content a:hover {
    color: #0056b3;
    border-color: #0056b3;
}

/* Chat Widget Styles - Transparent Design */
.rcp-chat-widget {
    position: fixed;
    z-index: 999999;
}

/* Chat button/logo */
.rcp-chat-button {
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000000;
}

.rcp-chat-button:hover {
    transform: scale(1.1);
}

.rcp-chat-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

/* Chat window - transparent overlay */
.rcp-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rcp-chat-window.rcp-chat-window-open {
    display: block;
    opacity: 1;
}

/* Chat overlay - semi-transparent */
.rcp-chat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
}

/* Chat window content - completely transparent container */
.rcp-chat-window-content {
    position: absolute;
    display: flex;
    align-items: flex-start;
    background: transparent;
    z-index: 999999;
    width: 80%;
    max-width: 1200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
}

/* Avatar - floating on left */
.rcp-chat-avatar {
    flex-shrink: 0;
    margin-right: 20px;
    position: relative;
    z-index: 2;
}

.rcp-chat-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9);
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Chat container wrapper - transparent */
.rcp-chat-container-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Transparent chat container */
.rcp-chat-container-wrapper .rcp-chat-container {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    max-width: 100%;
}

/* Transparent header */
.rcp-chat-container-wrapper .rcp-chat-header {
    background: transparent;
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.rcp-chat-container-wrapper .rcp-chat-header h3 {
    color: #333;
    font-size: 20px;
    margin: 0;
}

.rcp-chat-container-wrapper .rcp-chat-subtitle {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* Transparent context selector */
.rcp-chat-container-wrapper .rcp-context-selector {
    background: rgba(248, 249, 250, 0.7);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
}

/* Transparent preferences */
.rcp-chat-container-wrapper .rcp-preferences {
    background: rgba(240, 247, 255, 0.7);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Chat messages area - transparent with scroll */
.rcp-chat-container-wrapper .rcp-chat-main {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: transparent;
}

.rcp-chat-container-wrapper .rcp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Message styling */
.rcp-chat-container-wrapper .rcp-message {
    margin-bottom: 15px;
    max-width: 80%;
}

.rcp-chat-container-wrapper .rcp-user-message {
    margin-left: auto;
}

.rcp-chat-container-wrapper .rcp-assistant-message {
    margin-right: auto;
}

.rcp-chat-container-wrapper .rcp-user-message .rcp-message-content {
    background: rgba(0, 123, 255, 0.9);
    color: white;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    padding: 12px 16px;
    backdrop-filter: blur(5px);
}

.rcp-chat-container-wrapper .rcp-assistant-message .rcp-message-content {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Chat input area - transparent */
.rcp-chat-container-wrapper .rcp-chat-input-area {
    padding: 20px;
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Textarea - rounded and transparent */
.rcp-chat-container-wrapper .rcp-message-input {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    transition: border 0.2s, box-shadow 0.2s;
}

.rcp-chat-container-wrapper .rcp-message-input:focus {
    outline: none;
    border-color: rgba(0, 123, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

/* Chat controls - only buttons visible */
.rcp-chat-container-wrapper .rcp-chat-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Send button - rounded */
.rcp-chat-container-wrapper .rcp-send-btn {
    background: rgba(0, 123, 255, 0.9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    flex: 1;
    max-width: 150px;
    backdrop-filter: blur(5px);
}

.rcp-chat-container-wrapper .rcp-send-btn:hover {
    background: rgba(0, 86, 179, 0.9);
    transform: translateY(-2px);
}

.rcp-chat-container-wrapper .rcp-send-btn:disabled {
    background: rgba(204, 204, 204, 0.9);
    cursor: not-allowed;
    transform: none;
}

/* Reset button - rounded */
.rcp-chat-container-wrapper .rcp-reset-btn {
    background: rgba(108, 117, 125, 0.9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    flex: 1;
    max-width: 150px;
    backdrop-filter: blur(5px);
}

.rcp-chat-container-wrapper .rcp-reset-btn:hover {
    background: rgba(84, 91, 98, 0.9);
    transform: translateY(-2px);
}

/* Close button */
.rcp-chat-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, transform 0.2s;
    z-index: 1000001;
    backdrop-filter: blur(5px);
}

.rcp-chat-close:hover {
    background: rgba(248, 249, 250, 0.9);
    transform: scale(1.1);
}

.rcp-chat-close svg {
    color: #666;
}

/* Position classes */
.rcp-chat-widget-bottom_right {
    bottom: 92px;
    right: 13px;
}

.rcp-chat-widget-bottom_left {
    bottom: 30px;
    left: 30px;
}

.rcp-chat-widget-top_right {
    top: 30px;
    right: 30px;
}

.rcp-chat-widget-top_left {
    top: 30px;
    left: 30px;
}

/* Body class when chat is open */
body.rcp-chat-open {
    overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rcp-chat-window-content {
        flex-direction: column;
        width: 90% !important;
        padding: 10px;
    }

    .rcp-chat-avatar {
        margin-right: 0;
        margin-bottom: 15px;
        align-self: center;
    }

    .rcp-chat-avatar-img {
        width: 80px;
        height: 80px;
    }

    .rcp-chat-container-wrapper .rcp-chat-main {
        height: 500px;
    }

    .rcp-chat-container-wrapper .rcp-chat-controls {
        flex-direction: column;
    }

    .rcp-chat-container-wrapper .rcp-send-btn,
    .rcp-chat-container-wrapper .rcp-reset-btn {
        max-width: 100%;
        width: 100%;
    }

    .rcp-chat-widget-bottom_left,
    .rcp-chat-widget-top_left,
    .rcp-chat-widget-top_right {
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        top: auto !important;
    }
}

/* Animation for chat window */
@keyframes chatWindowFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.rcp-chat-window.rcp-chat-window-open .rcp-chat-window-content {
    animation: chatWindowFadeIn 0.3s ease-out;
}

/* Hide unnecessary elements in transparent mode */
.rcp-chat-container-wrapper .rcp-chat-status,
.rcp-chat-container-wrapper .rcp-debug-toggle,
.rcp-chat-container-wrapper .rcp-recommendations {
    display: none;
}

/* Ensure only the 5 elements are visible: avatar, chat messages, textarea, send button, reset button */
.rcp-chat-container-wrapper .rcp-context-selector,
.rcp-chat-container-wrapper .rcp-preferences,
.rcp-chat-container-wrapper .rcp-chat-header {
    display: none;
}

/* Login required message styles */
.rcp-chat-login-required {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: 80vh;
    /* 80% of viewport height */
    min-height: 500px;
    /* Minimum height for smaller screens */
    max-height: 900px;
    /* Maximum height for very large screens */
    display: flex;
    flex-direction: column;
}

.rcp-chat-login-required .rcp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.rcp-chat-login-required .rcp-message-content h3 {
    margin-top: 0;
    color: #dc3545;
    font-size: 24px;
    margin-bottom: 15px;
}

.rcp-chat-login-required .rcp-message-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #333;
}

.rcp-login-link-container {
    margin-top: 20px;
    text-align: center;
}

.rcp-login-link {
    display: inline-block !important;
    background: #007bff !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    transition: background 0.2s !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1000 !important;
}

.rcp-login-link:hover {
    background: #0056b3;
    text-decoration: none;
    color: white;
}

.rcp-chat-login-required .rcp-chat-input-area {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.rcp-chat-login-required .rcp-message-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 12px;
    background: #e9ecef;
    color: #6c757d;
}

.rcp-chat-login-required .rcp-send-btn,
.rcp-chat-login-required .rcp-reset-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: not-allowed;
    font-size: 15px;
    font-weight: 600;
    opacity: 0.6;
}

/* Login hint on chat button */
.rcp-chat-login-hint {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rcp-chat-login-hint::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: #dc3545 transparent transparent transparent;
}

.rcp-chat-button {
    position: relative;
}

/* Responsive adjustments for login required message */
@media (max-width: 768px) {
    .rcp-chat-login-required {
        height: 70vh;
        /* Slightly smaller on mobile but still tall */
        min-height: 400px;
        max-height: 600px;
    }

    .rcp-chat-login-required .rcp-message-content h3 {
        font-size: 20px;
    }

    .rcp-login-link {
        padding: 10px 20px;
        font-size: 14px;
    }

    .rcp-chat-login-hint {
        top: -30px;
        font-size: 11px;
        padding: 3px 6px;
    }
}