/* /static/css/header.css */

/* 헤더 기본 스타일 */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   로고 스타일
   ============================================ */

/* 로고 컨테이너 */
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: bold;
  font-size: 24px;
  color: #333;
  height: 40px;
}

/* 기존 이모지/텍스트 숨기기 */
.logo span:first-child,  /* 🎨 이모지 */
.logo span:last-child {  /* Art4Point 텍스트 */
  display: none !important;
}

/* 로고 이미지 추가 */
.logo::before {
  content: '';
  display: block;
  width: 220px;  /* 이미지 너비 - 필요에 따라 조정 */
  height: 30px;  /* 이미지 높이 */
  background-image: url('/static/images/art4point-logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: opacity 0.2s ease;
}

/* 로고 hover 효과 */
.logo:hover::before {
  opacity: 0.8;
}

/* 모바일 대응 */
@media (max-width: 768px) {
  .logo::before {
    width: 120px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .logo::before {
    width: 100px;
    height: 28px;
  }
}

/* ============================================
   헤더 드롭다운 애니메이션 추가
   ============================================ */

.user-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.user-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============================================
   헤더 로딩 스피너
   ============================================ */

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

.header-loading .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3a86ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}






/* 내비게이션 */
.gnb {
  display: flex;
  gap: 32px;
  margin: 0 auto;
}

.gnb a {
  color: #555;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s;
}

.gnb a:hover {
  color: #3a86ff;
}

.gnb a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #3a86ff;
  transition: width 0.3s;
}

.gnb a:hover::after {
  width: 100%;
}

/* 헤더 액션 영역 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 비로그인 상태 버튼 */
.header-guest-actions {
  display: flex;
  gap: 8px;
}

/* 버튼 공통 */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:not(.primary) {
  border-color: #ddd;
  background: white;
  color: #555;
}

.btn:not(.primary):hover {
  border-color: #ccc;
  background: #f8f9fa;
}

.btn.primary {
  background: #3a86ff;
  color: white;
  border-color: #3a86ff;
}

.btn.primary:hover {
  background: #2667cc;
  border-color: #2667cc;
}

/* 로그인 상태 영역 */
.header-user-actions {
  display: none; /* JS에서 필요할 때만 flex로 */
}

.header-user-actions.show {
  display: flex;
}

/* 로그인 유저 박스 */
.header-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #f8f9fa;
  border-radius: 24px;
  text-decoration: none;
  color: #333;
  border: 1px solid #e9ecef;
  transition: all 0.2s;
}

.header-user-link:hover {
  background: #e9ecef;
  border-color: #dee2e6;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 아바타 이미지 */
.header-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.header-user-link:hover .header-user-avatar {
  transform: scale(1.05);
}

/* 사용자 이름 */
.header-user-name {
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 4px;
}

/* 애니메이션 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-guest-actions.show,
.header-user-actions.show {
  animation: fadeIn 0.3s ease-out;
}

/* 반응형 */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    height: 56px;
  }

  .logo {
    font-size: 20px;
  }

  .gnb {
    gap: 16px;
    margin: 0 20px;
  }

  .gnb a {
    font-size: 14px;
  }

  .header-user-name {
    display: none; /* 모바일에서는 이름 숨기기 */
  }

  .header-user-link {
    padding: 6px;
  }

  .btn.small {
    padding: 5px 10px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .gnb {
    display: none; /* 아주 작은 화면에서는 내비 숨기기 */
  }

  .header-inner {
    justify-content: space-between;
  }
}



/* 드롭다운 스타일 */
.user-dropdown {
  position: relative;
}

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  color: #495057;
  transition: all 0.2s;
}

.user-dropdown-btn:hover {
  background: #e9ecef;
  border-color: #dee2e6;
}

.dropdown-arrow {
  font-size: 12px;
  color: #6c757d;
  margin-left: 4px;
}

/* 드롭다운 메뉴 */
.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 1000;
}

.user-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 드롭다운 아이템 */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.dropdown-icon {
  font-size: 16px;
  width: 20px;
}

.dropdown-divider {
  height: 1px;
  background: #e9ecef;
  margin: 4px 0;
}

.logout-btn {
  color: #dc3545;
}

.logout-btn:hover {
  background: #ffebee;
}

.dropdown-section {
  display: block;
}