/**
 * Cortex WP Floating Chat Widget Styles
 *
 * @package CortexWP
 * @since 1.0.0
 */

/* === Floating Widget Container === */
.cortex-wp-floating-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

/* === Floating Button (60x60px circle) === */
.cortex-wp-floating-toggle {
    width: 60px !important;
    height: 60px !important;
    min-width: auto !important;
    min-height: auto !important;
    border-radius: 100px !important;
    background: #222;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease !important;
    position: absolute !important;
    z-index: 2;
    right: 0;
    bottom: 0;
}

.cortex-wp-floating-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.cortex-wp-floating-toggle i {
    color: white;
    font-size: 24px;
    transition: all 0.2s ease;
}

/* Custom icon image styling */
.cortex-wp-floating-custom-icon {
    max-width: 32px;
    max-height: 32px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: all 0.2s ease;
}

/* Icon toggle animations */
.cortex-wp-icon-chat,
.cortex-wp-icon-close {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    color: white;
}

/* === Welcome Bubble === */
.cortex-wp-welcome-bubble {
    right: 0;
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    animation: cortexBubbleFadeIn 0.3s ease;
    z-index: 1;
    text-align: center;
    width: auto;
    margin-bottom: 75px;
    position: relative;
}

.cortex-wp-welcome-bubble p {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    color: #555;
    margin: 0;
}

.cortex-wp-welcome-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.cortex-wp-welcome-close:hover {
    color: #333;
}

.cortex-wp-welcome-bubble::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
}

/* Hide welcome bubble */
.cortex-wp-welcome-bubble.hidden {
    display: none;
}

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

/* === Chat Panel (dimensions set via inline styles) === */
.cortex-wp-floating-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 390px;
    height: 600px;
    max-height: 75vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: cortexPanelSlideIn 0.3s ease;
}

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

/* Override chat wrapper height for popup */
.cortex-wp-floating-panel .cortex-wp-chat-wrapper {
    height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.cortex-wp-floating-panel .cortex-wp-chat-container {
    height: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Panel Header */
.cortex-wp-floating-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #222;
    color: #fff;
}

.cortex-wp-floating-title {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}

.cortex-wp-floating-actions {
    display: flex;
    gap: 8px;
}

.cortex-wp-floating-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    padding: 0;
}

.cortex-wp-floating-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cortex-wp-floating-actions svg {
    width: 16px;
    height: 16px;
}

/* Messages Area */
.cortex-wp-floating-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f8f8;
}

/* Message styles inside floating widget - inherit from chat.css */
.cortex-wp-floating-panel .cortex-wp-message {
    max-width: 100%;
}

.cortex-wp-floating-panel .cortex-wp-message-content {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.cortex-wp-floating-panel .cortex-wp-message-user .cortex-wp-message-content {
    background: var(--cortex-wp-primary-color, #0073ee);
    color: #fff;
    margin-left: auto;
}

.cortex-wp-floating-panel .cortex-wp-message-assistant .cortex-wp-message-content {
    background: #fff;
    color: #444;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* Input Area */
.cortex-wp-floating-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    position: relative;
}

.cortex-wp-floating-input {
    flex: 1;
    resize: none;
    border: none !important;
    border-radius: 50px !important;
    padding: 10px 50px 10px 14px !important;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 100px;
    height: 44px !important;
    min-height: 44px !important;
    outline: none;
    background: #f5f5f5 !important;
    box-shadow: none !important;
}

.cortex-wp-floating-input:focus {
    outline: none;
}

.cortex-wp-floating-input::placeholder {
    color: #999;
}

.cortex-wp-floating-send {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: none;
    border-radius: 50%;
    background: #222;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    flex-shrink: 0;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
}

.cortex-wp-floating-send:hover {
    opacity: 0.9;
}

.cortex-wp-floating-send:active {
    transform: translateY(-50%) scale(0.95);
}

.cortex-wp-floating-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cortex-wp-floating-send svg {
    width: 16px;
    height: 16px;
}

/* Terms & Powered By */
.cortex-wp-floating-terms {
    padding: 12px 16px;
    padding-top: 0;
    font-size: 12px;
    color: #666;
    text-align: center;
    line-height: 18px;
}

.cortex-wp-floating-terms a {
    color: var(--cortex-wp-primary-color, #0073ee);
    text-decoration: none;
}

.cortex-wp-floating-terms a:hover {
    text-decoration: underline;
}

.cortex-wp-floating-powered {
    padding: 6px 16px;
    font-size: 11px;
    color: #888;
    text-align: center;
    background: #fff;
}

.cortex-wp-floating-powered a {
    color: var(--cortex-wp-primary-color, #0073ee);
    text-decoration: none;
    font-weight: 600;
}

.cortex-wp-floating-powered a:hover {
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .cortex-wp-floating-widget {
        bottom: 0;
        right: 0;
        width: 100%;
    }

    .cortex-wp-floating-panel {
        width: calc(100% - 30px) !important;
        height: calc(100vh - 100px) !important;
        bottom: 80px !important;
        right: 15px !important;
    }

    .cortex-wp-floating-toggle {
        bottom: 20px;
        right: 20px;
        position: absolute;
        zoom: 0.8;
    }
    .cortex-wp-welcome-bubble {
        right: 15px;
        width: fit-content;
        float: right;
    }
}
