/* 기본 스타일 설정 */
:root {
  /* 주요 색상 */
  --primary: #3498db;
  --primary-dark: #2980b9;
  --primary-light: #a1d8ff;
  --secondary: #ff9ff3;
  --secondary-dark: #f368e0;
  --error: #ff7675;
  --success: #55efc4;
  --warning: #ffeaa7;
  
  /* 중립 색상 */
  --text-dark: #2c3e50;
  --text-light: #ecf0f1;
  --bg-light: #f8f9fa;
  --bg-dark: #343a40;
  --disabled: #7f8c8d;
  
  /* 고양이 테마 색상 */
  --cat-pink: #ff9ff3;
  --cat-blue: #81ecec;
  --cat-yellow: #ffeaa7;
  --cat-orange: #fab1a0;
  
  /* 타이포그래피 */
  --font-title: 'Nunito', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --font-thai: 'Sarabun', sans-serif;
  
  /* 크기 및 간격 */
  --radius: 12px;
  --shadow: 0 4px 6px rgba(32, 33, 36, 0.1);
  --shadow-hover: 0 8px 15px rgba(32, 33, 36, 0.2);
  --transition: all 0.3s ease;
  --glow: 0 0 10px rgba(52, 152, 219, 0.6);
}

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

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background-color: var(--bg-light);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-title);
  font-weight: bold;
  transition: var(--transition);
}

button.primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 0 var(--primary-dark);
}

button.primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

button.primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--primary-dark);
}

button.secondary {
  background-color: var(--secondary);
  color: var(--text-dark);
  box-shadow: 0 4px 0 var(--secondary-dark);
}

button.secondary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

button.secondary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--secondary-dark);
}

button:disabled {
  background-color: var(--disabled);
  cursor: not-allowed;
  box-shadow: none;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: var(--radius);
  font-family: var(--font-body);
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  margin-bottom: 20px;
  color: var(--text-dark);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 타이핑 배경 효과 */
.typing-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
}

.particle {
  position: absolute;
  color: var(--primary);
  font-family: var(--font-thai);
  font-size: 20px;
  animation: fall linear infinite;
}

@keyframes fall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 100px)) rotate(360deg);
    opacity: 0;
  }
}

/* 앱 레이아웃 */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(to bottom, #f8f9fa, #e9f2f9);
}

