/* Winit Header Styles */

/* 공통 스타일 */
.winit-header {
    width: 100%;
    background: #fff;
    position: relative;
    /* font-family inherited from body */
}

/* .winit-header .container is now handled by global .container in style.css */
.winit-header .container {
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* --- 상단 바 (검색 + 날짜) --- */
.header-top-bar {
    /* border and padding moved to .container */
}

.header-top-bar .container {
    border-bottom: 1px solid #eee;
    padding-top: 5px;
    padding-bottom: 5px;
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 검색 폼 */
.header-search-form {
    display: flex;
    align-items: center;
}

.header-search-form .search-submit {
    background: none;
    border: none;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    padding: 0 10px 0 0;
}

.header-search-form .search-field {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #666;
    width: 200px;
    outline: none;
}

.header-search-form .search-field::placeholder {
    color: #ccc;
}

/* 날짜 표시 */
.top-right-date {
    font-size: 13px;
    color: #888;
    font-weight: 400;
}

/* --- 메인 헤더 (로고 + 메뉴 + 햄버거) --- */
.header-main {
    /* border and padding moved to .container */
}

.header-main .container {
    padding-top: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #000;
}

.header-main-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 로고 */
.logo-container {
    display: flex;
    align-items: center;
}

.logo-container .custom-logo {
    max-height: 50px;
    /* 로고 크기 조절 */
    width: auto;
    vertical-align: middle;
    margin: 0;
}

.logo-container .site-title {
    font-size: 24px;
    font-weight: bold;
    color: #000;
    text-decoration: none;
    line-height: 1;
}

/* 네비게이션 (중앙/우측) */
.navigation-area {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
    /* 메뉴 우측 정렬 */
    margin-right: 20px;
    /* 햄버거 버튼과의 간격 */
    align-items: center;
}

/* Vertical Line Separator */
.navigation-area::after {
    content: '';
    display: block;
    width: 1px;
    height: 20px;
    background-color: #ccc;
    margin-left: 20px;
}

.main-navigation .nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
    /* 메뉴 간격 */
}

.main-navigation .nav-menu a {
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 0;
    display: block;
}

.main-navigation .nav-menu a:hover {
    color: #000;
}

/* --- PC 서브메뉴 (드롭다운) --- */
@media (min-width: 769px) {

    /* 하위 메뉴 li 기준점 */
    .main-navigation .nav-menu>li {
        position: relative;
    }

    /* 화살표 아이콘 */
    .nav-menu .menu-item-has-children>a {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .nav-menu .menu-item-has-children>a::after {
        content: "\f078";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 11px;
        transition: transform 0.3s ease;
    }

    .nav-menu .menu-item-has-children:hover>a::after {
        transform: rotate(180deg);
    }

    /* 서브메뉴 컨테이너 */
    .nav-menu .sub-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(calc(-50% - 8px));
        background: #fff;
        min-width: 170px;
        filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.1));
        border-radius: 8px;
        padding: 10px 0;
        opacity: 0;
        visibility: hidden;
        z-index: 100;
        list-style: none;
        margin: 0;
    }

    /* 삼각형 화살표 */
    .nav-menu .sub-menu::before {
        content: '';
        position: absolute;
        top: -6px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 6px solid #fff;
    }

    .nav-menu .sub-menu li {
        display: block;
        padding: 0;
    }

    .nav-menu .sub-menu a {
        display: block;
        padding: 10px 20px;
        font-size: 14px;
        color: #333;
        font-weight: 400;
        transition: background 0.2s;
        text-align: center;
    }

    .nav-menu .sub-menu a:hover {
        background: #f5f5f5;
        color: #000;
    }

    .nav-menu .sub-menu a::after {
        display: none !important;
    }

    /* 활성 상태 - fade in */
    .nav-menu .menu-item-has-children.active-menu .sub-menu {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease, visibility 0s;
    }

    .animate-fade-in .sub-menu {
        animation: fadeInUpCentered 0.3s ease forwards;
    }
}

