/* Caribbean Motors Live Chat - Frontend Styles */

:root {
    --cm-primary: #8B1538;
    --cm-secondary: #A91B47;
}

/* Widget Container */
#cm-livechat-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#cm-livechat-widget.cm-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#cm-livechat-widget.cm-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#cm-livechat-widget.cm-position-top-right {
    top: 20px;
    right: 20px;
}

#cm-livechat-widget.cm-position-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Button */
.cm-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-secondary) 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 21, 56, 0.4);
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.cm-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 21, 56, 0.6);
}

.cm-chat-button svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
}

/* Chat Window */
.cm-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 420px;
    max-height: calc(100vh - 120px);
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
    z-index: 99999;
}

#cm-livechat-widget.cm-position-bottom-left .cm-chat-window,
#cm-livechat-widget.cm-position-top-left .cm-chat-window {
    right: auto;
    left: 20px;
}

#cm-livechat-widget.cm-position-top-right .cm-chat-window,
#cm-livechat-widget.cm-position-top-left .cm-chat-window {
    bottom: auto;
    top: 90px;
}

.cm-chat-window.cm-hidden {
    display: none;
}

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

/* Chat Header */
.cm-chat-header {
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-secondary) 100%);
    color: white;
    padding: 16px 20px;
    flex-shrink: 0;
}

.cm-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cm-logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cm-logo-placeholder {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.cm-logo-section h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.cm-header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.95;
    color: white;
}

.cm-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.cm-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.cm-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Pre-Chat Form */
.cm-prechat-form {
    display: flex;
    flex-direction: column;
    padding: 30px 24px;
    background: white;
    flex: 1;
    overflow-y: auto;
}

.cm-prechat-form.cm-hidden {
    display: none;
}

.cm-prechat-icons {
    text-align: center;
    margin-bottom: 16px;
}

.cm-chat-icon {
    font-size: 48px;
    opacity: 0.8;
}

.cm-prechat-form h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
}

.cm-prechat-form p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

.cm-form-group {
    margin-bottom: 16px;
}

.cm-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.cm-optional {
    font-weight: 400;
    font-size: 12px;
    color: #999;
}

.cm-form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s;
    background: #fafafa;
}

.cm-form-input:focus {
    outline: none;
    border-color: var(--cm-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.cm-btn-start {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 21, 56, 0.3);
}

.cm-btn-start:active {
    transform: translateY(0);
}

.cm-whatsapp-divider {
    text-align: center;
    margin: 20px 0;
    font-size: 12px;
    color: #999;
    position: relative;
}

.cm-whatsapp-divider::before,
.cm-whatsapp-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #ddd;
}

.cm-whatsapp-divider::before {
    left: 0;
}

.cm-whatsapp-divider::after {
    right: 0;
}

.cm-whatsapp-btn {
    width: 100%;
    padding: 12px 16px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cm-whatsapp-btn:hover {
    background: #20ba5a;
}

/* Messages Container */
.cm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f5f5;
}

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

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

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

.cm-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeIn 0.3s ease;
}

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

.cm-message.cm-bot {
    align-items: flex-start;
}

.cm-message.cm-customer,
.cm-message.cm-admin {
    align-items: flex-end;
}

.cm-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cm-message.cm-bot .cm-message-content {
    background: white;
    color: #333;
    border-left: 3px solid var(--cm-primary);
}

.cm-message.cm-customer .cm-message-content,
.cm-message.cm-admin .cm-message-content {
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-secondary) 100%);
    color: white;
}

.cm-message-content p {
    margin: 0;
    font-size: 14px;
}

.cm-timestamp {
    font-size: 11px;
    color: #999;
    padding: 0 4px;
}

/* System Message */
.cm-system-message {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 8px 0;
    font-style: italic;
}

.cm-system-message strong {
    color: #666;
    font-style: normal;
}

/* Input Area */
.cm-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.cm-input-area.cm-hidden {
    display: none;
}

.cm-input-area form {
    display: flex;
    gap: 8px;
}

.cm-message-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fafafa;
}

.cm-message-input:focus {
    border-color: var(--cm-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.1);
}

.cm-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cm-send-btn:hover {
    transform: scale(1.05);
}

.cm-send-btn:active {
    transform: scale(0.95);
}

.cm-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .cm-chat-window {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        bottom: 0 !important;
        top: auto !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        z-index: 99999;
    }
    
    #cm-livechat-widget.cm-position-bottom-left .cm-chat-window,
    #cm-livechat-widget.cm-position-top-left .cm-chat-window,
    #cm-livechat-widget.cm-position-top-right .cm-chat-window {
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        top: auto !important;
    }
    
    .cm-chat-button {
        width: 56px;
        height: 56px;
    }
    
    .cm-message-content {
        max-width: 90%;
    }
    
    .cm-prechat-form {
        padding: 20px 16px;
    }
}
