/* 파일 업로드 버튼 툴팁 */
#file-btn::after {
  content: "파일 업로드";
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}

#file-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

/* 이미지 업로드 버튼 툴팁 */
#upload-btn::after {
  content: "이미지 업로드";
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}

#upload-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

/* 파일 메시지 스타일 */
.file-message {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background-color: var(--white);
  margin-bottom: 5px;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  max-width: 100%;
  overflow: hidden;
}

.file-icon {
  font-size: 24px;
  margin-right: 10px;
  color: var(--primary-color);
}

.file-info {
  flex: 1;
  overflow: hidden;
}

.file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.file-meta {
  display: flex;
  font-size: 12px;
  color: var(--text-muted);
}

.file-size {
  margin-right: 10px;
}

.file-type {
  text-transform: uppercase;
}

.file-actions {
  display: flex;
  gap: 10px;
}

.file-download-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.file-download-btn:hover {
  background: var(--primary-light);
}
:root {
  --primary-color: #7269ef;
  --primary-light: #a69cff;
  --secondary-color: #f5f7fb;
  --message-even-color: #e6efff; /* 라이트 모드에서 짝수 메시지 배경색 - 더 진한 파란색 */
  --message-odd-color: #ffffff; /* 라이트 모드에서 홀수 메시지 배경색 - 흰색 */
  --message-even-border: #c5d5f5; /* 라이트 모드에서 짝수 메시지 테두리 색상 */
  --message-odd-border: #e0e0e0; /* 라이트 모드에서 홀수 메시지 테두리 색상 */
  --text-color: #495057;
  --text-muted: #7a7f9a;
  --border-color: #e6ebf5;
  --white: #ffffff;
  --success: #06d6a0;
  --info: #50a5f1;
  --warning: #f1b44c;
  --danger: #ef476f;
  --dark: #343a40;
  --box-shadow: 0 2px 4px rgba(15, 34, 58, 0.12);
  --transition: all 0.3s ease;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dark mode variables */
body.dark-mode {
  --primary-color: #7269ef;
  --primary-light: #a69cff;
  --secondary-color: #2e2e40;
  --message-even-color: #1a1a27; /* 다크 모드에서 짝수 메시지 배경색 - 더 어두운 검정색 */
  --message-odd-color: #2e2e40; /* 다크 모드에서 홀수 메시지 배경색 - 더 밝은 다크블루 */
  --message-even-border: #151525; /* 다크 모드에서 짝수 메시지 테두리 색상 */
  --message-odd-border: #3e3e50; /* 다크 모드에서 홀수 메시지 테두리 색상 */
  --text-color: #e1e9f1;
  --text-muted: #9aa1b9;
  --border-color: #3b3951;
  --white: #262338;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--secondary-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: var(--transition);
}

header {
  background: var(--white);
  padding: 1rem;
  box-shadow: var(--box-shadow);
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

#site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#login-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#login-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(114, 105, 239, 0.3);
}



.icon-button {
  background: var(--secondary-color);
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.icon-button:hover {
  background: var(--primary-light);
  color: white;
}

#dark-mode-toggle, 
#clear-all-btn {
  font-size: 1.2rem;
}

#search-input {
  width: 180px;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  background-color: var(--secondary-color);
  color: var(--text-color);
  transition: var(--transition);
}

#search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  width: 220px;
}

#setting-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.5rem 1rem;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
}

#setting-area label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 0.5rem;
}

#keep-days {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: 0.85rem;
  cursor: pointer;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
  background-image: url('https://images.unsplash.com/photo-1557682233-43e671455dfa?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MzR8fHBhdHRlcm4lMjBsaWdodHxlbnwwfHwwfHx8MA%3D%3D');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.95;
}

.dark-mode #chat-container {
  background-image: url('https://images.unsplash.com/photo-1550684376-efcbd6e3f031?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTl8fGRhcmslMjBwYXR0ZXJufGVufDB8fDB8fHww');
}

#messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.5rem;
}

.message {
  display: flex;
  align-items: center; /* 세로 중앙 정렬 */
  justify-content: flex-start; /* 왼쪽 정렬 */
  gap: 12px; /* 메시지랑 버튼 간격 증가 */
  margin-bottom: 15px; /* 메시지 간 간격 증가 */
}

#install-btn-footer {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  margin-left: 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

#install-btn-footer:hover {
  background: var(--primary-light);
}

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

/* 메시지 배경색 스타일 */
.message-content {
  padding: 1rem;
  border-radius: 12px;
  box-shadow: var(--box-shadow);
  max-width: 80%;
  white-space: pre-wrap;
  word-break: break-word;
  border-top-left-radius: 0;
}

.message-even .message-content {
  background-color: var(--message-even-color);
  border: 2px solid var(--message-even-border);
}

.message-odd .message-content {
  background-color: var(--message-odd-color);
  border: 2px solid var(--message-odd-border);
}

.message-buttons {
  display: flex;
  flex-direction: row; /* 세로로 복사/삭제 버튼 쌓기 */
  gap: 5px;
  /* transition: opacity 0.2s ease; - 필요하다면 이 줄을 제거할 수도 있습니다 */
}

/* .message:hover .message-buttons {
  opacity: 1;
} - 이 부분은 제거하거나 주석 처리할 수 있습니다 */

.copy-btn, .delete-btn {
  background: var(--secondary-color);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: var(--transition);
}

.copy-btn:hover, .delete-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

#input-area {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--white);
  border-top: 1px solid var(--border-color);
  position: relative;
}

/* 맨 아래로 이동 버튼 */
#scroll-to-bottom {
  position: fixed;
  right: 1.5rem;
  bottom: 7rem;
  background: var(--primary-color);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(20px);
}

#scroll-to-bottom.visible {
  opacity: 1;
  transform: translateY(0);
}

#scroll-to-bottom:hover {
  background: var(--primary-light);
  transform: translateY(-3px);
}

/* 전체화면 버튼 */
#fullscreen-toggle {
  position: fixed;
  right: 1.5rem;
  bottom: 11rem;
  background: var(--primary-color);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: all 0.3s;
}

#fullscreen-toggle:hover {
  background: var(--primary-light);
  transform: translateY(-3px);
}

#message-input {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  background-color: var(--secondary-color);
  color: var(--text-color);
  font-size: 0.95rem;
  transition: var(--transition);
}

#message-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.action-btn {
  background: var(--secondary-color);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.3rem;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#send-btn {
  background: var(--primary-color);
  color: white;
}

#send-btn:hover {
  background: var(--primary-light);
  transform: scale(1.05);
}

#upload-btn:hover, #copy-btn:hover {
  background: var(--primary-light);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(114, 105, 239, 0.3);
}

footer {
  text-align: center;
  padding: 1rem;
  background: var(--white);
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}

#footer-text {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

#footer-links {
  margin-top: 0.25rem;
}

#footer-links a {
  color: var(--primary-color);
  margin: 0 0.5rem;
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

#footer-links a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

/* PWA 설치 배너 */
#install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 25px rgba(0,0,0,0.15);
  display: flex;
  gap: 1rem;
  align-items: center;
  z-index: 9999;
  font-size: 0.95rem;
  max-width: 90%;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#install-banner p {
  margin: 0;
  color: var(--text-color);
}

#install-banner button {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#install-btn {
  background: var(--primary-color);
  color: white;
  border: none;
}

#install-btn:hover {
  background: var(--primary-light);
}

#visit-btn {
  background: var(--primary-color);
  color: white;
  border: none;
}

#visit-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(114, 105, 239, 0.3);
}

#dismiss-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

#dismiss-btn:hover {
  background: var(--secondary-color);
}

