/* Dyronics Rocket Chat - Widget Styles */
:root {
    --drc-primary: #2271b1;
    --drc-hover: #1a5a8a;
    --drc-white: #ffffff;
    --drc-light-gray: #f5f5f5;
    --drc-border: #ddd;
    --drc-shadow: rgba(0, 0, 0, 0.15);
    --drc-text: #333;
    --drc-text-light: #666;
}

.drc-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.drc-widget * {
    box-sizing: border-box;
}

/* Position variations */
.drc-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.drc-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
.drc-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--drc-primary-color, var(--drc-primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--drc-shadow);
    transition: all 0.3s ease;
    position: relative;
}

.drc-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.drc-chat-button svg {
    width: 30px;
    height: 30px;
}

.drc-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Chat Window */
.drc-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.drc-position-bottom-left .drc-chat-window {
    left: 0;
}

.drc-position-bottom-right .drc-chat-window {
    right: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Chat Header */
.drc-chat-header {
    background: var(--drc-primary-color, var(--drc-primary));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drc-header-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.drc-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
    display: block;
}

.drc-close-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.drc-close-button:hover {
    opacity: 1;
}

.drc-close-button svg {
    width: 24px;
    height: 24px;
}

/* Start Form */
.drc-start-form {
    padding: 30px 20px;
    flex: 1;
    overflow-y: auto;
}

.drc-welcome-message {
    background: var(--drc-light-gray);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.drc-start-form input,
.drc-start-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--drc-border);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
}

.drc-start-form input:focus,
.drc-start-form textarea:focus {
    outline: none;
    border-color: var(--drc-primary-color, var(--drc-primary));
}

.drc-button {
    width: 100%;
    padding: 14px;
    background: var(--drc-primary-color, var(--drc-primary));
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.drc-button:hover {
    background: var(--drc-hover);
}

/* Messages Container */
.drc-messages-container {
    flex: 1;
    overflow-y: auto;
    background: var(--drc-light-gray);
}

.drc-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drc-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

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

.drc-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.drc-message.visitor {
    justify-content: flex-end;
}

.drc-message.visitor .drc-message-bubble {
    background: var(--drc-primary-color, var(--drc-primary));
    color: white;
    border-bottom-right-radius: 4px;
}

.drc-message.agent .drc-message-bubble,
.drc-message.system .drc-message-bubble {
    background: white;
    color: var(--drc-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.drc-message-time {
    font-size: 11px;
    color: var(--drc-text-light);
    margin-top: 4px;
}

/* Typing Indicator */
.drc-typing-indicator {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--drc-light-gray);
    font-size: 13px;
    color: var(--drc-text-light);
}

.drc-typing-indicator span:not(.drc-typing-text) {
    width: 8px;
    height: 8px;
    background: var(--drc-text-light);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

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

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

/* Input Area */
.drc-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid var(--drc-border);
}

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

#drc-message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--drc-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 40px;
}

#drc-message-input:focus {
    outline: none;
    border-color: var(--drc-primary-color, var(--drc-primary));
}

.drc-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--drc-primary-color, var(--drc-primary));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.drc-send-button:hover {
    background: var(--drc-hover);
    transform: scale(1.05);
}

.drc-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.drc-send-button svg {
    width: 20px;
    height: 20px;
}

/* Powered by */
.drc-powered-by {
    padding: 8px;
    text-align: center;
    font-size: 11px;
    color: var(--drc-text-light);
    background: var(--drc-light-gray);
    border-top: 1px solid var(--drc-border);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .drc-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }

    .drc-position-bottom-left .drc-chat-window,
    .drc-position-bottom-right .drc-chat-window {
        left: 10px;
        right: 10px;
    }
}

/* Loading state */
.drc-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.drc-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--drc-border);
    border-top-color: var(--drc-primary-color, var(--drc-primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}