/* =========================
   Header
   ========================= */

header {
    position: sticky;
    top: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    min-height: 64px;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-left {
    flex: 1 1 auto;
    min-width: 0;
}

.header-right {
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.header-right.nav-links {
    flex-wrap: nowrap;
}

/* logo */
.logo {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
    white-space: nowrap;
}

.logo a {
    color: inherit;
    text-decoration: none;
}

.logo a:hover {
    color: #2563eb;
}

/* header controls */
.header-right select,
.header-right button,
.header-right .header-control {
    height: 38px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    line-height: 38px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.header-right select {
    width: auto;
    min-width: 72px;
    max-width: 160px;
}

.header-right select:focus,
.header-right button:focus,
.header-right .header-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 汉堡按钮 */
.hamburger {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex: 0 0 auto;
}

.hamburger:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
}

/* header nav */
.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* 全局链接 */
a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* =========================
   Main layout
   ========================= */

.page-with-sidebar {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    max-width: 1500px;
    margin: 24px auto;
    padding: 0 16px;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
}

/* =========================
   Mobile
   ========================= */

@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        min-height: auto;
    }

    .header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-right {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .header-right form,
    .header-right select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .header-right select {
        width: 100%;
        max-width: none;
    }

    .logo {
        font-size: 1.05rem;
        white-space: normal;
        word-break: break-word;
    }

    .hamburger {
        display: inline-flex;
    }

    .page-with-sidebar {
        display: block;
        margin: 16px auto;
        padding: 0 12px;
    }

    .sidebar {
        display: none;
    }

    .sidebar.active {
        display: block;
        margin-bottom: 12px;
    }
}