/**
 * Mercari Ads Chat Widget Styles
 */

/* ウィジェット全体のコンテナ */
.mac-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
}

/* チャットボタン */
.mac-chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff0211 0%, #d10008 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 2, 17, 0.3);
    transition: all 0.3s ease;
}

.mac-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(255, 2, 17, 0.4);
}

.mac-chat-button svg {
    width: 28px;
    height: 28px;
}

/* チャットウィンドウ */
.mac-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid #e0e0e0;
}

.mac-chat-window.active {
    display: flex;
}

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

/* チャットヘッダー */
.mac-chat-header {
    background: #ffffff;
    color: #333333;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ff0211;
}

.mac-header-content h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ff0211;
    letter-spacing: 0.5px;
}

.mac-header-content p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #666666;
    font-weight: 400;
}

.mac-close-button {
    background: transparent;
    border: none;
    color: #999999;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mac-close-button:hover {
    background: #f5f5f5;
    color: #ff0211;
}

/* メッセージエリア */
.mac-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.mac-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

.mac-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

/* ボットメッセージ */
.mac-message-bot .mac-message-content {
    background: #ffffff;
    color: #333333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

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

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

/* ユーザーメッセージ */
.mac-message-user {
    justify-content: flex-end;
}

.mac-message-user .mac-message-content {
    background: #ff0211;
    color: white;
}

/* ソースリンク */
.mac-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.mac-sources-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.mac-source-item {
    margin-bottom: 6px;
    font-size: 12px;
}

.mac-source-item a {
    color: #ff0211;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.mac-source-item a:hover {
    color: #d10008;
    text-decoration: underline;
}

.mac-source-confidence {
    color: #999;
    margin-left: 4px;
    font-size: 11px;
}

/* ローディングインジケーター */
.mac-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.mac-loading-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.mac-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.mac-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 入力エリア */
.mac-chat-input-wrapper {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.mac-chat-form {
    display: flex;
    gap: 8px;
}

.mac-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: #ffffff;
}

.mac-chat-input:focus {
    border-color: #ff0211;
    box-shadow: 0 0 0 3px rgba(255, 2, 17, 0.1);
}

.mac-send-button {
    width: 44px;
    height: 44px;
    background: #ff0211;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mac-send-button:hover {
    background: #d10008;
    transform: scale(1.05);
}

.mac-send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: #cccccc;
}

/* エラーメッセージ */
.mac-error {
    background: #ffebee;
    color: #c62828;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
    border-left: 3px solid #ff0211;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .mac-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .mac-chat-window {
        width: 100%;
        height: 500px;
        bottom: 80px;
        left: 0;
        right: 0;
    }
    
    .mac-chat-button {
        width: 56px;
        height: 56px;
    }
}

/* スクロールバーのスタイリング */
.mac-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.mac-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