.main-content {
  flex: 1;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 헤더 스타일 */
.auth-nav {
  display: flex;
  list-style: none;
  gap: 15px;
}

.auth-nav .nav-link {
  color: var(--text-dark);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-nav .nav-link:hover {
  color: var(--primary);
  background-color: rgba(52, 152, 219, 0.1);
}

.header {
  background-color: white;
  color: var(--text-dark);
  padding: 5px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: hidden;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: bold;
}

.logo a {
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  height: 115px;
  width: auto;
  transition: transform 0.3s ease;
  margin: -35px 0;
}

.logo:hover img {
  transform: scale(1.1);
}

.main-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  margin: 0 40px;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 30px;
}

.nav-link {
  color: var(--text-dark);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
  background-color: rgba(52, 152, 219, 0.1);
}

.nav-link.active {
  color: var(--primary);
  background-color: rgba(52, 152, 219, 0.1);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background-color: var(--primary);
  border-radius: 3px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-image-container {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary-light);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.profile-image:hover {
  transform: scale(1.1);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.username {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.level-info {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.level {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 2px;
}

.level-progress {
  width: 100%;
  height: 4px;
  background-color: #eee;
  border-radius: 2px;
  overflow: hidden;
}

.level-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: 2px;
}

.logout-btn {
  padding: 6px 12px;
  font-size: 12px;
  background-color: #f8f9fa;
  color: var(--text-dark);
  border: 1px solid #ddd;
  box-shadow: none;
}

.logout-btn:hover {
  background-color: #e9ecef;
}

.auth-buttons {
  display: flex;
  gap: 10px;
}

.auth-buttons button {
  padding: 8px 16px;
  font-size: 14px;
}

.auth-buttons .login-btn {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 3px 0 var(--primary-dark);
}

.auth-buttons .register-btn {
  background-color: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.auth-buttons .login-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.auth-buttons .login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 var(--primary-dark);
}

.auth-buttons .register-btn:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* 푸터 스타일 */
.footer {
  background-color: #1a1a1a;
  color: rgba(255, 255, 255, 0.9);
  padding: 2rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  margin-bottom: -10px;
  align-items: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  justify-content: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1rem;
  margin: 0;
}

.footer-links li {
  margin: 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  display: inline-block;
  white-space: nowrap;
}

.footer-links a:hover {
  color: white;
  transform: translateX(5px);
}

.company-info {
  text-align: left;
}

.company-info p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0;
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 1rem;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 992px) {
  .footer-container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-logo {
    margin: 0 auto;
  }

  .footer-links ul {
    justify-content: center;
  }

  .company-info {
    text-align: center;
  }
}

/* 카드 컴포넌트 */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-title {
  font-size: 18px;
  font-weight: bold;
  margin: 0;
}

/* 로딩 상태 */
.loading-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 50vh;
}

.loading-spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 오류 메시지 */
.error-message {
  background-color: var(--error);
  color: white;
  padding: 10px 15px;
  border-radius: var(--radius);
  margin-bottom: 15px;
  animation: shakeX 0.5s;
}

/* 성공 메시지 */
.success-message {
  background-color: var(--success);
  color: var(--text-dark);
  padding: 10px 15px;
  border-radius: var(--radius);
  margin-bottom: 15px;
  animation: fadeIn 0.5s;
}

/* 레벨업 알림 */
.level-up-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px 30px;
  border-radius: var(--radius);
  text-align: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 0 30px rgba(52, 152, 219, 0.6);
}

.level-up-notification.active {
  opacity: 1;
  animation: scaleUp 0.5s ease;
}

.level-up-icon {
  font-size: 48px;
  margin-bottom: 10px;
  animation: bounce 1s infinite alternate;
}

.level-up-text {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: bold;
  background: linear-gradient(90deg, var(--primary), var(--success));
  
  /* 표준 속성 추가 */
  background-clip: text;
  
  /* 벤더 프리픽스 적용 */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 애니메이션 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

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

.slide-in {
  animation: slideIn 0.5s ease;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
  75% { transform: translateX(-5px); }
}

@keyframes scaleUp {
  0% { transform: translate(-50%, -50%) scale(0.5); }
  80% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(52, 152, 219, 0.6); }
  100% { transform: scale(1); }
}

.hover-float {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-float:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

/* 타이핑 효과 */
.typing-effect {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--primary);
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
  display: inline-block;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--primary) }
}

/* 반짝이는 텍스트 */
.glow-text {
  text-shadow: 0 0 10px rgba(52, 152, 219, 0.6);
}

/* 반응형 스타일 */
@media (max-width: 992px) {
  .header {
    flex-direction: column;
    padding: 10px;
  }
  
  .logo {
    margin-bottom: 10px;
  }
  
  .main-nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .main-nav li {
    margin: 5px 10px;
  }
  
  .footer-container,
  .footer-horizontal {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

/* 모바일 메뉴 스타일 */
.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--primary);
  cursor: pointer;
  padding: 5px;
  box-shadow: none;
  z-index: 1001;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 300px;
  height: 100vh;
  background-color: white;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 20px;
  transition: right 0.3s ease;
  overflow-y: auto;
  display: none;
}

.mobile-menu.active {
  right: 0;
  display: block;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-dark);
  cursor: pointer;
  padding: 5px;
  box-shadow: none;
}

.mobile-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav li {
  margin-bottom: 15px;
}

.mobile-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--text-dark);
  transition: var(--transition);
  gap: 10px;
}

.mobile-nav .nav-link:hover,
.mobile-nav .nav-link.active {
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--primary);
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

@media (max-width: 768px) {
  h1 {
    font-size: 28px;
  }
  
  h2 {
    font-size: 24px;
  }

  .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row; /* flex-direction를 row로 명시적 설정 */
  }
  
  .main-nav {
    display: none;
  }
  
  .mobile-menu-button {
    display: flex;
    align-items: center;
  }
  
  .mobile-menu {
    display: block;
  }
  
  .user-info {
    flex-grow: 1;
    justify-content: flex-end;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 10px;
  }
  
  .footer-container,
  .footer-horizontal {
    grid-template-columns: 1fr;
  }
  
  .footer-logo {
    text-align: center;
  }
  
  .user-profile {
    flex-direction: column;
    gap: 5px;
  }
  
  .user-details {
    text-align: center;
  }
}

