/**
 * WordPress AI Chat Widget Styles
 */

#wpaichat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans JP', sans-serif;
}

#wpaichat-widget.inline {
    position: relative;
    bottom: auto;
    right: auto;
}

/* Toggle Button */
.wpaichat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}

.wpaichat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

/* Chat Window */
.wpaichat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#wpaichat-widget.inline .wpaichat-window {
    position: relative;
    bottom: auto;
    right: auto;
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 500px;
}

#wpaichat-widget.inline .wpaichat-toggle {
    display: none;
}

/* Header */
.wpaichat-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.wpaichat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.wpaichat-header button:hover {
    opacity: 0.8;
}

/* Messages */
.wpaichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.wpaichat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.wpaichat-message.user {
    align-items: flex-end;
}

.wpaichat-message.assistant {
    align-items: flex-start;
}

.wpaichat-message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.wpaichat-message.user .wpaichat-message-content {
    background: #3498db;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.wpaichat-message.assistant .wpaichat-message-content {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.wpaichat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.wpaichat-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: wpaichat-typing 1.4s infinite ease-in-out;
}

.wpaichat-typing span:nth-child(1) {
    animation-delay: 0s;
}

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

.wpaichat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wpaichat-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Suggestions */
.wpaichat-suggestions {
    padding: 10px 15px;
    border-top: 1px solid #eee;
}

.wpaichat-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 8px;
}

.wpaichat-suggestions-label {
    font-size: 11px;
    color: #888;
}

.wpaichat-suggestions-toggle {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 0 4px;
    transition: transform 0.3s;
}

.wpaichat-suggestions-toggle.collapsed {
    transform: rotate(180deg);
}

.wpaichat-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.wpaichat-suggestions-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.wpaichat-suggestion {
    background: #e8f4fc;
    color: #3498db;
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
}

.wpaichat-suggestion:hover {
    background: #d0e8f7;
}

/* Input */
.wpaichat-input {
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.wpaichat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.wpaichat-input input:focus {
    border-color: #3498db;
}

.wpaichat-input button {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.wpaichat-input button:hover {
    background: #2980b9;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #wpaichat-widget {
        right: 10px;
        bottom: 10px;
    }

    .wpaichat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
        right: -10px;
    }

    .wpaichat-input {
        padding: 10px;
        gap: 6px;
    }

    .wpaichat-input input {
        min-width: 0;
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .wpaichat-input button {
        padding: 10px 12px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .wpaichat-suggestions {
        padding: 8px 10px;
    }

    .wpaichat-suggestion {
        font-size: 10px;
        padding: 4px 8px;
    }
}
