:root {
  --top-header-height: 50px;
}

#topHeader {
  height: var(--top-header-height);
}

#mainNav {
  top: var(--top-header-height);
}

/* Top Header */
#topHeader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background-color: #fff;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 400px;
  font-size: 14px;
  border-bottom: 1px solid #ddd;
  transition: all 0.3s ease;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Toggle buttons */
.top-controls button {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.top-controls button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Hide Top Header when scroll down */
nav.shrinkable.shrink + #topHeader {
  display: none;
}

#topHeader.shrink {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}



/* 🌙 Dark mode toggle switch */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 28px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  transition: background-color 0.4s;
  border-radius: 32px;
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  z-index: 2;
}

.icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  z-index: 1;
  pointer-events: none;
}

.icon.sun {
  right: 6px;
  color: #f9d71c;
}

.icon.moon {
  left: 6px;
  color: #333;
}

input:checked + .slider {
  background-color: #444;
}

input:checked + .slider::before {
  transform: translateX(32px);
}

@media (max-width: 768px) {
  #topHeader {
    padding: 8px 20px;
  }

  .top-controls button {
    font-size: 12px;
    margin-left: 10px;
  }

  .theme-switch {
    width: 48px;
    height: 26px;
  }

  .slider::before {
    width: 20px;
    height: 20px;
  }

  input:checked + .slider::before {
    transform: translateX(22px);
  }

  .icon {
    font-size: 12px;
  }
}

/* 🌐 Language Switch */
.lang-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 28px;
}

.lang-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.lang-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  transition: background-color 0.4s;
  border-radius: 32px;
}

.lang-switch .slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  z-index: 2;
}

.lang-switch .icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  z-index: 1;
  pointer-events: none;
  font-weight: bold;
}

.lang-switch .icon.kr {
  left: 6px;
  color: #222;
}

.lang-switch input:checked + .slider .icon.kr {
    color: #fff;
}

.lang-switch .icon.en {
  right: 6px;
  color: #222;
}

.lang-switch input:checked + .slider {
  background-color: #444;
}

.lang-switch input:checked + .slider::before {
  transform: translateX(32px);
}

@media (max-width: 768px) {
  .lang-switch {
    width: 48px;
    height: 26px;
  }

  .lang-switch .slider::before {
    width: 20px;
    height: 20px;
  }

  .lang-switch input:checked + .slider::before {
    transform: translateX(22px);
  }

  .lang-switch .icon {
    font-size: 12px;
  }
}

/* Main Nav */
#mainNav {
    position: fixed;
    top: 50px;
    width: 100%;
    z-index: 999;
    transition: top 0.3 ease;
}

#mainNav.shrink {
    top: 0;
}

nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 400px;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

nav img {
    width: 150px;
}

.fa-xmark, .fa-bars {
    display: none;
}

/* Standard Nav*/
nav.shrinkable {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: white;
    transition: all 0.3s ease;
}

/* Shrinked Nav*/
nav.shrinkable.shrink {
    padding: 10px 400px;
    box-shadow:  0 2px 5px rgba(0, 0, 0, 0.1);
}

nav.shrinkable.shrink img {
    width: 100px;
    transition: .3s ease;
}

nav.shrinkable.shrink .nav-lists ul li a {
    font-size: 13px;
}

nav.shrinkable.shrink .header-search .search-box {
    transform: scale(0.9);
    position: relative;
}

/* Category */
.nav-lists ul li {
    list-style: none;
    display: inline-block;
    padding: 5px 20px;
    position: relative;
}

.nav-lists ul li a {
    position: relative;
    text-decoration: none;
    color: var(--color);
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-lists ul li a:hover {
    color: #aaa;
}

.nav-lists ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0%;
    height: 2px;
    background-color: #009ade;
    transition: width 0.4s ease;
}

.nav-lists ul li a:hover::after,
.nav-lists ul li a.active::after {
    width: 100%;
}

