/**
 * ヘッダー共通スタイル
 * レスポンシブ対応、モバイルファースト
 */

/* ===== 基本変数 ===== */
:root {
    --header-height: 70px;
    --primary: #e74c3c;
    --primary-hover: #c0392b;
    --text-dark: #333;
    --text-light: #666;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* ===== ヘッダー基本 ===== */
.site-header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* ===== ロゴ ===== */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
    transition: var(--transition);
    flex-shrink: 0;
    max-width: 52vw;
}

.header-logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-logo:hover {
    color: var(--primary-hover);
}

.header-logo-icon {
    font-size: 1.5rem;
}

/* ===== デスクトップナビ ===== */
.header-nav {
    display: none;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0.65rem 1rem;
    margin: 0;
    padding: 0 0.25rem 0.25rem 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.nav-list a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.45rem 0.15rem;
    position: relative;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-list a:hover,
.nav-list a.active {
    color: var(--primary);
}

.nav-list a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-list a:hover::after,
.nav-list a.active::after {
    width: 100%;
}

/* ===== 検索ボックス ===== */
.header-search {
    display: none;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    width: min(200px, 28vw);
    min-width: 120px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-hover);
}

/* ===== ハンバーガーメニュー ===== */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    transition: var(--transition);
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===== モバイルメニュー ===== */
.mobile-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white);
    padding: 2rem 1.5rem;
    transform: translateX(100%);
    transition: var(--transition);
    overflow-y: auto;
    z-index: 999;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li {
    border-bottom: 1px solid #eee;
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    padding: 0.85rem 0;
    min-height: 44px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 500;
    transition: var(--transition);
}

.mobile-nav-list a:hover,
.mobile-nav-list a.active {
    color: var(--primary);
    padding-left: 0.5rem;
}

.mobile-search {
    margin-top: 2rem;
}

.mobile-search .search-form {
    display: flex;
    gap: 0.5rem;
}

.mobile-search .search-input {
    flex: 1;
    width: auto;
}

/* ===== タブレット（768px以上） ===== */
@media (min-width: 768px) {
    .header-logo {
        font-size: 1.4rem;
    }
    
    .header-nav {
        display: block;
    }
    
    .hamburger {
        display: none;
    }
    
    .mobile-menu {
        display: none;
    }
}

/* ===== デスクトップ（1024px以上） ===== */
@media (min-width: 1024px) {
    .header-logo {
        font-size: 1.5rem;
    }
    
    .nav-list {
        gap: 2rem;
    }
    
    .header-search {
        display: block;
    }
}

/* ===== アクセシビリティ ===== */
.header-nav a:focus,
.mobile-nav-list a:focus,
.search-input:focus,
.search-btn:focus,
.hamburger:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== 印刷用スタイル ===== */
@media print {
    .site-header {
        position: static;
        box-shadow: none;
    }
    
    .hamburger,
    .mobile-menu,
    .header-search {
        display: none !important;
    }
}
