/* 채팅 모달 스타일 */
.chat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
}

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

/* 모달 헤더 */
.chat-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.chat-modal-header .chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.chat-modal-header .chat-room-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.chat-modal-header .chat-room-subtitle {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.chat-modal-actions {
    display: flex;
    gap: 8px;
}

/* 메시지 영역 */
.chat-modal .chat-messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-modal .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.chat-modal .empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

/* 메시지 스타일 */
.chat-modal .message-wrapper {
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease-out;
}

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

.chat-modal .message-wrapper.own {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-modal .message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.chat-modal .message-wrapper.own .message-header {
    flex-direction: row-reverse;
}

.chat-modal .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin-right: 10px;
}

.chat-modal .message-wrapper.own .message-avatar {
    margin-right: 0;
    margin-left: 10px;
}

.chat-modal .message-info {
    display: flex;
    flex-direction: column;
}

.chat-modal .message-wrapper.own .message-info {
    align-items: flex-end;
}

.chat-modal .message-sender {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.chat-modal .message-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.chat-modal .message-body {
    margin-left: 42px;
}

.chat-modal .message-wrapper.own .message-body {
    margin-left: 0;
    margin-right: 42px;
}

.chat-modal .message-bubble {
    background: white;
    border-radius: 12px;
    padding: 10px 14px;
    max-width: 500px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

.chat-modal .message-wrapper.own .message-bubble {
    background: #007bff;
    color: white;
}

.chat-modal .message-text {
    font-size: 14px;
    line-height: 1.5;
}

/* 시스템 메시지 */
.chat-modal .system-message-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f0f0f0;
    border-radius: 20px;
    margin: 10px auto;
    max-width: fit-content;
}

.chat-modal .system-message-icon {
    color: #666;
    font-size: 14px;
}

.chat-modal .system-message-text {
    font-size: 13px;
    color: #666;
}

.chat-modal .system-message-time {
    font-size: 11px;
    color: #999;
}

/* 답장 */
.chat-modal .message-reply {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #007bff;
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-modal .message-wrapper.own .message-reply {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.chat-modal .reply-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.chat-modal .message-wrapper.own .reply-header {
    color: rgba(255, 255, 255, 0.8);
}

.chat-modal .reply-content {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.chat-modal .message-wrapper.own .reply-content {
    color: rgba(255, 255, 255, 0.9);
}

/* 파일 첨부 */
.chat-modal .message-files {
    margin-top: 8px;
}

.chat-modal .message-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 6px;
}

.chat-modal .message-wrapper.own .message-file-item {
    background: rgba(255, 255, 255, 0.15);
}

.chat-modal .file-icon {
    font-size: 20px;
    color: #666;
}

.chat-modal .message-wrapper.own .file-icon {
    color: rgba(255, 255, 255, 0.9);
}

.chat-modal .file-details {
    flex: 1;
}

.chat-modal .file-name {
    font-size: 13px;
    font-weight: 500;
}

.chat-modal .file-meta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.chat-modal .message-wrapper.own .file-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-modal .btn-download-file {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-modal .message-wrapper.own .btn-download-file {
    color: white;
}

.chat-modal .btn-download-file:hover {
    background: rgba(0, 123, 255, 0.1);
}

.chat-modal .message-wrapper.own .btn-download-file:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 입력 영역 */
.chat-modal .chat-input-area {
    border-top: 1px solid #e0e0e0;
    background: white;
    padding: 16px;
    border-radius: 0 0 12px 12px;
}

.chat-modal .reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f4f8;
    border-radius: 8px;
    margin-bottom: 12px;
}

.chat-modal .reply-preview-content {
    flex: 1;
}

.chat-modal .reply-preview-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #007bff;
    margin-bottom: 4px;
}

.chat-modal .reply-preview-text {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-modal .btn-cancel-reply {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-modal .btn-cancel-reply:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.chat-modal .chat-input-container {
    display: flex;
    align-items: center;
}

.chat-modal .input-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 4px;
}

.chat-modal .btn-attach-file {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.chat-modal .btn-attach-file:hover {
    background: rgba(0, 0, 0, 0.05);
}

.chat-modal .chat-message-input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

.chat-modal .btn-send-message {
    background: #007bff;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-modal .btn-send-message:hover:not(:disabled) {
    background: #0056b3;
}

.chat-modal .btn-send-message:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 첨부 파일 미리보기 */
.chat-modal .attached-files {
    margin-top: 12px;
}

.chat-modal .attached-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f4f8;
    border-radius: 8px;
    margin-top: 8px;
}

.chat-modal .attached-file-item .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.chat-modal .attached-file-item .file-name {
    font-size: 13px;
    color: #333;
}

.chat-modal .attached-file-item .file-size {
    font-size: 11px;
    color: #999;
}

.chat-modal .btn-remove-file {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-modal .btn-remove-file:hover {
    color: #d9534f;
    background: rgba(217, 83, 79, 0.1);
}

/* 로딩 인디케이터 */
.chat-modal .loading-more {
    padding: 10px;
    text-align: center;
}

/* 하이라이트 효과 */
.chat-modal .message-wrapper.highlighted {
    background: rgba(255, 193, 7, 0.2);
    border-radius: 8px;
    padding: 8px;
    animation: highlight 0.5s ease-in-out;
}

@keyframes highlight {
    0% { background: rgba(255, 193, 7, 0.4); }
    100% { background: rgba(255, 193, 7, 0.2); }
}