/* For mobile */
.nav-toggle {
    background: none;
    border: none;
    font-size: 16px;
    display: none;
    color: #212322;
}

.nav-lists {
    display: flex;
}

.nav-lists ul {
    display: flex;
    gap: 20px;
}

@media (max-width: 768px) {
    nav {
        height: 50px;
        padding: 10px 20px;
    }

    nav img {
        width: 100px;
        position: absolute;
        left: 0;
        top: 10px;
    }

    .nav-lists ul li {
        display: block;
        padding: 0;
        margin: 0;
    }

    .nav-lists ul li a {
        color: white;
    }

    .nav-lists {
        position: absolute;
        background: #009ade;
        height: 100vh;
        width: 200px;
        top: 0;
        right: -300px;
        text-align: left;
        z-index: 2;
        transition: .4s;
    }

    .nav-lists ul {
        padding-left: 20px;
        margin-top: 60px;
        display: flex;
        flex-direction: column;
    }

    nav img {
        position: absolute;
        left: 20px;
    }

    .fa-bars {
        display: block !important;
        position: absolute;
        right: 20px;
        top: 10px;
        font-size: 24px;
        color: #212322;
    }

    .fa-xmark {
        display: block !important;
        position: absolute;
        top: 10px;
        right: 20px;
        color: white !important;
        font-size: 22px;
    }

    .header-search {
        opacity: 0;
        pointer-events: none;
    }

    nav.shrinkable.shrink {
        padding: 10px 20px;
        box-shadow: none;
    }

    nav.shrinkable.shrink img {
        width: 100px;
    }

    nav.shrinkable.shrink .nav-lists ul li a {
        font-size: 14px;
    }

    nav.shrinkable.shrink .header-search .search-box {
        transform: none;
    }
}

/* Search box */
.header-search {
    position: relative;
    width: 200px;
    display: flex;
    justify-content: flex-end;
}

.search-box {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    margin-left: auto;
    display: flex;
    align-items: center;
    width: 200px;
    border: 1px solid #ccc;
    border-radius: 999px;
    padding: 4px 8px;
    transition: width 0.3s ease;
    transform-origin: right;
    background-color: white;
    z-index: 5;
}

.search-box:focus-within {
    width: 250px;
    border-color: #009ade;
}

/* input field */
#search-input {
    flex: 1;
    padding-left: 10px;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
    transition: width 0.3s ease;
}

#search-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    padding: 4px;
    transition: color 0.2s;
}

/* Extend search box */
#search-input:focus + #search-button,
#search-input:focus {
    color: #212322;
}

.search-box:focus-within {
    width: 250px;
    border-color: #009ade;
}

/* Auto complete list */
#autocomplete-list {
    position: absolute;
    top: 45px;
    left: 0;
    width: 250px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
}

.hidden {
    display: none;
}

#autocomplete-list li {
    padding: 8px;
    cursor: pointer;
}

#autocomplete-list li:hover {
    background-color: #f0f0f0;
}

/* Popup Search */
.mobile-search-icon {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
}
  
.search-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}
  
.search-popup.hidden {
    display: none;
}
  
.popup-content {
    padding: 20px;
    border-radius: 6px;
    width: 80%;
    max-width: 400px;
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#popup-search-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid #aaa;
    color: #212322;
    font-size: 12px;
}

#popup-search-button {
    padding: 2px 8px;
    color: white;
    background: #009ade;
    border-radius: 6px;
    border: none;
    margin-left: 10px;
}
  
.close-btn {
    position: absolute;
    top: 0;
    right: 8px;
    color: #212322;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

#popup-autocomplete-list {
    list-style: none;
    margin-top: 10px;
    color: #212322;
    border: 1px solid #aaa;
    border-radius: 6px;
    padding: 5px 10px;
}
  
/* Mobile search only */
@media (max-width: 768px) {
.mobile-search-icon {
    display: block; /* 돋보기 아이콘 표시 */
    position: absolute;
    right: 60px;
  }
}