/* iLMS Site Header — loaded on all frontend pages */

.ilms-site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background: #ffffff;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* WordPress admin bar offset */
.admin-bar .ilms-site-header { top: 32px; }
@media screen and (max-width: 782px) {
    .admin-bar .ilms-site-header { top: 46px; }
}
.ilms-header-inner {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 32px;
    min-height: 68px;
    gap: 32px;
}

/* Scrolled state */
.ilms-site-header.ilms-header-scrolled {
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* Logo */
.ilms-header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}
.ilms-header-logo img,
.ilms-header-logo .custom-logo {
    height: 50px !important;
    width: auto !important;
    max-width: none !important;
    display: block;
}
.ilms-header-sitename {
    font-size: 18px;
    font-weight: 700;
    color: #c0392b;
    letter-spacing: .02em;
}

/* Nav */
.ilms-header-nav { margin-left: auto; }
.ilms-nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}
.ilms-nav-menu li { position: relative; }
.ilms-nav-menu li a {
    display: block;
    padding: 8px 14px;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    border-radius: 6px;
    white-space: nowrap;
    text-decoration: none;
    transition: color .15s, text-decoration-color .15s;
}
.ilms-nav-menu li a:hover,
.ilms-nav-menu li.current-menu-item > a,
.ilms-nav-menu li.current-menu-ancestor > a {
    color: #d63a4a;
    background: transparent;
    text-decoration: underline;
    text-decoration-color: #d63a4a;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
}

/* Right Actions */
.ilms-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Cart */
.ilms-header-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: #555;
    transition: color .15s, background .15s;
}
.ilms-header-cart:hover { color: #d63a4a; background: #fff0f1; }
.ilms-cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #d63a4a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0 3px;
}

/* Divider between nav and auth buttons */
.ilms-header-divider {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Header Buttons */
.ilms-header-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
/* 登入 — solid pink pill */
.ilms-header-btn--primary {
    background: #d63a4a;
    color: #fff !important;
    border: none;
}
.ilms-header-btn--primary:hover { background: #b8303e; color: #fff !important; }

/* 註冊 — plain text, light purple on hover */
.ilms-header-btn--text {
    background: transparent !important;
    color: #444 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 14px;
}
.ilms-header-btn--text:hover {
    background: #ede9fe !important;
    color: #6d28d9 !important;
}

/* 會員中心 */
.ilms-header-btn--outline {
    background: transparent;
    color: #d63a4a;
    border: 1.5px solid #d63a4a;
}
.ilms-header-btn--outline:hover { background: #d63a4a; color: #fff; }

/* 登出 */
.ilms-header-btn--ghost {
    background: transparent;
    color: #666;
    border: 1.5px solid #ddd;
}
.ilms-header-btn--ghost:hover { background: #f5f5f5; color: #333; }

/* Hamburger */
.ilms-header-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.ilms-header-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #444;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.ilms-header-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ilms-header-hamburger.open span:nth-child(2) { opacity: 0; }
.ilms-header-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Menu */
.ilms-mobile-menu {
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 16px 24px 24px;
}
.ilms-mobile-nav-menu {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}
.ilms-mobile-nav-menu li a {
    display: block;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: color .15s;
}
.ilms-mobile-nav-menu li a:hover { color: #d63a4a; }
.ilms-mobile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .ilms-header-nav { display: none; }
    .ilms-header-actions { display: none; }
    .ilms-header-hamburger { display: flex; }
    .ilms-header-inner { gap: 16px; padding: 0 16px; }
    .ilms-mobile-menu[hidden] { display: none; }
    .ilms-mobile-menu:not([hidden]) { display: block; }
}
@media (min-width: 769px) {
    .ilms-header-hamburger { display: none; }
    .ilms-mobile-menu { display: none !important; }
}
