/* ChatGPT Support Widget Styles */

#chatgpt-support-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chatgpt-widget-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatgpt-widget-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* チャットコンテナ */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

/* ショートコード用のチャットコンテナ */
.chatgpt-shortcode-widget .chat-container {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    width: 100% !important;
    margin: 0;
}ャットトグルボタン */
.chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.chat-icon {
    font-size: 24px;
    color: white;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
    100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
}

/* チャットコンテナ */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatgpt-widget-bottom-left .chat-container {
    right: auto;
    left: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* チャットヘッダー */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* メッセージエリア */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    max-height: 350px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* メッセージ */
.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.user-message {
    text-align: right;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.bot-message .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    margin-right: auto;
}

.bot-message.error .message-bubble {
    background: #fee;
    color: #c53030;
    border-color: #feb2b2;
}

.message-time {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    text-align: center;
}

/* タイピングインジケーター */
.typing-indicator {
    font-size: 20px;
    line-height: 1;
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* 入力エリア */
.chat-input-container {
    display: flex;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    gap: 10px;
}

#chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* レスポンシブデザイン */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .chatgpt-widget-bottom-left .chat-container {
        left: 20px;
        right: 20px;
    }
    
    .chat-messages {
        max-height: calc(100vh - 250px);
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chat-icon {
        font-size: 20px;
    }
}

@media (max-width: 350px) {
    .chat-input-container {
        padding: 10px 15px;
        gap: 8px;
    }
    
    #chat-input {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    #chat-send {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .chat-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .chat-messages {
        background: #1a202c;
    }
    
    .bot-message .message-bubble {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #2d3748;
    }
    
    .chat-input-container {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    #chat-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    #chat-input::placeholder {
        color: #a0aec0;
    }
    
    #chat-input:focus {
        border-color: #667eea;
        background: #2d3748;
    }
    
    .message-time {
        color: #a0aec0;
    }
}

/* アニメーション効果 */
.message-bubble {
    position: relative;
    overflow: hidden;
}

.message-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.user-message .message-bubble::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
}

.message:hover .message-bubble::before {
    left: 100%;
}

/* フォーカス時のアクセシビリティ */
.chat-toggle:focus,
.chat-close:focus,
#chat-input:focus,
#chat-send:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 印刷時の調整 */
@media print {
    #chatgpt-support-widget {
        display: none !important;
    }
    
    .chatgpt-shortcode-widget {
        display: none !important;
    }
}