/**
 * Cartt Chat Widget Styles
 * @since 1.4.2
 */

#cartt-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#cartt-chat-widget.position-left {
    right: auto;
    left: 20px;
}

.cartt-chat-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cartt-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.cartt-chat-button .dashicons {
    color: #fff;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.cartt-chat-button .cartt-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cartt-chat-window {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    overflow: hidden;
    flex-direction: column;
}

#cartt-chat-widget.position-left .cartt-chat-window {
    right: auto;
    left: 0;
}

.cartt-chat-window.open {
    display: flex;
}

.cartt-chat-header {
    padding: 16px 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cartt-chat-title {
    font-weight: 600;
    font-size: 15px;
}

.cartt-chat-close {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
}

.cartt-chat-close:hover {
    opacity: 1;
}

.cartt-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
}

.cartt-chat-greeting {
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.cartt-chat-msg {
    margin-bottom: 10px;
    display: flex;
}

.cartt-chat-msg.visitor {
    justify-content: flex-end;
}

.cartt-chat-msg.admin {
    justify-content: flex-start;
}

.cartt-chat-msg-bubble {
    max-width: 80%;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.cartt-chat-msg.visitor .cartt-chat-msg-bubble {
    background: #1d2327;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cartt-chat-msg.admin .cartt-chat-msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.cartt-chat-input {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.cartt-chat-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.cartt-chat-field:focus {
    outline: none;
    border-color: #1d2327;
}

.cartt-chat-compose {
    display: flex;
    gap: 8px;
}

.cartt-chat-compose textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    height: 40px;
    font-family: inherit;
}

.cartt-chat-compose textarea:focus {
    outline: none;
    border-color: #1d2327;
}

.cartt-chat-compose button {
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cartt-chat-compose button:hover {
    opacity: 0.9;
}

.cartt-chat-compose button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Typing indicator */
.cartt-chat-typing {
    display: none;
    padding: 12px 16px;
    font-size: 13px;
    color: #999;
}

.cartt-chat-typing.show {
    display: block;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #cartt-chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    #cartt-chat-widget.position-left {
        left: 10px;
    }
    
    .cartt-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 66px;
        right: -10px;
        border-radius: 12px 12px 0 0;
    }
    
    #cartt-chat-widget.position-left .cartt-chat-window {
        left: -10px;
        right: auto;
    }
}
