/* ClearCypher site chat widget — always pinned to the right regardless of page direction */
.cc-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto !important;
    z-index: 10050;
    font-family: inherit;
}

/* Override any RTL rule that would move the widget to the left */
[dir="rtl"] .cc-chat {
    right: 24px !important;
    left: auto !important;
}

.cc-chat-toggle {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #ff4800;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 72, 0, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-chat-toggle:hover,
.cc-chat-toggle[aria-expanded="true"] {
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(255, 72, 0, 0.55);
}

.cc-chat-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    left: auto !important;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: min(520px, calc(100vh - 120px));
    background: rgba(15, 18, 35, 0.55);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 3px solid #ff4800;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255,72,0,0.08) inset;
    flex-direction: column;
    overflow: hidden;
}

[dir="rtl"] .cc-chat-panel {
    right: 0 !important;
    left: auto !important;
}

.cc-chat-panel.open {
    display: flex;
    animation: ccChatFadeIn 0.18s ease;
}

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

.cc-chat-header {
    padding: 14px 16px;
    background: #ff4800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cc-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    flex: 1;
}

.cc-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cc-chat-new,
.cc-chat-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    line-height: 1;
    padding: 5px 7px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-chat-new {
    font-size: 13px;
}

.cc-chat-close {
    font-size: 20px;
}

.cc-chat-new:hover,
.cc-chat-close:hover {
    color: #fff;
    background: rgba(0,0,0,0.2);
}


.cc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 72, 0, 0.45) transparent;
}

/* Custom scrollbar — WebKit */
.cc-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.cc-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.cc-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 72, 0, 0.45);
    border-radius: 10px;
}
.cc-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 72, 0, 0.75);
}

.cc-chat-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.cc-chat-msg.user {
    align-self: flex-end;
    background: #ff4800;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.cc-chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: #e8eaf0;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[dir="rtl"] .cc-chat-msg.user {
    align-self: flex-start;
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 2px;
}

[dir="rtl"] .cc-chat-msg.bot {
    align-self: flex-end;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 2px;
}

.cc-chat-msg.typing {
    opacity: 0.75;
    font-style: italic;
}

.cc-chat-actions {
    padding: 0 12px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cc-chat-actions:empty {
    display: none;
}

.cc-chat-action {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    color: #c8cad8;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.cc-chat-action:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    text-decoration: none;
}

.cc-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cc-chat-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.cc-chat-input:focus {
    border-color: #ff4800;
}

.cc-chat-send {
    border: none;
    border-radius: 8px;
    background: #ff4800;
    color: #fff;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cc-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Lead capture button — brand accent to make it visually distinct */
.cc-chat-action-lead {
    background: rgba(255, 72, 0, 0.15) !important;
    border-color: rgba(255, 72, 0, 0.5) !important;
    color: #ff7040 !important;
}

.cc-chat-action-lead:hover {
    background: rgba(255, 72, 0, 0.28) !important;
    border-color: rgba(255, 72, 0, 0.8) !important;
    color: #ff9070 !important;
}

@media (max-width: 480px) {
    .cc-chat {
        bottom: 16px;
        right: 16px;
        left: auto !important;
    }

    [dir="rtl"] .cc-chat {
        right: 16px !important;
        left: auto !important;
    }

    .cc-chat-panel {
        width: calc(100vw - 32px);
    }
}
