/**
 * Ghost Chat Widget Styles
 * Version: 1.1.0
 * Includes mobile-desktop interface fixes
 */

/* Chat Container */
.ghost-chat-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Active chat state */
.ghost-chat-container.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat header */
.ghost-chat-header {
    background-color: #E1F0FE;
    color: #2c3e50;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.ghost-chat-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #54595F;
}

.ghost-chat-controls {
    display: flex;
    align-items: center;
}

.ghost-chat-close,
.ghost-chat-clear {
    background: none;
    border: none;
    color: #54595F;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-chat-clear svg {
    width: 18px;
    height: 18px;
}

.ghost-chat-close,
.ghost-chat-clear:hover {
    opacity: 1;
}

/* Messages container */
.ghost-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f9fafb;
}

/* Message styles */
.ghost-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.ghost-user {
    background-color: #E1F0FE;
    color: #2c3e50;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ghost-assistant {
    background-color: #e5e7eb;
    color: #374151;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ghost-message-content {
    word-break: break-word;
}

.ghost-message-content p {
    margin: 0 0 8px 0;
}

.ghost-message-content p:last-child {
    margin-bottom: 0;
}

/* Typing indicator */
.ghost-typing {
    display: flex;
    align-items: center;
    align-self: flex-start;
    background-color: #e5e7eb;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.ghost-typing span {
    height: 8px;
    width: 8px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: bounce 1.3s linear infinite;
}

.ghost-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.ghost-typing span:nth-child(3) {
    animation-delay: 0.3s;
    margin-right: 0;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* Input area */
.ghost-chat-input {
    display: flex;
    padding: 12px;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
}

#ghost-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#ghost-chat-input:focus {
    border-color: #E1F0FE;
}

#ghost-chat-send {
    background-color: #E1F0FE;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#ghost-chat-send svg {
    width: 20px;
    height: 20px;
    color: #54595F;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    stroke-width: 2px;
}

#ghost-chat-send:hover {
    background-color: #cae4fc;
}

/* Trigger button */
.ghost-chat-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background-color: #E1F0FE;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color 0.2s;
    z-index: 999998;
}

.ghost-chat-trigger svg {
    width: 24px;
    height: 24px;
    color: #2c3e50;
}

.ghost-chat-trigger:hover {
    background-color: #cae4fc;
    transform: scale(1.05);
}

/* Mobile interface fixes */
@media (max-width: 768px) {
    .ghost-chat-container {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .ghost-chat-header {
        border-radius: 0;
    }
    
    .ghost-chat-trigger {
        bottom: 16px;
        right: 16px;
    }
}

/* Desktop interface fixes */
@media (min-width: 769px) {
    .ghost-chat-container {
        bottom: 80px;
        right: 20px;
        width: 360px;
        max-width: calc(100vw - 40px);
        height: 480px;
        max-height: calc(100vh - 120px);
        border-radius: 12px;
    }
    
    .ghost-chat-header {
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }
    
    .ghost-chat-trigger {
        bottom: 20px;
        right: 20px;
    }
}
