<?php
// header_6.html 带搜索框：LOGO 左、中间导航、右侧站内搜索（GET 提交 index.php，参数 s）
$h6_nav = isset($nav) && is_array($nav) ? $nav : array();
$h6_active = isset($active) ? (string)$active : 'home';
$h6_logo = trim(site_config('logo', ''));
$h6_name = site_config('company_name', '炎酷CMS');
$h6_kw = isset($_GET['s']) ? (string)$_GET['s'] : '';
?>
<style>
.yk-header6{background:var(--yk-nav-bg,#fff);position:relative;z-index:50}
.yk-h6-in{max-width:1200px;margin:0 auto;padding:0 20px;height:84px;display:flex;align-items:center;gap:28px}
.yk-h6-logo{display:flex;align-items:center;text-decoration:none;flex:none}
.yk-h6-logo img{max-height:52px;max-width:210px;display:block}
.yk-h6-logo .yk-h6-name{font-size:23px;font-weight:700;color:#0f766e;letter-spacing:1px}
.yk-h6-mid{flex:1;display:flex;align-items:center;justify-content:center}
.yk-header6 .yk-nav{display:flex;list-style:none;margin:0;padding:0}
.yk-header6 .yk-nav a{display:block;margin:0 4px;padding:8px 14px;font-size:15px;color:var(--yk-nav-color,#334155);text-decoration:none;border-radius:6px;transition:background .2s,color .2s}
.yk-header6 .yk-nav a:hover{background:#f0fdfa;color:var(--yk-nav-active,#0f766e)}
.yk-header6 .yk-nav a.on{background:var(--yk-nav-active-bg,#0f766e);color:var(--yk-nav-active,#fff)}
.yk-h6-search{flex:none;display:flex;align-items:center;border:1px solid #d7dee4;border-radius:22px;overflow:hidden;background:#f8fafc}
.yk-h6-search input{border:none;background:transparent;outline:none;width:170px;padding:9px 14px;font-size:13px;color:#334155}
.yk-h6-search button{border:none;background:#0f766e;color:#fff;font-size:13px;padding:9px 18px;cursor:pointer;transition:background .2s}
.yk-h6-search button:hover{background:#115e59}
.yk-h6-bottom{border-bottom:2px solid #0f766e}
.yk-header6 .yk-nav-toggle{display:none;background:none;border:1px solid #d7dee4;border-radius:4px;width:40px;height:36px;cursor:pointer;flex:none}
.yk-header6 .yk-nav-toggle span{display:block;width:20px;height:2px;background:#0f766e;margin:4px auto}
@media (max-width:1199px){
  .yk-h6-in{height:70px;gap:16px}
  .yk-header6 .yk-nav a{padding:7px 10px;font-size:14px}
  .yk-h6-search input{width:120px}
}
@media (max-width:767px){
  .yk-h6-in{height:56px;padding:0 14px;gap:10px}
  .yk-h6-logo img{max-height:36px}
  .yk-h6-logo .yk-h6-name{font-size:18px}
  .yk-h6-mid{justify-content:flex-end}
  .yk-header6 .yk-nav-toggle{display:block}
  .yk-header6 .yk-nav{display:none;position:absolute;top:100%;left:0;right:0;background:var(--yk-nav-bg,#fff);flex-direction:column;border-top:1px solid #eee;box-shadow:0 6px 12px rgba(0,0,0,.08)}
  .yk-header6 .yk-nav.open{display:flex}
  .yk-header6 .yk-nav a{margin:0;padding:13px 20px;border-radius:0;border-bottom:1px solid #f1f5f9}
  .yk-header6 .yk-nav a.on{background:var(--yk-nav-active-bg,#0f766e);color:#fff}
  .yk-h6-search{flex:1}
  .yk-h6-search input{flex:1;width:0;min-width:0;padding:7px 10px}
  .yk-h6-search button{padding:7px 12px}
}
</style>
<header class="yk-header6">
  <div class="yk-h6-in">
    <a class="yk-h6-logo" href="<?php echo e(url_home()); ?>">
      <?php if ($h6_logo !== '') { ?><img src="<?php echo e($h6_logo); ?>" alt="<?php echo e($h6_name); ?>"><?php } else { ?><span class="yk-h6-name"><?php echo e($h6_name); ?></span><?php } ?>
    </a>
    <div class="yk-h6-mid">
      <ul class="yk-nav">
        <li><a href="<?php echo e(url_home()); ?>"<?php echo $h6_active === 'home' ? ' class="on"' : ''; ?>>首页</a></li>
        <?php foreach ($h6_nav as $h6_n) { ?>
        <li><a href="<?php echo e(isset($h6_n['url']) ? $h6_n['url'] : url_col(isset($h6_n['id']) ? $h6_n['id'] : 0)); ?>"<?php echo (isset($h6_n['key']) && $h6_n['key'] === $h6_active) ? ' class="on"' : ''; ?>><?php echo e(isset($h6_n['name']) ? $h6_n['name'] : ''); ?></a></li>
        <?php } ?>
      </ul>
      <button type="button" class="yk-nav-toggle" aria-label="菜单"><span></span><span></span><span></span></button>
    </div>
    <form class="yk-h6-search" action="index.php" method="get" role="search">
      <input type="text" name="s" value="<?php echo e($h6_kw); ?>" placeholder="搜索关键词…">
      <button type="submit">搜索</button>
    </form>
  </div>
  <div class="yk-h6-bottom"></div>
</header>
