/* Main Widget Container */
#cla-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Launcher Button */
.cla-launcher {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background-color: #0073aa;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cla-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.cla-launcher:focus {
    outline: 2px solid #005177;
    outline-offset: 2px;
}

/* Chat Window */
.cla-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none;
}

.cla-window.cla-open {
    display: flex;
    animation: cla-slide-up 0.3s ease-out;
}

@keyframes cla-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.cla-header {
    background-color: #0073aa;
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cla-close-btn {
    cursor: pointer;
    font-size: 18px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.cla-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.cla-close-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Messages Area */
.cla-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    scroll-behavior: smooth;
}

.cla-message {
    margin-bottom: 10px;
    max-width: 80%;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    animation: cla-fade-in 0.3s ease-out;
}

@keyframes cla-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cla-message.bot {
    background-color: #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.cla-message.user {
    background-color: #0073aa;
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
}

/* Verification Badge */
.cla-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0a8a0a;
    font-weight: bold;
    font-size: 13px;
}

.cla-verified-badge::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: #0a8a0a;
    border-radius: 50%;
    position: relative;
}

/* Input Area */
.cla-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background-color: white;
}

.cla-input-area input,
.cla-input-area select,
.cla-input-area textarea {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    width: 1%;
}

.cla-input-area input:focus,
.cla-input-area select:focus,
.cla-input-area textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.cla-input-area textarea {
    resize: vertical;
    min-height: 40px;
}

.cla-input-area button {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.cla-input-area button:hover {
    background-color: #005177;
}

.cla-input-area button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.cla-input-area button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Loading Spinner */
.cla-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: cla-spin 0.6s linear infinite;
}

@keyframes cla-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.cla-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
    padding: 5px;
    background-color: #fef7f7;
    border-radius: 4px;
    border: 1px solid #f0c0c0;
}

/* Retry Button */
.cla-retry-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.cla-retry-btn:hover {
    background-color: #005177;
}

.cla-retry-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #cla-chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .cla-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-width: 350px;
        max-height: 500px;
        bottom: 60px;
    }

    .cla-launcher {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
    .cla-launcher {
        border: 2px solid white;
    }

    .cla-message.bot {
        border: 1px solid #999;
    }

    .cla-message.user {
        border: 1px solid #0073aa;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    .cla-window.cla-open,
    .cla-message,
    .cla-launcher {
        animation: none;
    }

    .cla-spinner {
        animation-duration: 1.2s;
    }
}