.footer-logo {
  margin-top: -30px;
  position: relative;
  z-index: 2;
}

.footer-section {
  position: relative;
  z-index: 1;
}

.footer-logo img {
  margin: 0 auto;
  max-height: 200px;
  width: auto;
  image-rendering: -webkit-optimize-contrast;  /* Chrome, Safari */
  image-rendering: crisp-edges;               /* Firefox */
  -ms-interpolation-mode: nearest-neighbor;   /* IE */
  filter: brightness(0) invert(1);            /* 흰색으로 변환 */
  opacity: 0.95;                              /* 약간의 투명도로 부드럽게 */
}

.mobile-logo {
  width: 50px;
  height: auto;
}

/* 모바일 환경에서 헤더 스타일 */
@media screen and (max-width: 480px) {
  .header {
    padding: 0.3rem 0.6rem;
    display: flex; /* Flexbox 확인 */
    align-items: center; /* 세로 중앙 정렬 확인 */
  }

  .header .header-container { /* 이 클래스가 있다면 */
    display: flex;
    align-items: center; /* 세로 중앙 정렬 */
    width: 100%;
    gap: 5px; /* 내부 요소 기본 간격 */
  }

    /* ... */

  .header .logo {
    height: 26px !important; /* 높이 재적용 및 !important */
    width: auto !important; /* 너비 자동 조정 */
    display: block; /* 이미지 요소 정렬 위해 */
  }

  /* ... nav-menu 숨김 유지 ... */

  
  /* 로그인/회원가입 버튼 또는 사용자 정보 - !important 추가 */
  .header .auth-buttons {
    gap: 0px !important; /* gap 0px 강제 */
    margin-left: auto;
    display: flex !important;
    align-items: center !important;
  }

  /* 로그인/회원가입 버튼 */
  .header .auth-buttons button {
    padding: 0.15rem 0.3rem !important;
    font-size: 10px !important; /* 폰트 12px 강제 */
    height: 24px !important;
    min-width: auto !important;
  }

  /* 사용자 정보 영역 */
  .user-info {
    gap: 5px !important; /* 내부 요소(프로필+로그아웃 등) 간격 재조정 */
    display: flex !important;
    align-items: center !important;
  }

  .header .user-info .user-avatar {
    /* 크기는 이전 값 유지 (24px) */
    width: 24px !important;
    height: 24px !important;
    border-radius: 50%;
  }

  /* 로그아웃 버튼 */
  .header .user-info .logout-button {
    padding: 0.15rem 0.3rem !important;
    font-size: 12px !important; /* 폰트 12px 강제 */
    height: 24px !important;
    min-width: auto !important;
    border: 1px solid var(--border-color, #ddd);
    color: var(--text-secondary);
    /* display, align-items, justify-content 등 유지 */
  }
  .header .user-info .logout-button i {
    margin-right: 1px;
    font-size: 0.9em !important; /* 아이콘 크기 폰트에 맞춰 조정 */
  }

  /* 햄버거 메뉴 버튼 크기 조정 */
  .header .mobile-menu-button {
    width: 28px !important; /* 크기 약간 조정 및 !important */
    height: 28px !important;
    margin-left: 4px !important; /* 간격 조정 및 !important */
    padding: 0 !important;
    flex-shrink: 0; /* 줄어들지 않게 */
    /* display, align-items, justify-content 등 유지 */
  }

  .header .mobile-menu-button i {
    font-size: 1.1rem !important; /* 크기 조정 및 !important */
  }

  /* ... 푸터 스타일 유지 ... */

  /* 사용자 프로필 영역 가로 배치 강제 */
  .user-profile { /* 로그인 시 보이는 프로필 영역 */
    flex-direction: row !important; /* 가로 배치 강제 */
    align-items: center !important; /* 세로 중앙 정렬 */
    gap: 5px !important; /* 이미지와 버튼 사이 간격 추가 (0px 대신) */
  }
}