* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
}

/* アプリケーションヘッダー */
.app-header {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c084fc 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2000;
    height: 60px;
}

.app-header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 15px 30px;
    max-width: 100%;
    height: 100%;
}

.app-logo h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-container {
    display: flex;
    flex: 1;
    background-color: #fff;
    overflow: hidden;
}

/* サイドバー（ユーザーリスト） */
.sidebar {
    width: 320px;
    background-color: #ffffff;
    border-right: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
}



.user-list {
    flex: 1;
    overflow-y: auto;
    background-color: #fafbfc;
    padding-top: 10px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f2f5;
}

.user-item:hover {
    background-color: #f0f2f5;
}

.user-item.active {
    background-color: #e7f3ff;
    border-left: 3px solid #0084ff;
}

.user-avatar {
    margin-right: 12px;
    font-size: 40px;
    color: #65676b;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: #050505;
    margin-bottom: 4px;
}

.last-message {
    font-size: 13px;
    color: #65676b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* メインチャットエリア */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    position: relative;
}

/* チャットサブヘッダー */
.chat-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: #ffffff;
    border-bottom: 2px solid #e4e6eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-user-info i {
    font-size: 32px;
    color: #7c3aed;
}

.current-user-name {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

/* 展開ボタンのスタイル */
.expand-ai-btn {
    padding: 8px 20px;
    background-color: rgba(255, 255, 255, 0.95);
    color: #7c3aed;
    border: 2px solid #7c3aed;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

.expand-ai-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.expand-ai-btn.hidden {
    display: none;
}

.expand-ai-btn i {
    font-size: 16px;
}

/* メッセージコンテナ */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
}

.message {
    margin-bottom: 20px;
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message-content {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message.received .message-content {
    background-color: #f0f2f5;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.message.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin-bottom: 4px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    text-align: right;
    margin-top: 4px;
}

/* メッセージ入力エリア */
.message-input-container {
    padding: 15px;
    background-color: #ffffff;
    border-top: 1px solid #e4e6eb;
    position: relative;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f0f2f5;
    padding: 8px;
    border-radius: 24px;
}

.tools-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.2s, transform 0.2s;
}

.tools-btn:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.tools-btn.active {
    transform: rotate(45deg);
}

.message-input {
    flex: 1;
    border: none;
    background-color: transparent;
    padding: 8px 12px;
    font-size: 15px;
    outline: none;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* ツールドロップダウン */
.tools-dropdown {
    position: absolute;
    bottom: 70px;
    left: 15px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    display: none;
    z-index: 100;
    animation: slideUp 0.3s ease-out;
}

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

.tools-dropdown.show {
    display: block;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    width: 100%;
    border-radius: 8px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.tool-item:hover {
    background-color: #f0f2f5;
}

.tool-item i {
    width: 20px;
    color: #667eea;
    font-size: 16px;
}

/* AIチャットパネル */
.ai-chat-panel {
    width: 400px;
    background-color: #ffffff;
    border-left: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: -400px;
    top: 60px;  /* ヘッダーの高さ分下げる */
    height: calc(100vh - 60px);  /* ヘッダーの高さを引く */
    transition: right 0.3s ease-in-out;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.ai-chat-panel.show {
    right: 0;
}

.ai-chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.close-ai-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.close-ai-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: #7c3aed;
    transform: scale(1.1);
    border-color: white;
}

.ai-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
}

.ai-message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

.ai-message.ai-sent {
    text-align: right;
}

.ai-message-content {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%;
}

.ai-message.ai-received .ai-message-content {
    background-color: #f0f2f5;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.ai-message.ai-sent .ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* プロンプトテンプレート */
.prompt-templates {
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #e4e6eb;
}

.prompt-templates h3 {
    font-size: 14px;
    font-weight: 600;
    color: #65676b;
    margin-bottom: 10px;
}

.template-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.template-btn {
    padding: 8px 12px;
    border: 1px solid #e4e6eb;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    transition: all 0.2s;
}

.template-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.template-btn i {
    font-size: 14px;
}

/* AI入力エリア */
.ai-input-container {
    padding: 15px;
    background-color: #ffffff;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-input {
    flex: 1;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.ai-input:focus {
    border-color: #667eea;
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* モバイル対応のヘッダー調整 */
@media (max-width: 768px) {
    .app-header-content {
        padding: 12px 15px;
    }
    
    .app-logo h1 {
        font-size: 24px;
    }
    
    .chat-subheader {
        padding: 10px 15px;
    }
    
    .chat-user-info i {
        font-size: 28px;
    }
    
    .current-user-name {
        font-size: 16px;
    }
    
    .expand-ai-btn span {
        display: none;
    }
    
    .expand-ai-btn {
        padding: 8px 12px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
}

/* スクロールバーのカスタマイズ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f2f5;
}

::-webkit-scrollbar-thumb {
    background: #c4c6ca;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8aaae;
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
    .ai-chat-panel {
        width: 350px;
        right: -350px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header h2 {
        font-size: 14px;
        text-align: center;
    }

    .user-info {
        display: none;
    }

    .ai-chat-panel {
        width: 100%;
        right: -100%;
    }

    .ai-chat-panel.show {
        right: 0;
    }
}

/* 添付ファイル表示 */
.attached-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    font-size: 12px;
    margin-top: 6px;
    color: #667eea;
}

.attached-file i {
    font-size: 14px;
}