/**
 * Message Notification System Styles
 * 토스트 알림 및 헤더 배지 스타일
 */

/* ============================================
   알림 배지 (Header & Sidebar)
   ============================================ */

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: linear-gradient(135deg, #ff3b3b 0%, #ff1744 100%);
  color: white;
  border-radius: 50%;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* 더 높은 우선순위로 폰트 적용 */
button .notification-badge,
.new-chat-btn .notification-badge,
.shimmer-btn .notification-badge,
a .notification-badge {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* 사이드바 알림 배지 위치 조정 */
.sidebar .notification-badge {
  top: 8px;
  right: 12px;
}

/* 하단 네비게이션 채팅 배지 위치 조정 */
.bottom-nav .bottom-nav-item[data-nav="chat"] .notification-badge,
.bottom-nav a[href*="chat.html"] .notification-badge {
  top: 4px;
  right: 50%;
  transform: translateX(16px);
  min-width: 16px;
  width: auto;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

/* ============================================
   토스트 컨테이너
   ============================================ */

.message-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
}

.message-toast-container > * {
  pointer-events: auto;
}

/* ============================================
   토스트 메시지
   ============================================ */

.message-toast {
  width: 380px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

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

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* 토스트 헤더 */
.message-toast-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.message-toast-icon {
  font-size: 20px;
}

.message-toast-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}

.message-toast-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.message-toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 토스트 본문 */
.message-toast-body {
  padding: 16px;
  background: white;
}

.message-toast-sender {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.message-toast-sender strong {
  color: #2d3748;
}

.message-toast-company {
  color: #718096;
  font-size: 12px;
  padding: 2px 8px;
  background: #edf2f7;
  border-radius: 4px;
}

.message-toast-preview {
  color: #4a5568;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  padding: 8px;
  background: #f7fafc;
  border-radius: 6px;
}

/* 토스트 푸터 */
.message-toast-footer {
  padding: 12px 16px;
  background: #f7fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.message-toast-action {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.message-toast-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.message-toast-action:active {
  transform: translateY(0);
}

/* ============================================
   반응형 디자인
   ============================================ */

@media (max-width: 768px) {
  .message-toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .message-toast {
    width: 100%;
    max-width: 100%;
  }

  .notification-badge {
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    font-size: 12px;
    padding: 0 5px;
  }
}

@media (max-width: 480px) {
  .message-toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  .message-toast-header {
    padding: 10px 12px;
  }

  .message-toast-body {
    padding: 12px;
  }

  .message-toast-sender {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .message-toast-company {
    font-size: 11px;
  }
}

/* ============================================
   다크모드 지원 (선택적)
   ============================================ */

@media (prefers-color-scheme: dark) {
  .message-toast {
    background: #2d3748;
  }

  .message-toast-body {
    background: #2d3748;
  }

  .message-toast-sender strong {
    color: #e2e8f0;
  }

  .message-toast-company {
    background: #4a5568;
    color: #cbd5e0;
  }

  .message-toast-preview {
    background: #1a202c;
    color: #cbd5e0;
  }

  .message-toast-footer {
    background: #1a202c;
    border-top-color: #4a5568;
  }

  .notification-badge {
    border-color: #2d3748;
  }
}

/* ============================================
   접근성 개선
   ============================================ */

.message-toast:focus-within {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

.message-toast-close:focus,
.message-toast-action:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* 애니메이션 감소 설정 존중 */
@media (prefers-reduced-motion: reduce) {
  .message-toast,
  .notification-badge {
    animation: none;
  }

  .message-toast-action:hover {
    transform: none;
  }
}

/* ============================================
   일반 토스트 알림 (Simple Toast)
   ============================================ */

.simple-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.simple-toast-container > * {
  pointer-events: auto;
}

.simple-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-tertiary, #1a1a1a);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toastSlideIn 0.3s ease-out;
  max-width: 400px;
}

.simple-toast.toast-success {
  border-left: 4px solid #10b981;
}

.simple-toast.toast-error {
  border-left: 4px solid #ef4444;
}

.simple-toast.toast-warning {
  border-left: 4px solid #f59e0b;
}

.simple-toast.toast-info {
  border-left: 4px solid #60a5fa;
}

.simple-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.simple-toast.toast-success .simple-toast-icon {
  color: #10b981;
}

.simple-toast.toast-error .simple-toast-icon {
  color: #ef4444;
}

.simple-toast.toast-warning .simple-toast-icon {
  color: #f59e0b;
}

.simple-toast.toast-info .simple-toast-icon {
  color: #60a5fa;
}

.simple-toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary, #cccccc);
  line-height: 1.4;
}

.simple-toast-close {
  background: none;
  border: none;
  color: var(--text-muted, #6b6b6b);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.simple-toast-close:hover {
  color: var(--text-primary, #cccccc);
  background: var(--bg-hover, #1e1e1e);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.simple-toast.removing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

/* 라이트모드 토스트 */
body.light-mode .simple-toast {
  background: #ffffff;
  border-color: #e5e5e5;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .simple-toast-message {
  color: #1a1a1a;
}

body.light-mode .simple-toast-close {
  color: #999999;
}

body.light-mode .simple-toast-close:hover {
  color: #1a1a1a;
  background: #f5f5f5;
}

/* 모바일 토스트 */
@media (max-width: 768px) {
  .simple-toast-container {
    top: auto;
    bottom: 24px;
    right: 16px;
    left: 16px;
  }

  .simple-toast {
    max-width: 100%;
  }
}
