/* Common Header */
.main-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md);
  padding-top: 0;
}

/* 헤더 내부 콘텐츠 */
.main-header .header-content {
  background-color: var(--blue-dark);
  padding: var(--spacing-md);
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  /* max-width, margin 제거 - 부모가 이미 제한함 */
}

/* 모바일 헤더 구조 */
.main-header.mobile-header {
  max-width: none; /* 모바일은 전체 너비 */
  padding: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  background-color: var(--blue-dark);
}

/* 모바일에서 콘텐츠 여백 확보 */
@media (max-width: 768px) {
  body {
    padding-bottom: 56px; /* 하단 바 높이만큼 */
  }
}

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

.header-bottom {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: var(--blue-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 0;
  height: 56px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  position: relative;
}

.logo-container {
  display: flex;
  align-items: center;
  position: relative;
  z-index: var(--z-dropdown);
}

.logo-container img {
  max-height: 2.5rem;
  width: auto;
  cursor: pointer;
}

.mobile-header .logo-container img {
  max-height: 1.8rem;
}

/* Navigation and Menu Styles */
.nav-container {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1;
  transition: all 0.3s ease;
}

.nav-item {
  position: relative;
}

.nav-button {
  flex-direction: column;
  width: 64px;
  height: 64px;
  padding: 8px 0;
  margin: 0;
  border: none;
  border-radius: var(--border-radius-sm);
  gap: 4px;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: var(--font-size-sm);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.nav-button i {
  font-size: 24px;
  margin-bottom: 4px;
}

.nav-button span {
  font-size: 11px;
  white-space: nowrap;
}

.nav-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.nav-button.active {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.auth-container {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

button.auth-button {
  background-color: transparent;
  border: 1px solid white;
  height: 36px;
  padding: 0 15px;
  transition: all 0.2s ease;
}

button.auth-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav-button {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  padding: 0;
}

.mobile-nav-button.auth-button-mobile {
  width: auto;
  padding: 0 12px;
  min-width: 60px;
}

.mobile-nav-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mobile-bottom-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background-color: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
}

.mobile-bottom-button i {
  font-size: 18px;
}

.mobile-bottom-button span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mobile-bottom-button.active,
.mobile-bottom-button:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
}

.mobile-menu-toggle {
  display: none;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: var(--border-radius-sm);
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: calc(var(--z-mobile-menu) + 10);
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle.active {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.mobile-menu-toggle i {
  transition: transform 0.3s ease;
}

.mobile-menu-toggle.active i {
  transform: rotate(90deg);
}

.dropdown-container {
  position: relative;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background-color: var(--background-light);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  border-radius: var(--border-radius-sm);
  z-index: var(--z-dropdown);
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-content a {
  color: var(--text-primary);
  padding: var(--spacing-md);
  text-decoration: none;
  display: block;
  font-size: var(--font-size-sm);
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background-color: var(--background-dark);
}

.dropdown-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: var(--z-header);
  display: none;
}

.menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-header) - 100);
  display: none;
}

/* ===== MEDIA QUERIES ===== */

@media (min-width: 769px) {
  .dropdown-content {
    width: auto;
    min-width: 180px;
  }

  .dropdown-container .nav-button::after {
    content: "";
    display: inline-block;
    margin-left: 4px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid white;
    vertical-align: middle;
    transition: transform 0.2s ease;
  }

  .dropdown-container .nav-button.active::after {
    transform: rotate(180deg);
  }
}

@media (max-width: 1200px) and (min-width: 769px) {
  .main-header .header-content {
    padding: var(--spacing-md) var(--spacing-sm);
    height: 52px;
  }

  .header-top {
    padding: 8px var(--spacing-sm);
  }

  .header-content {
    gap: var(--spacing-xs);
  }

  .logo-container img {
    max-height: 2.2rem;
  }

  .nav-container {
    gap: 1px;
  }

  .nav-button {
    width: 56px;
    height: 56px;
    padding: 6px 0;
  }

  .nav-button i {
    font-size: 20px;
    margin-bottom: 3px;
  }

  .nav-button span {
    font-size: 10px;
  }

  .auth-container button {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .dropdown-content {
    min-width: 160px;
  }

  .dropdown-content a {
    padding: 10px 12px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .main-header {
    height: auto;
    padding: 0;
    position: sticky;
    top: 0;
    width: 100%;
  }

  .header-top {
    padding: 8px;
  }

  .nav-button {
    width: 51px;
    height: 51px;
    padding: 6px 0;
    min-height: 32px;
    font-size: 11px;
  }

  .nav-button i {
    font-size: 19px;
    margin-bottom: 3px;
  }

  .nav-button span {
    font-size: 9px;
  }

  button.auth-button {
    height: 29px;
    padding: 0 12px;
    font-size: 11px;
  }

  .mobile-menu-toggle {
    display: flex !important;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--z-mobile-menu);
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
  }

  .mobile-top-nav .auth-container {
    margin-right: 0;
  }

  .main-header:not(.mobile-header) .auth-container {
    margin-right: 55px;
  }

  .nav-container {
    display: none;
  }

  .nav-container:not(.active) {
    display: none;
  }

  .nav-container:not(.mobile-menu-active) {
    display: none;
  }

  .nav-container.mobile-menu-active {
    display: flex !important;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background-color: var(--blue-dark);
    z-index: var(--z-mobile-menu);
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .nav-container.mobile-menu-active .nav-button {
    width: 100%;
    height: auto;
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 8px 12px;
    margin-bottom: 4px;
    background-color: rgba(255, 255, 255, 0.05);
  }

  .nav-container.mobile-menu-active .nav-button i {
    font-size: 16px;
    margin-right: 12px;
    margin-bottom: 0;
  }

  .nav-container.mobile-menu-active .nav-button span {
    font-size: 13px;
  }

  .nav-container.mobile-menu-active .dropdown-content {
    position: static;
    width: 100%;
    box-shadow: none;
    margin: 4px 0 8px 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
  }

  .nav-container.mobile-menu-active .dropdown-content a {
    color: white;
    padding: 8px 12px;
  }

  .nav-container.mobile-menu-active .dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }

  .nav-container:not(.active) .dropdown-content.active {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: var(--z-dropdown);
    background-color: var(--background-light);
    color: var(--text-primary);
    overflow-y: auto;
  }

  .nav-container:not(.active) .dropdown-content.active a {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .nav-container.mobile-menu-active .dropdown-container > .nav-button {
    position: relative;
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
  }

  .nav-container.mobile-menu-active .dropdown-container .nav-button::after {
    content: "▼";
    font-size: 10px;
    margin-left: auto;
    margin-right: 5px;
    transition: transform 0.2s ease;
  }

  .nav-container.mobile-menu-active
    .dropdown-container
    .nav-button.active::after {
    content: "▲";
  }

  .nav-container.mobile-menu-active .dropdown-content {
    position: static;
    width: 100%;
    max-width: none;
    margin: 4px 0 8px 16px;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
  }

  .nav-container.mobile-menu-active .dropdown-content a {
    color: white;
  }
}

/* ===== FAB (Floating Action Button) ===== */
.fab-button {
  position: fixed;
  width: 64px;
  height: 64px;
  background: var(--primary-color);
  color: white;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 48, 135, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: calc(var(--z-header) + 50);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  right: 20px;
  bottom: 20px;
  gap: 2px;
  padding: 8px 6px;
}

.fab-button i {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.fab-button span {
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.fab-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(0, 48, 135, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px) scale(1.05);
}

.fab-button:hover i {
  transform: scale(1.1);
}

.fab-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 6px rgba(0, 48, 135, 0.3);
}

/* 모바일: 하단바 위에 배치 */
@media (max-width: 768px) {
  .fab-button {
    width: 60px;
    height: 60px;
    right: 16px;
    bottom: 72px; /* 하단바(56px) + 여백(16px) */
    padding: 7px 5px;
  }

  .fab-button i {
    font-size: 18px;
  }

  .fab-button span {
    font-size: 8.5px;
  }
}
    font-size: 8.5px;
  }
}
