.header {
    background: linear-gradient(to right, #319C80, #41A890);
    padding: 10px 20px;
    margin: 0 auto;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    height: 60px;
    font-family: Arial, sans-serif;
    border-radius: 65px;
}

.header-logo {
    flex-shrink: 0;
}

.header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.header-actions {
    flex-shrink: 0;
}

/* 1200px 이하 - 기본값과 동일, 1135px에서 추가 축소 */

@media screen and (max-width: 1135px) {
    .header {
        gap: 20px;
        padding: 10px 16px;
    }
    .header-nav li {
        margin: 0 3px;
    }
    .header-nav a {
        padding: 8px 6px;
        font-size: 14px;
    }
    .header-nav > ul > li > a::after {
        margin-left: 3px;
    }
    .header-actions .favorites-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media screen and (max-width: 1050px) {
    .header {
        gap: 10px;
        padding: 10px 10px;
    }
    .header-nav li {
        margin: 0 1px;
    }
    .header-nav a {
        padding: 8px 4px;
        font-size: 13px;
    }
    .header-nav > ul > li > a::after {
        margin-left: 3px;
        width: 9px;
        height: 9px;
    }
    .header-actions .favorites-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

.header-logo img {
    height: 40px;
    vertical-align: middle;
}
.header-nav > ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
}
.header-nav li {
    margin: 0 6px;
    position: relative;
}
.header-nav a {
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 10px 8px;
    transition: color 0.3s ease, background-color 0.3s ease;
}
.header-nav li.active > a {
    color: #ffffff; /* 글자색은 흰색 유지 */
    background-color: #28816c; /* 카테고리 배경색 (darker shade of #319C80) */
    border-radius: 10px; /* 둥근 배경 */
}

.header-nav > ul > li > a::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url('/image/icon/ic_category_arrow.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.3s ease; /* 회전 애니메이션 */
}

.header-nav li.active > a::after {
    transform: rotate(180deg); /* 활성화 시 180도 회전 */
}

/* Sub-menu styles */
.sub-menu {
    display: none; /* 기본적으로 숨김 */
    position: absolute;
    top: calc(100% + 10px); /* 메인 카테고리 링크보다 10px 아래로 */
    left: 50%;
    transform: translateX(-50%);
    background-color: #28816c; /* 배경색 변경 (darker shade of #319C80) */
    list-style: none;
    padding: 10px 0;
    margin: 10px 0 0 0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
}
.header-nav li.active .sub-menu {
    display: block; /* active 클래스가 있을 때 보임 */
}
.sub-menu li {
    margin: 0;
    width: 100%;
}
.sub-menu li a {
    color: #ffffff; /* 글자색 흰색으로 변경 */
    padding: 12px 20px;
    font-size: 15px;
    white-space: nowrap; /* 줄바꿈 방지 */
}
.sub-menu li a:hover {
    background-color: #206653; /* 선택된 서브 카테고리 배경색 (even darker) */
}

.header-actions .favorites-btn {
    background-color: #ffffff;
    color: #333333;
    border: none;
    border-radius: 65px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.star-icon {
    background: linear-gradient(to bottom, #FFD000, #FFA600);
    -webkit-background-clip: text; /* For Webkit browsers */
    background-clip: text;
    -webkit-text-fill-color: transparent; /* For Webkit browsers */
    color: transparent; /* Fallback for non-Webkit browsers, though less effective */
    display: inline-block; /* Ensure background-clip: text works correctly */
}


.header-outer-container {
    padding: 20px 0; /* 상하 여백 추가 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    background: linear-gradient(to bottom, rgba(243, 248, 247, 0.95), rgba(243, 248, 247, 0.85));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 즐겨찾기 모달 스타일 */
.favorites-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.favorites-modal-overlay.active {
    display: flex;
}

.favorites-modal {
    background-color: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.favorites-modal-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.favorites-toggle-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: #f0faf7;
    border: 1.5px solid #319C80;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.favorites-toggle-btn:hover {
    background-color: #dff3ed;
}

.favorites-toggle-btn.is-favorite {
    background-color: #fff8e1;
    border-color: #ffc107;
}

.favorites-toggle-btn.is-favorite:hover {
    background-color: #fff0c2;
}

.favorites-toggle-btn .toggle-star {
    font-size: 20px;
    color: #319C80;
    flex-shrink: 0;
}

.favorites-toggle-btn.is-favorite .toggle-star {
    background: linear-gradient(to bottom, #FFD000, #FFA600);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.toggle-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 2px;
}

.toggle-page-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.toggle-text {
    font-size: 12px;
    color: #319C80;
    line-height: 1.3;
    font-weight: 500;
}

.favorites-toggle-btn.is-favorite .toggle-text {
    color: #997404;
}

.favorites-modal-title {
    padding: 16px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.favorites-list {
    list-style: none;
    margin: 0;
    padding: 0 16px;
    overflow-y: auto;
    flex: 1;
    max-height: 300px;
}

.favorites-list:empty::after {
    content: "즐겨찾기가 없습니다.\A위 버튼으로 이 페이지를 추가해보세요.";
    white-space: pre;
    display: block;
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
    line-height: 1.8;
}

.favorites-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.favorites-item:last-child {
    border-bottom: none;
}

.favorites-item a {
    flex: 1;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s ease;
}

.favorites-item a:hover {
    color: #319C80;
}

.favorites-item .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 22px;
    color: #999;
    transition: color 0.2s ease;
    border-radius: 6px;
}

.favorites-item .delete-btn:hover {
    color: #e74c3c;
    background-color: #fef0ef;
}

/* 현재 페이지 항목 강조 */
.favorites-item.is-current {
    background-color: #f0faf7;
    border-radius: 8px;
    padding: 10px 8px;
    margin: 2px -8px;
}

.favorites-item.is-current a {
    color: #319C80;
    font-weight: 600;
}

.current-badge {
    display: inline-block;
    background-color: #319C80;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    line-height: 1.6;
}

.favorites-modal-footer {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
}

.favorites-clear-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.favorites-clear-btn:hover {
    background-color: #555;
}

.favorites-clear-btn .trash-icon {
    font-size: 16px;
}

/* Mobile Menu Button - Hidden by default on desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
}

.mobile-menu-btn img {
    width: 24px;
    height: 24px;
}

/* Mobile Side Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
    z-index: 3001;
    display: flex;
    flex-direction: column;
}

.mobile-menu-overlay.active .mobile-menu-sidebar {
    left: 0;
}

.mobile-menu-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #333;
    font-size: 32px;
    line-height: 1;
    margin-bottom: 12px;
}

.mobile-menu-logo {
    height: 28px;
    width: auto;
}

/* 2-Panel Layout Body */
.mobile-menu-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel - Categories */
.mobile-menu-categories {
    width: 45%;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.mobile-category-item {
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    text-align: left;
    font-size: 15px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e8e8e8;
}

.mobile-category-item:hover {
    background-color: #eaeaea;
}

.mobile-category-item.active {
    background-color: #ffffff;
    color: #333;
    font-weight: 600;
    border-right: 2px solid #ffffff;
    margin-right: -1px;
}

/* Right Panel - Subcategories */
.mobile-menu-subcategories {
    width: 55%;
    background-color: #ffffff;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-submenu li a {
    display: block;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.2s ease;
}

.mobile-submenu li a:hover {
    background-color: #f5f5f5;
    color: #319C80;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 991px) {
    .header {
        justify-content: space-between;
        padding: 12px 16px;
        gap: 0;
        border-radius: 0;
        max-width: 100%;
        height: auto;
        background: transparent;
    }

    .header-logo {
        display: none;
    }

    .header-nav {
        display: none;
    }

    .header-actions {
        display: block;
        order: 2;
    }

    .header-actions .favorites-btn {
        background-color: #319C80;
        color: #ffffff;
        padding: 8px 14px;
        font-size: 14px;
        border-radius: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .header-actions .favorites-btn .star-icon {
        background: linear-gradient(to bottom, #FFE066, #FFD000);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        order: 1;
    }

    .header-outer-container {
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}