/* 모바일 전용 스타일 */
@media (max-width: 768px) {
  footer.mobile-hidden,
  #company-info.mobile-hidden {
    display: none !important;
  }
  
  /* 데스크톱 전용 요소를 모바일에서 숨김 */
  .desktop-only {
    display: none !important;
  }
}

/* 이미지 관련 스타일 */
.message img {
  max-width: 100%;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.message img:hover {
  transform: scale(1.02);
}

/* 이미지 저장 안내 */
.image-save-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.message img:hover + .image-save-tooltip {
  opacity: 1;
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(114, 105, 239, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(114, 105, 239, 0.5);
}

/* 메시지 하이라이트 */
mark {
  background-color: rgba(114, 105, 239, 0.2);
  color: var(--text-color);
  padding: 2px 0;
  border-radius: 2px;
}

/* 로그아웃 버튼 스타일 */
#google-logout-btn {
  background: var(--danger);
  color: white;
}

#google-logout-btn:hover {
  background: #ff6384;
  color: white;
}

/* 프로필 영역 스타일 */
#user-profile {
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
}

#profile-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  transition: var(--transition);
}

#profile-img:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(114, 105, 239, 0.6);
}

.toast-message {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(50, 50, 50, 0.9);
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10000;
}

.toast-message.show {
  opacity: 1;
}

#send-btn {
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; /* 버튼 크기 증가 */
  height: 48px; /* 버튼 크기 증가 */
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 8px rgba(114, 105, 239, 0.3); /* 버튼에 그림자 추가 */
  position: relative; /* 버튼에 색상 효과를 위한 기본 설정 */
  overflow: visible; /* 툴팁이 보이도록 변경 */
}

/* 보내기 버튼 툴팁 */
#send-btn::after {
  content: "보내기";
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}

#send-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

#send-btn i {
  font-size: 1.6rem; /* 아이콘 크기 증가 */
}

#send-btn:hover {
  background: var(--primary-light);
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(114, 105, 239, 0.4);
}


/* 반응형 디자인 */
@media (max-width: 768px) {
  header {
    padding: 0.75rem;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .header-controls {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
  }
  
  #search-input {
    width: 100%;
    order: 1;
    margin-top: 0.5rem;
  }
  
  #setting-area {
    justify-content: center;
  }
  
  .message {
    max-width: 95%;
  }
  #profile-img {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .action-btn {
    width: 38px;
    height: 38px;
  }
  
  #message-input {
    padding: 0.7rem;
  }
  
  #send-btn {
    width: 44px;
    height: 44px;
  }
  
  #send-btn i {
    font-size: 1.4rem;
  }
  
  /* 모바일에서는 툴팁 위치 조정 */
  #send-btn::after {
    top: -30px;
    font-size: 11px;
    padding: 3px 6px;
  }
  
  #install-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }
  
  #install-banner button {
    margin-top: 0.5rem;
  }
}

/* 로그인 모달 스타일 */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--white);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--box-shadow);
  animation: modalSlideIn 0.3s ease;
}

.dark-mode .modal-content {
  background-color: var(--surface-color);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.5rem;
}

.close {
  color: var(--text-muted);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
}

.close:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--white);
  color: var(--text-color);
  font-size: 16px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.dark-mode .form-group input {
  background-color: var(--surface-color);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.form-buttons button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

#submit-btn {
  background-color: var(--primary-color);
  color: white;
}

#submit-btn:hover {
  background-color: #5a4fcf;
  transform: translateY(-1px);
}

#submit-btn:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

#toggle-mode-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

#toggle-mode-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.auth-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
  display: none;
}

.auth-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

.auth-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

/* 다크모드에서 메시지 색상 조정 */
.dark-mode .auth-message.success {
  background-color: #1e4d2b;
  color: #a3d5a9;
  border-color: #2d5a34;
}

.dark-mode .auth-message.error {
  background-color: #4d1e1e;
  color: #d5a3a3;
  border-color: #5a2d2d;
}