/* /css/styles.css - 기본 스타일 정의 */

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

/* Body */
body {
    background: linear-gradient(180deg, #eef4fc 100px, #ffffff 100px, #ffffff 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Header Section */
#header-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.5rem 1rem 0;
}

#title {
    color: #4a90e2;
    font-size: 2.5rem;
    font-weight: 800;
    text-align: left;
    letter-spacing: -0.02em;
    margin-bottom: 0.1rem;
}

.header-text {
    color: #4a90e2;
    font-size: 1.1rem;
    line-height: 1.4;
    text-align: left;
    margin: 0.25rem 0;
    padding: 0;
}

/* Main Container */
.main-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(74, 144, 226, 0.1);
    flex: 1;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    max-height: 700px;
    overflow-y: auto;
    position: relative;
}

.chat-container.expanded {
    max-height: none;
    overflow: visible;
}

.chat-container.resizable {
    resize: horizontal;
    overflow: auto;
    min-width: 300px;
    max-width: 100%;
    border: 1px solid #e0e0e0;
    padding: 20px;
    margin: 0 auto;
}

/* Scrollbar Styles */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Message Styles */
.chat-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    align-items: flex-start;
    overflow: hidden;
}

.chat-message.mine {
    flex-direction: row-reverse;
    justify-content: flex-start;
    width: 100%;
}

.chat-message.other {
    flex-direction: row;
    justify-content: flex-start;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: calc(60% - 50px);
    justify-content: flex-end;
    position: relative;
}

.message-content {
    padding: 10px 16px;
    border-radius: 20px;
    max-width: 100%;
    word-wrap: break-word;
    margin-bottom: 5px;
    cursor: pointer;
    position: relative; /* 말풍선 꼬리 위치 기준 */
}

/* 내 메시지 (오른쪽) 연속 메시지 모서리 조정 */
.chat-message.mine.last .message-content {
    border-radius: 20px 4px 20px 20px; /* 오른쪽 상단 모서리를 약간 둥글게 */
}

/* 상대방 메시지 (왼쪽) 연속 메시지 모서리 조정 */
.chat-message.other.last .message-content {
    border-radius: 4px 20px 20px 20px; /* 왼쪽 상단 모서리를 약간 둥글게 */
}

/* 첫 번째 연속 메시지의 모서리 */
.chat-message.mine .message-content {
    border-radius: 20px 4px 4px 20px; /* 오른쪽 상단, 오른쪽 하단 모서리 약간 둥글게 */
}

.chat-message.other .message-content {
    border-radius: 4px 20px 20px 4px; /* 왼쪽 상단, 왼쪽 하단 모서리 약간 둥글게 */
}

.message-content:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.chat-message.mine .message-content {
    background-color: #d8f4e7;
    color: #333;
}

.chat-message.other .message-content {
    background-color: #f1f1f1;
    color: #333;
}

/* @ 태그 스타일 */
.message-content .tag {
    color: #0d5bd1;
    font-weight: bold;
}

/* Username and Time */
.username {
    font-weight: bold;
    margin: 0 10px 5px 0;
}

.chat-message.mine .username {
    text-align: right;
}

.chat-time {
    font-size: 12px;
    color: #888;
    margin: 3px 0 0 10px;
}

.chat-message.mine .chat-time {
    text-align: right;
}

/* Profile Styles */
.profile-container {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-picture {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #ccc;
    overflow: hidden;
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User Profile Management - 카드 형식으로 개선 (세로형) */
.user-profiles {
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 프로필 헤더 영역 */
.profile-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.profile-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4a90e2;
    margin-bottom: 10px;
}

.profile-info {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 15px;
}

.upload-info {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 10px;
    font-style: italic;
}

/* 프로필 액션 버튼 */
.profile-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.action-button {
    padding: 8px 15px;
    font-size: 0.9rem;
    background-color: #e2e8f0;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.action-button:hover {
    background-color: #cbd5e0;
    color: #2d3748;
}

/* 프로필 그리드 레이아웃 */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

/* 사용자 프로필 카드 스타일 (세로형) */
.user-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border-radius: 12px;
    padding: 18px;
    position: relative;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.user-profile-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* 체크박스 스타일 */
.my-message-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4a90e2;
}

.is-my-message {
    border: 2px solid #4a90e2;
    background-color: rgba(74, 144, 226, 0.03);
}

/* 드래그 오버 상태 */
.user-profile-card.drag-over {
    border: 2px dashed #4a90e2;
    background-color: rgba(74, 144, 226, 0.05);
}

/* 이미지 컨테이너 */
.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

/* 프로필 미리보기 (크기 증가) */
.profile-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #e2e8f0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.profile-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 사용자 이름 컨테이너 스타일 개선 */
.name-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* 표시 이름 입력 필드 개선 */
.display-name-input {
    padding: 8px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    text-align: center;
    transition: all 0.2s ease;
    color: #2d3748; /* 텍스트 색상 어둡게 설정 */
    background-color: #ffffff; /* 배경색 명확하게 지정 */
}

.display-name-input:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* 파일 입력 숨김 */
.profile-file-input {
    display: none;
}

/* 원래 이름 표시 */
.original-name {
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

/* 파일 입력 라벨 */
.file-input-label {
    padding: 8px 12px;
    background-color: #4a90e2; /* 더 진한 파란색 */
    color: white; /* 흰색으로 명확하게 */
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
  
 
.file-input-label:hover {
    background-color: #357abd; /* 호버 시 색상도 조정 */
}

.file-input-label::before {
    content: '\f03e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 400;
    margin-right: 8px;
}

/* 초기화 버튼 */
.profile-reset-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    z-index: 2;
    transition: all 0.2s ease;
}

.profile-reset-btn:hover {
    background: #e2e8f0;
    color: #ef4444;
}

/* 색상 선택기 스타일 */
.color-picker {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #cbd5e0; /* 테두리 추가 */
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* Button Styles */
button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    background-color: #4a90e2;
    color: white;
    transition: all 0.2s ease;
}

button:hover {
    background-color: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Clear Button */
#clear-btn {
    padding: 10px 15px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    color: blue;
    font-size: 14px;
    font-weight: bold;
}

#clear-btn:hover {
    background-color: #ffffff;
    color: #0056b3;
}

#clear-btn:active {
    background-color: #e6e6e6;
}

