/**
 * HRI Message Styles
 * メッセージウィジェットのスタイル
 * 
 * @since 1.0.7
 */

/* メッセージウィジェット - 右下固定 */
.hri-message-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* メッセージボタン */
.hri-message-button {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hri-message-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.6);
}

.hri-message-button:active {
    transform: scale(0.95);
}

/* 未読バッジ */
.hri-messages-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* モーダル調整 */
#hriMessageModal .modal-dialog {
    max-width: 800px;
}

#hriMessageModal .modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#hriMessageModal .modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: none;
}

#hriMessageModal .modal-title {
    font-weight: 600;
}

#hriMessageModal .close {
    color: white;
    opacity: 0.9;
}

#hriMessageModal .close:hover {
    opacity: 1;
}

/* タブスタイル */
#hriMessageModal .nav-tabs {
    border-bottom: 2px solid #e9ecef;
}

#hriMessageModal .nav-tabs .nav-link {
    color: #495057;
    border: none;
    padding: 10px 20px;
    transition: all 0.3s;
}

#hriMessageModal .nav-tabs .nav-link:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

#hriMessageModal .nav-tabs .nav-link.active {
    color: #007bff;
    font-weight: 600;
    border-bottom: 3px solid #007bff;
    background-color: transparent;
}

/* メッセージリスト */
#hri-message-content .list-group-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

#hri-message-content .list-group-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

#hri-message-content .list-group-item-primary {
    background-color: #e7f3ff;
    border-left: 4px solid #007bff;
}

/* フォームスタイル */
#hri-message-form .form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
}

#hri-message-form .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#hri-message-form label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

#hri-message-form textarea {
    resize: vertical;
    min-height: 100px;
}

#hri-message-form button[type="submit"] {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s;
}

#hri-message-form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* 会話履歴 */
#hri-conversation-history {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

#hri-conversation-list {
    background-color: white;
}

#hri-conversation-list .bg-primary {
    background-color: #007bff !important;
}

#hri-conversation-list .bg-light {
    background-color: #f8f9fa !important;
}

/* バッジ */
.badge-primary {
    background-color: #007bff;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ボタンスタイル */
.hri-delete-message {
    transition: all 0.3s;
}

.hri-delete-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .hri-message-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .hri-message-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    #hriMessageModal .modal-dialog {
        margin: 10px;
    }
    
    #hri-conversation-list .d-inline-block {
        max-width: 90% !important;
    }
}

/* アニメーション */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hri-message-widget {
    animation: slideInUp 0.5s ease-out;
}

/* スクロールバーカスタマイズ */
#hri-conversation-list::-webkit-scrollbar {
    width: 8px;
}

#hri-conversation-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#hri-conversation-list::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

#hri-conversation-list::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* メッセージパネル */
.hri-message-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hri-message-header {
    padding: 15px 20px;
    background: #2271b1;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hri-message-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.hri-message-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.hri-message-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.hri-message-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.hri-message-tab:hover {
    background: #e8e8e8;
}

.hri-message-tab.active {
    background: white;
    font-weight: 600;
    color: #2271b1;
}

.tab-badge {
    background: #d63638;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 4px;
}

.hri-message-content {
    flex: 1;
    overflow-y: auto;
    max-height: 450px;
}

.hri-message-list {
    padding: 10px;
}

.hri-message-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s;
}

.hri-message-item:hover {
    background: #f8f9fa;
}

.hri-message-item.unread {
    background: #e8f4fd;
    font-weight: 600;
}

.hri-message-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.hri-message-sender {
    font-weight: 600;
    color: #333;
}

.hri-message-time {
    font-size: 12px;
    color: #999;
}

.hri-message-subject {
    color: #555;
    margin-bottom: 4px;
}

.hri-message-preview {
    font-size: 13px;
    color: #777;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hri-message-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.hri-compose-form {
    padding: 20px;
}

.hri-form-group {
    margin-bottom: 15px;
}

.hri-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.hri-form-group input,
.hri-form-group select,
.hri-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hri-form-group textarea {
    resize: vertical;
}

.hri-form-actions {
    text-align: right;
}

.hri-btn-primary {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.hri-btn-primary:hover {
    background: #135e96;
}

.hri-message-detail {
    padding: 20px;
}

.hri-message-detail-header {
    margin-bottom: 15px;
}

.hri-back-btn {
    background: none;
    border: none;
    color: #2271b1;
    cursor: pointer;
    font-size: 16px;
    padding: 5px 10px;
}

.hri-back-btn:hover {
    text-decoration: underline;
}

.hri-message-detail-subject {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.hri-message-detail-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.hri-message-detail-body {
    font-size: 15px;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* 返信ボタン */
.hri-message-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.hri-btn-reply {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.hri-btn-reply:hover {
    background: #0056b3;
}

@media (max-width: 480px) {
    .hri-message-panel {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
    }
}