/* Rapid Reply Chat Widget Styles */

:root {
    --rr-primary-color: #1e5aa8;
    --rr-primary-hover: #164a8f;
    --rr-bg-color: #ffffff;
    --rr-text-primary: #2c3e50;
    --rr-text-secondary: #7f8c8d;
    --rr-border-color: #e1e8ed;
    --rr-user-message: #1e5aa8;
    --rr-bot-message: #f5f7fa;
}

.rr-theme-blue {
    --rr-primary-color: #1e5aa8;
    --rr-primary-hover: #164a8f;
    --rr-user-message: #1e5aa8;
}

.rr-theme-green {
    --rr-primary-color: #27ae60;
    --rr-primary-hover: #229954;
    --rr-user-message: #27ae60;
}

.rr-theme-orange {
    --rr-primary-color: #e67e22;
    --rr-primary-hover: #d35400;
    --rr-user-message: #e67e22;
}

#rr-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--rr-primary-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(30, 90, 168, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9998;
    overflow: hidden;
}

#rr-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(30, 90, 168, 0.4);
}

#rr-chat-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

#rr-chat-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#rr-chat-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--rr-bg-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid var(--rr-border-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#rr-chat-widget.rr-open {
    display: flex;
    animation: rrSlideUp 0.3s ease;
}

@keyframes rrSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rr-chat-header {
    background: var(--rr-bg-color);
    padding: 24px 24px 20px 24px;
    border-bottom: 1px solid var(--rr-border-color);
    flex-shrink: 0;
}

.rr-chat-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.rr-chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rr-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rr-primary-color), var(--rr-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.rr-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rr-chat-header-text h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--rr-text-primary);
    margin: 0 0 2px 0;
}

.rr-chat-header-text p {
    font-size: 13px;
    color: var(--rr-text-secondary);
    margin: 0;
}

.rr-status-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: rrPulse 2s infinite;
}

@keyframes rrPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.rr-close-button {
    background: none;
    border: none;
    color: var(--rr-text-secondary);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s;
}

.rr-close-button:hover {
    background: #f5f7fa;
    color: var(--rr-text-primary);
}

.rr-contact-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
}

.rr-contact-form h4 {
    font-size: 20px;
    color: var(--rr-text-primary);
    font-weight: 600;
    margin: 0 0 4px 0;
}

.rr-contact-form p {
    font-size: 14px;
    color: var(--rr-text-secondary);
    margin: 0 0 8px 0;
}

.rr-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rr-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--rr-text-primary);
}

.rr-contact-form input {
    padding: 14px 16px;
    border: 1px solid var(--rr-border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
    background: #fafbfc;
}

.rr-contact-form input:focus {
    outline: none;
    border-color: var(--rr-primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.1);
}

.rr-contact-form button {
    padding: 14px;
    background: var(--rr-primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    flex-shrink: 0;
}

.rr-contact-form button:hover {
    background: var(--rr-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 90, 168, 0.3);
}

.rr-contact-form button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rr-error-message {
    color: #e74c3c;
    font-size: 13px;
    min-height: 18px;
}

.rr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafbfc;
}

.rr-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.rr-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.rr-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.rr-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

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

.rr-message.rr-bot {
    background: var(--rr-bot-message);
    color: var(--rr-text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--rr-border-color);
}

.rr-message.rr-agent {
    background: #dbeafe;
    color: #1e40af;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #3b82f6;
}

.rr-message.rr-typing {
    background: var(--rr-bot-message);
    padding: 16px;
    width: 70px;
    border: 1px solid var(--rr-border-color);
}

.rr-typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.rr-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #95a5a6;
    animation: rrTyping 1.4s infinite;
}

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

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

@keyframes rrTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.rr-chat-input {
    padding: 20px 24px 24px 24px;
    border-top: 1px solid var(--rr-border-color);
    background: var(--rr-bg-color);
    flex-shrink: 0;
}

.rr-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.rr-chat-input input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--rr-border-color);
    border-radius: 12px;
    font-size: 15px;
    background: #fafbfc;
    transition: all 0.2s;
}

.rr-chat-input input:focus {
    outline: none;
    border-color: var(--rr-primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.1);
}

.rr-send-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: var(--rr-primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.rr-send-button:hover {
    background: var(--rr-primary-hover);
    transform: translateY(-1px);
}

.rr-send-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.rr-send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

#rr-agent-banner {
    display: none;
    background: #fef3c7;
    border-bottom: 1px solid #fbbf24;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: #92400e;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    #rr-chat-widget {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }

    #rr-chat-button {
        bottom: 20px;
        right: 20px;
    }

    .rr-contact-form {
        padding: 20px;
    }
}