/* 모바일에서 PC 서브메뉴 숨김 */
@media (max-width: 768px) {
    .main-navigation .nav-menu .sub-menu {
        display: none !important;
    }
}

/* 서브메뉴 페이드인 애니메이션 */
@keyframes fadeInUpCentered {
    from {
        opacity: 0;
        transform: translate(calc(-50% - 8px), 10px);
    }

    to {
        opacity: 1;
        transform: translate(calc(-50% - 8px), 0);
    }
}

/* 햄버거 버튼 */
.header-controls .menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: #000;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

/* 반응형 */
@media (max-width: 768px) {
    .header-top-bar {
        display: none;
        /* 모바일에서 상단 바 숨김 여부 확인 필요 */
    }

    .navigation-area {
        display: none;
        /* 모바일에서 메인 메뉴 숨김 */
    }

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

/* --- 사이드 패널 디자인 (Legacy Code Applied) --- */

/* 관리자 바가 있을 때 사이드 패널 위치 조정 */
.admin-bar .side-panel {
    top: 32px !important;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.side-panel.active {
    right: 0;
}

.side-panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
}

/* X 버튼 스타일 */
.close-panel {
    background: none !important;
    border: none;
    color: #323232 !important;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    position: absolute;
    left: 15px;
}

/* 로고 컨테이너 */
.side-panel-logo {
    flex-grow: 1;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.side-panel-logo img {
    max-height: 30px;
    width: auto;
    display: block;
}

/* 검색 폼 (Legacy) */
.search-form-container {
    width: 100%;
    max-width: 90%;
    margin: 0 auto;
    padding: 0;
    border-bottom: 2px solid #000;
}

.search-form {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.search-field {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 15px;
    width: 100%;
    padding: 15px 0;
}

.search-submit {
    background: none !important;
    border: none;
    color: #323232 !important;
    font-size: 20px;
    cursor: pointer;
    margin-left: 15px !important;
}

/* 퀵 링크 */
.quick-links {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.quick-links-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.quick-links-menu li {
    text-align: center;
}

.quick-links-menu a {
    display: block;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

/* 아코디언 메뉴 */
.accordion-menu {
    flex-grow: 1;
    overflow-y: auto;
}

.accordion-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.accordion-menu-items li {
    border-bottom: 1px solid #eee;
}

.accordion-menu-items>li>a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    padding-left: 20px;
}

.accordion-menu-items>li>a::after {
    content: "\f067";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 14px;
    color: #888;
    margin-left: auto;
    transition: transform 0.3s ease, color 0.3s ease;
    margin-right: 5px;
}

.accordion-menu-items>li>a:hover::after,
.accordion-menu-items>li.active>a::after {
    transform: rotate(45deg);
    color: #333;
}

.accordion-menu-items>li>a:hover {
    background-color: #fafafa;
    color: #000;
    transition: background-color 0.3s ease;
}

.accordion-menu-items .sub-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f8f8;
}

.accordion-menu-items .menu-item-has-children.active>.sub-menu {
    display: block;
}

.accordion-menu-items .sub-menu a {
    display: block;
    padding: 12px 15px 12px 30px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

/* 사이드바 위젯 */
.sidebar-widgets {
    padding: 15px;
    background: #f8f8f8;
}

.widget {
    margin-bottom: 20px;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    font-size: 16px;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

@media (max-width: 768px) {
    .side-panel {
        display: block !important;
        width: 100%;
    }

    .accordion-menu {
        display: block !important;
    }

    .accordion-menu-items>li>a {
        font-size: 17px !important;
    }
}

/* Header/Close button refined styles (from legacy) */
.side-panel-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-panel {
    background: none;
    border: none;
    color: #000 !important;
    font-size: 25px !important;
    cursor: pointer;
    padding: 5px;
    position: absolute;
    left: 20px;
    margin-top: 12px;
}

.side-panel-logo {
    flex-grow: 1;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 10px;
}

.side-panel-logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

.side-panel.active {
    animation: slideIn 0.3s ease forwards;
}

.side-panel:not(.active) {
    animation: slideOut 0.3s ease forwards;
}