header { display: block; padding: 0; margin: 0; }

.hap-hd {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 4px 16px;
    max-width: 1320px;
    margin: 0 auto;
}

.hap-hd-logo { flex: 0 0 auto; }
.hap-hd-logo a { display: flex; align-items: center; text-decoration: none; }

.hap-hd-nav { flex: 1 1 auto; position: relative; }
.hap-hd-nav .primary-menu {
    list-style: none; display: flex; gap: 2px;
    flex-wrap: nowrap; margin: 0; padding: 0;
}
.hap-hd-nav .primary-menu > li {
    position: relative; display: inline-block; padding: 8px 0;
}
.hap-hd-nav .primary-menu > li > a { white-space: nowrap; }
.hap-hd-nav .primary-menu > li > ul {
    position: absolute; display: none; top: 100%; left: 0;
}
.hap-hd-nav .primary-menu > li:hover > ul { display: block; }

.hap-hd-search {
    flex: 0 0 280px; max-width: 280px; min-width: 0;
    display: flex; align-items: center;
    background: rgba(255,255,255,0.92);
    border-radius: 6px; overflow: hidden; height: 36px;
}
.hap-hd-search input[type="text"] {
    flex: 1; border: none; background: transparent;
    padding: 0 8px; font-size: 14px; outline: none; min-width: 0; height: 100%;
}
.hap-hd-search .hap-search-voice {
    background: none; border: none; cursor: pointer;
    padding: 0 6px; display: flex; align-items: center; flex-shrink: 0; height: 100%;
}
.hap-hd-search .hap-search-submit {
    background: #1a6faf; border: none; cursor: pointer;
    padding: 0 10px; display: flex; align-items: center; flex-shrink: 0; height: 100%;
}

.hap-hd-dark {
    flex: 0 0 36px; width: 36px; height: 36px;
    border-radius: 50%; border: none;
    background: rgba(255,255,255,0.15);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background .2s;
}
.hap-hd-dark:hover { background: rgba(255,255,255,0.28); }
.hap-hd-dark .icon-sun  { display: none; }
.hap-hd-dark .icon-moon { display: block; }
html.dark-mode .hap-hd-dark .icon-sun  { display: block; }
html.dark-mode .hap-hd-dark .icon-moon { display: none; }

.hap-hd .userbox { flex: 0 0 auto; }

.hap-hd-burger-wrap { flex: 0 0 auto; position: relative; display: none; }
#hap-hamburger {
    background: none; border: none; cursor: pointer;
    color: #fff; font-size: 22px; padding: 4px 6px; line-height: 1;
}
#hap-user-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: #1c397b; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 180px; z-index: 99999; overflow: hidden;
}
#hap-user-dropdown.open { display: block; }
#hap-user-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; color: #fff; font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 600; text-decoration: none;
}
#hap-user-dropdown a:last-child { border-bottom: none; }
#hap-user-dropdown a:hover { background: rgba(255,255,255,0.15); }

.hap-hd-row2 { display: none; }

@media (min-width: 992px) {
    .hap-hd-burger-wrap { display: none; }
    .hap-hd .userbox { display: flex !important; }
}

@media (max-width: 991.98px) {
    .hap-hd { padding: 6px 8px; gap: 6px; }
    .hap-hd-nav          { display: none; }
    .hap-hd-dark         { display: none; }
    .hap-hd .userbox     { display: none !important; }
    .hap-hd-burger-wrap  { display: block; }
    .hap-hd-search       { flex: 1 1 0; max-width: 100%; }

    .hap-hd-row2 { display: flex; align-items: center; padding: 0 8px 6px; }
    .hap-hd-row2 .hap-hd-nav { display: block; flex: 1 1 auto; }
    .hap-hd-row2 .primary-menu {
        list-style: none; display: flex; flex-wrap: nowrap;
        overflow-x: auto; justify-content: space-around;
        margin: 0; padding: 0; gap: 2px;
    }
    .hap-hd-row2 .primary-menu > li { padding: 4px 0; }
    .hap-hd-row2 .primary-menu > li > a { font-size: 12px; padding: 5px 6px; }
    .hap-hd-row2 .hap-hd-dark { display: flex; flex: 0 0 36px; margin-left: 6px; }
}