/* Edit Interface */
.edit-textarea {
    width: 100%;
    min-height: 50px;
    padding: 8px;
    border: 2px solid #3498db;
    border-radius: 15px;
    resize: vertical;
    font: inherit;
}

.edit-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.edit-buttons button {
    padding: 6px 12px;
    margin: 0 5px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
}

.edit-buttons button.delete-button {
    background-color: #f44336;
}

.edit-buttons button:hover {
    opacity: 0.8;
}

/* Textarea Styles */
textarea {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    min-height: 200px;
    background-color: #fafafa;
}

textarea:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    background-color: #ffffff;
}

/* Status Message */
#statusMessage {
    position: fixed;
    top: -50px; /* 상단에서 시작 */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease, top 0.3s ease; /* bottom -> top 변경 */
    z-index: 9999;
}

#statusMessage.show-up {
    top: 10px;
    opacity: 1;
}

/* 로딩 오버레이 스타일 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #ffffff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    margin-top: 15px;
    color: white;
    font-size: 16px;
}


/* 버튼 컨테이너 스타일 */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.button-container button {
    flex: 1;
    min-width: 120px;
}

/* 태그된 사용자 스타일 */
.tagged-user {
    color: #0d5bd1;
    font-weight: bold;
}

/* 선택 모드 메시지 */
.selection-mode-message {
    background-color: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #2c5282;
    border-radius: 4px;
}

/* 선택된 카드 스타일 */
.selected-for-reset {
    box-shadow: 0 0 0 2px #f56565;
    transform: translateY(-2px);
    background-color: #fff5f5;
}

/* 내 메시지 버튼 스타일 */
.my-user-button {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.my-user-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 드래그 앤 드롭 스타일 */
#input-text {
    position: relative;
}

#input-text.drag-over {
    border: 2px dashed #4a90e2;
    background-color: rgba(74, 144, 226, 0.05);
}

#footer {
    background-color: rgba(74, 144, 226, 0.03);
    color: #4a90e2;
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(74, 144, 226, 0.1);
    margin-top: auto;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

#footer p {
    margin: 0.5rem 0;
    color: #357abd;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}


.button-container {
    position: relative;
  }

.dropdown-menu {
  position: fixed;
  display: none;
  background-color: #fff;
  box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 160px;
  border-radius: 4px;
  padding: 5px 0;
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown-item {
  display: block;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.dropdown-item:hover {
  background-color: #f5f5f5;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .main-container {
        padding: 1.5rem;
        margin: 0 1rem 1.5rem;
    }
    
    #title {
        font-size: 2rem;
        margin-bottom: 0.2rem;
    }
    
    .header-text {
        font-size: 1rem;
        margin: 0.2rem 0;
    }
    
    button {
        padding: 0.5rem 1rem;
        border-radius: 10px;
    }
    
    .message-wrapper {
        max-width: calc(80% - 30px);
    }
    
    /* 프로필 그리드 조정 */
    .profile-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    
    /* 설정 버튼 위치 조정 */
    .settings-button {
        bottom: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* 텍스트 영역 최적화 */
    textarea {
        height: 150px;
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .dropdown-container {
        width: 100%;
    }
    
    .dropdown-menu {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 1.25rem;
        margin: 0 0.75rem 1rem;
    }
    
    #title {
        font-size: 1.75rem;
    }
    
    .button-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .button-container button {
        width: 100%;
    }
    
    /* 프로필 그리드를 단일 컬럼으로 */
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-button {
        bottom: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}